#include <mmstimer.h>

Public Member Functions | |
| MMSTimer (bool singleShot=false) | |
| Creates a new MMSTimer. | |
| ~MMSTimer () | |
| Destroys a MMSTimer. | |
| bool | start (unsigned int milliSeconds, unsigned int firsttime_ms=0) |
| Starts timer. | |
| bool | restart () |
| Restarts timer. | |
| bool | stop () |
| Stops timer. | |
Public Attributes | |
| sigc::signal< void > | timeOut |
| This signal emits if the timer expires. | |
Private Types | |
| enum | { START, RESTART, STOP, QUIT } |
Private Member Functions | |
| void | threadMain () |
| Virtual main method for the thread. | |
Private Attributes | |
| bool | singleShot |
| enum MMSTimer:: { ... } | action |
| bool | firsttime |
| __time_t | secs |
| long int | nSecs |
| __time_t | ft_secs |
| long int | ft_nSecs |
| pthread_cond_t | cond |
| pthread_mutex_t | mutex |
You can use MMSTimer for repetitive or single shot timers
start(unsigned int milliSeconds)) a signal
timeOut emits. void fn1() {printf("fn1 called
);} MMSTimer *repetitiveTimer = new MMSTimer(); repetitiveTimer->timeOut->connect(sigc::ptr_fun(&fn1)); // calls every 1.5 seconds fn1() repetitiveTimer->start(1500);
Definition at line 66 of file mmstimer.h.
anonymous enum [private] |
| MMSTimer::MMSTimer | ( | bool | singleShot = false |
) |
Creates a new MMSTimer.
| singleShot | If this is set to true, the timer will emit only once, else it will do it repetitive. |
Definition at line 42 of file mmstimer.cpp.
| MMSTimer::~MMSTimer | ( | ) |
| bool MMSTimer::start | ( | unsigned int | milliSeconds, | |
| unsigned int | firsttime_ms = 0 | |||
| ) |
Starts timer.
| milliSeconds | the timer interval in milli seconds | |
| firsttime_ms | the first timeOut will be emitted after firsttime_ms milliseconds default 0 means that the first timeOut will also be emitted after milliSeconds |
Definition at line 70 of file mmstimer.cpp.
| bool MMSTimer::restart | ( | ) |
Restarts timer.
A running timer stops first and no signal emits. After this a new timer starts with the full interval (milliSeconds) set with start().
Definition at line 90 of file mmstimer.cpp.
| bool MMSTimer::stop | ( | ) |
Stops timer.
A running timer stops and no signal emits.
Definition at line 103 of file mmstimer.cpp.
| void MMSTimer::threadMain | ( | ) | [private, virtual] |
Virtual main method for the thread.
This virtual method is empty and have to be setup with code by a derived class. The MMSThread class is only the base class and cannot be constructed.
Implements MMSThread.
Definition at line 116 of file mmstimer.cpp.
| sigc::signal<void> MMSTimer::timeOut |
This signal emits if the timer expires.
Connect a function to this signal.
Definition at line 123 of file mmstimer.h.
bool MMSTimer::singleShot [private] |
Definition at line 126 of file mmstimer.h.
enum { ... } MMSTimer::action [private] |
bool MMSTimer::firsttime [private] |
Definition at line 134 of file mmstimer.h.
__time_t MMSTimer::secs [private] |
Definition at line 135 of file mmstimer.h.
long int MMSTimer::nSecs [private] |
Definition at line 136 of file mmstimer.h.
__time_t MMSTimer::ft_secs [private] |
Definition at line 137 of file mmstimer.h.
long int MMSTimer::ft_nSecs [private] |
Definition at line 138 of file mmstimer.h.
pthread_cond_t MMSTimer::cond [private] |
Definition at line 140 of file mmstimer.h.
pthread_mutex_t MMSTimer::mutex [private] |
Definition at line 141 of file mmstimer.h.