16 #include "rofl/common/cmemory.h"
17 #include "rofl/common/logging.h"
18 #include "rofl/common/croflexception.h"
19 #include "rofl/common/ctimerid.h"
20 #include "rofl/common/ctimespec.h"
93 void *data = (
void*)0) :
98 { this->timespec += rofl::ctimespec::now(); };
123 timer_id = timer.timer_id;
125 timespec = timer.timespec;
126 opaque = timer.opaque;
139 timer.timespec = timespec + t.timespec;
150 timer.timespec = timespec - t.timespec;
160 timespec += t.timespec;
170 timespec -= t.timespec;
181 {
return not ((*
this < t) && (t < *
this)); };
189 {
return not (*
this == t); };
197 {
return (timespec < t.timespec); };
205 {
return ((*
this < t) || (*
this == t)); };
213 {
return not (*
this <= t); };
221 {
return ((*
this > t) || (*
this == t)); };
245 {
return timer_id; };
266 {
return timespec; };
273 {
return timespec; };
286 bool operator() (
ctimer const* t) {
294 operator<< (std::ostream& os,
const rofl::ctimer& timer) {
296 os <<
indent(0) <<
"<ctimer ";
297 os <<
"opaque:" << timer.opaque <<
" ";
298 os <<
"data:" << timer.data <<
" ";
299 os <<
">" << std::endl;
301 os << timer.timer_id;
302 os << timer.timespec;
308 static const long CC_TIMER_ONE_SECOND_S = 1;
309 static const long CC_TIMER_ONE_SECOND_NS = 1e9;
rofl::ctimespec & set_timespec()
Returns reference to rofl::ctimespec instance assigned to this timer.
Definition: ctimer.h:265
ctimer()
ctimer default constructor
Definition: ctimer.h:73
Timer handle used by class rofl::cioloop.
Definition: ctimerid.h:21
virtual ~ctimer()
ctimer destructor
Definition: ctimer.h:67
Single timer object in rofl-common.
Definition: ctimer.h:45
int get_opaque() const
Returns opaque timer type chosen by user.
Definition: ctimer.h:251
Environment expected by an instance of class rofl::ctimer.
Definition: ctimer.h:27
bool operator>(const rofl::ctimer &t) const
Greater operator.
Definition: ctimer.h:211
ctimer_env * get_timer_env() const
Returns pointer to environment of this rofl::ctimer instance.
Definition: ctimer.h:237
bool operator<=(const rofl::ctimer &t) const
Lesser-or-equal operator.
Definition: ctimer.h:203
bool operator!=(const rofl::ctimer &t) const
Inequality operator.
Definition: ctimer.h:187
ctimer(ctimer_env *env, int opaque, const rofl::ctimespec ×pec, void *data=(void *) 0)
ctimer constructor
Definition: ctimer.h:89
ctimer(const rofl::ctimer &timer)
ctimer copy constructor
Definition: ctimer.h:103
ctimer & operator=(const rofl::ctimer &timer)
Assignment operator.
Definition: ctimer.h:119
bool operator<(const rofl::ctimer &t) const
Lesser operator.
Definition: ctimer.h:195
bool operator==(const rofl::ctimer &t) const
Equality operator.
Definition: ctimer.h:179
static rofl::ctimer now()
Returns a rofl::ctimer object with internal timespec set to current time.
Definition: ctimer.h:55
void * get_data() const
Returns pointer to opaque data segment chosen by user.
Definition: ctimer.h:258
Time specification used by class rofl::ctimer object.
Definition: ctimespec.h:25
bool operator>=(const rofl::ctimer &t) const
Greater-or-equal operator.
Definition: ctimer.h:219
const rofl::ctimerid & get_timer_id() const
Returns const reference to rofl-common's internal handle assigned to this timer.
Definition: ctimer.h:244
const rofl::ctimespec & get_timespec() const
Returns const reference to rofl::ctimespec instance assigned to this timer.
Definition: ctimer.h:272