Jpp  18.3.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Friends | List of all members
JEEP::JTime< JSeparator_t > Struct Template Reference

Auxiliary class for simple time. More...

#include <JTime.hh>

Inheritance diagram for JEEP::JTime< JSeparator_t >:
JLANG::JComparable< JFirst_t, JSecond_t > JDATABASE::JDateAndTime_t JDATABASE::JDatim_t

Public Member Functions

 JTime ()
 Default constructor. More...
 
 JTime (const int hour, const int minute, const int second)
 Constructor. More...
 
 JTime (const std::string &time)
 Constructor. More...
 
bool less (const JTime &time) const
 Less-than method. More...
 

Static Public Member Functions

static JTime min ()
 Minimal time. More...
 
static JTime max ()
 Maximal time. More...
 

Public Attributes

int hour
 hour More...
 
int minute
 minute More...
 
int second
 second More...
 

Static Public Attributes

static const char SEPARATOR = JSeparator_t
 Separation character. More...
 

Friends

std::istream & operator>> (std::istream &in, JTime &object)
 Read time from input stream. More...
 
std::ostream & operator<< (std::ostream &out, const JTime &object)
 Write time to output stream. More...
 

Detailed Description

template<char JSeparator_t>
struct JEEP::JTime< JSeparator_t >

Auxiliary class for simple time.

The corresponding ASCII format is hh<separator>mm<separator>ss, where hh corresponds to the hour, mm to the minutes and ss to the seconds.
The separator is defined by the template parameter.

Definition at line 39 of file Jeep/JTime.hh.

Constructor & Destructor Documentation

template<char JSeparator_t>
JEEP::JTime< JSeparator_t >::JTime ( )
inline

Default constructor.

Definition at line 51 of file Jeep/JTime.hh.

51  :
52  hour (0),
53  minute(0),
54  second(0)
55  {}
int second
second
Definition: Jeep/JTime.hh:156
int minute
minute
Definition: Jeep/JTime.hh:155
int hour
hour
Definition: Jeep/JTime.hh:154
template<char JSeparator_t>
JEEP::JTime< JSeparator_t >::JTime ( const int  hour,
const int  minute,
const int  second 
)
inline

Constructor.

Parameters
hourhour
minuteminute
secondsecond

Definition at line 65 of file Jeep/JTime.hh.

67  :
68  hour (hour),
69  minute(minute),
70  second(second)
71  {}
int second
second
Definition: Jeep/JTime.hh:156
int minute
minute
Definition: Jeep/JTime.hh:155
int hour
hour
Definition: Jeep/JTime.hh:154
template<char JSeparator_t>
JEEP::JTime< JSeparator_t >::JTime ( const std::string time)
inline

Constructor.

Parameters
timetime

Definition at line 79 of file Jeep/JTime.hh.

80  {
81  std::istringstream in(time);
82 
83  in >> *this;
84  }
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Definition: JCanberra.sh:48

Member Function Documentation

template<char JSeparator_t>
static JTime JEEP::JTime< JSeparator_t >::min ( )
inlinestatic

Minimal time.

Definition at line 87 of file Jeep/JTime.hh.

template<char JSeparator_t>
static JTime JEEP::JTime< JSeparator_t >::max ( )
inlinestatic

Maximal time.

Definition at line 88 of file Jeep/JTime.hh.

template<char JSeparator_t>
bool JEEP::JTime< JSeparator_t >::less ( const JTime< JSeparator_t > &  time) const
inline

Less-than method.

Parameters
timetime
Returns
true if this time earlier than given time; else false

Definition at line 97 of file Jeep/JTime.hh.

98  {
99  if (this->hour == time.hour) {
100 
101  if (this->minute == time.minute)
102  return this->second < time.second;
103  else
104  return this->minute < time.minute;
105 
106  } else {
107 
108  return this->hour < time.hour;
109  }
110  }
int second
second
Definition: Jeep/JTime.hh:156
int minute
minute
Definition: Jeep/JTime.hh:155
int hour
hour
Definition: Jeep/JTime.hh:154

Friends And Related Function Documentation

template<char JSeparator_t>
std::istream& operator>> ( std::istream &  in,
JTime< JSeparator_t > &  object 
)
friend

Read time from input stream.

Parameters
ininput stream
objecttime
Returns
input stream

Definition at line 120 of file Jeep/JTime.hh.

121  {
122  using namespace std;
123  using namespace JPP;
124 
125  object = JTime();
126 
127  while (isspace(in.peek())) { in.ignore(); }
128 
129  const locale loc = in.imbue(locale(in.getloc(), new JWhiteSpacesFacet(in.getloc(), JTime::SEPARATOR)));
130 
131  in >> object.hour >> object.minute >> object.second;
132 
133  in.imbue(loc);
134 
135  return in;
136  }
static const char SEPARATOR
Separation character.
Definition: Jeep/JTime.hh:45
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Definition: JCanberra.sh:48
JTime()
Default constructor.
Definition: Jeep/JTime.hh:51
char * loc(char *orig)
template<char JSeparator_t>
std::ostream& operator<< ( std::ostream &  out,
const JTime< JSeparator_t > &  object 
)
friend

Write time to output stream.

Parameters
outoutput stream
objecttime
Returns
output stream

Definition at line 146 of file Jeep/JTime.hh.

147  {
148  return out << FILL(2,'0') << object.hour << JTime::SEPARATOR
149  << FILL(2,'0') << object.minute << JTime::SEPARATOR
150  << FILL(2,'0') << object.second << FILL();
151  }
Auxiliary data structure for sequence of same character.
Definition: JManip.hh:328
static const char SEPARATOR
Separation character.
Definition: Jeep/JTime.hh:45

Member Data Documentation

template<char JSeparator_t>
const char JEEP::JTime< JSeparator_t >::SEPARATOR = JSeparator_t
static

Separation character.

Definition at line 45 of file Jeep/JTime.hh.

template<char JSeparator_t>
int JEEP::JTime< JSeparator_t >::hour

hour

Definition at line 154 of file Jeep/JTime.hh.

template<char JSeparator_t>
int JEEP::JTime< JSeparator_t >::minute

minute

Definition at line 155 of file Jeep/JTime.hh.

template<char JSeparator_t>
int JEEP::JTime< JSeparator_t >::second

second

Definition at line 156 of file Jeep/JTime.hh.


The documentation for this struct was generated from the following file: