23 #define DEFAULT_CLOCK CLOCK_REALTIME
33 #define timer_t unsigned int
82 class TimerId_eq :
public std::unary_function<TimerId, bool> {
85 explicit TimerId_eq(timer_t* timer) : timer_(timer) {}
86 bool operator() (
const TimerId& t)
const {
return t.
timer_ == timer_;}
93 class TimerSig_eq :
public std::unary_function<TimerId, bool> {
97 bool operator() (
const TimerId& t)
const {
return t.
sigNo_ == sigNo_;}
111 AbsTimer(
int signo,
void (*handler)(
int));
184 void privateConstructor(
int signo,
void (*handler)(
int));
215 struct sigevent evp_;
220 unsigned long initSec_;
224 unsigned long initNanoSec_;
229 unsigned long intervalSec_;
234 unsigned long intervalNanoSec_;
241 void addTimer(timer_t* timer,
int signo);
247 void remTimer(timer_t* timer);
252 bool timerAlreadyExists(
int sigNo);
259 void setFutureTime(
unsigned long initSec,
260 unsigned long initNanoSec,
261 unsigned long intervalSec,
262 unsigned long intervalNanoSec);
A class for storing information about a known Timer.
int sigNo_
Signal associated with this timer.
~AbsTimer()
AbsTimer destructor.
void start()
Start the Timer.
void stop()
Stop the Timer.
unsigned int * timer_
Pointer to the timer managed by this object.
void setIntegral(bool integral)
Set whether this clock should run on integral second boundaries relative to the current time...
static std::list< TimerId > timerList_
A static list of timers.
A predicate for testing if a timer's signal matches a requested signal.
TimerId(unsigned int *timer, int sigNo)
Constructor for TimerId.
A predicate for testing if a timer's id matches a requested id.
void checkTimer()
A debugging function, to print out the signals of all know timers.
void reArm()
Re-arm a periodic timer which we want to fire relative to absolute second boundaries.
Class used to set up repetitive or one-shot timers on integral boundries relative to the system clock...
AbsTimer(int signo, void(*handler)(int))
AbsTimer constructor.
void setIntervalDelay(unsigned long sec, unsigned long nsec)
Set interval delay for timer.
unsigned long getResolution()
Returns the resolution of the clock in nsec.
void setInitialDelay(unsigned long sec, unsigned long nsec)
Set initial delay when timer is to start from the moment its start() method is called.
bool isRunning()
Query if this timer is running.