Marsyas
0.6.0-alpha
|
Base timer class must be overriden to create new concrete timers. More...
#include <TmTimer.h>
Inherited by TmRealTime, TmSampleCount, and TmVirtualTime.
Public Member Functions | |
void | dispatch () |
dispatch any events that have become due | |
bool | eventPending () |
determine if an event has become due for dispatch | |
std::string | getName () |
get the timer identifier, ie "foo" | |
std::string | getPrefix () |
get the timer prefix, the combination "type/name" | |
mrs_natural | getTime () |
the current count of this timer | |
std::string | getType () |
get the timer type name, ie "TmSampleCount" | |
virtual mrs_natural | intervalsize (std::string interval)=0 |
calculate the size of the given time interval. | |
void | post (std::string event_time, Repeat rep, EvEvent *me) |
post an event to be scheduled by the timer | |
void | post (std::string event_time, EvEvent *me) |
post an event to be scheduled by the timer with no repetition | |
void | post (EvEvent *e) |
post an event to be scheduled by the timer. The event should have correct time information otherwise dispatch is unpredictable but probably immediate. | |
virtual mrs_natural | readTimeSrc ()=0 |
calculate the time that has passed since last being read. | |
void | tick () |
called on each buffer passing through the network | |
TmTimer (std::string type, std::string name) | |
the constructor requires the type and name | |
TmTimer (const TmTimer &t) | |
copy constructor | |
virtual void | trigger () |
trigger the timer action. | |
virtual void | updtime () |
called by tick() prior to events being triggered. This method calls readTimeSrc() and adds the difference since the last tick. | |
virtual void | updtimer (std::string cname, TmControlValue value) |
set a particular parameter value in the timer. | |
void | updtimer (TmParam ¶m) |
set a particular parameter value in the timer. | |
void | updtimer (std::vector< TmParam > params) |
set a number of parameter values in the timer. | |
virtual | ~TmTimer () |
Base timer class must be overriden to create new concrete timers.
TmTimer | ( | std::string | type, |
std::string | name | ||
) |
the constructor requires the type and name
Definition at line 35 of file TmTimer.cpp.
~TmTimer | ( | ) | [virtual] |
Definition at line 53 of file TmTimer.cpp.
void dispatch | ( | ) |
dispatch any events that have become due
Events are due for dispatch if their dispatch time is less than or equal to the current time. For each event this method will call the event's dispatch method, check to see if it is to be repeated and, if so, will ensure the necessary bookeeping and repost the event.
Definition at line 172 of file TmTimer.cpp.
bool eventPending | ( | ) |
determine if an event has become due for dispatch
Definition at line 166 of file TmTimer.cpp.
mrs_string getName | ( | ) |
mrs_string getPrefix | ( | ) |
get the timer prefix, the combination "type/name"
Definition at line 76 of file TmTimer.cpp.
mrs_natural getTime | ( | ) |
the current count of this timer
Definition at line 82 of file TmTimer.cpp.
mrs_string getType | ( | void | ) |
get the timer type name, ie "TmSampleCount"
Definition at line 70 of file TmTimer.cpp.
virtual mrs_natural intervalsize | ( | std::string | interval | ) | [pure virtual] |
calculate the size of the given time interval.
A concrete timer may wish to support units for the time reference it defines. This method will define these units by recognizing them in the string and calculating the interval width appropriately.
interval | a string representation of the interval. |
Implemented in TmSampleCount, TmVirtualTime, and TmRealTime.
post an event to be scheduled by the timer
event_time | event dispatch time. Must be meaningful to the concrete timer. |
rep | repetition information |
me | the event |
Definition at line 136 of file TmTimer.cpp.
post an event to be scheduled by the timer with no repetition
event_time | event dispatch time. Must be meaningful to the concrete timer. |
me | the event |
Definition at line 147 of file TmTimer.cpp.
post an event to be scheduled by the timer. The event should have correct time information otherwise dispatch is unpredictable but probably immediate.
e | an event with scheduling information |
Definition at line 156 of file TmTimer.cpp.
virtual mrs_natural readTimeSrc | ( | ) | [pure virtual] |
calculate the time that has passed since last being read.
This method is overriden by concrete timers to calculate the amount of time that has passed between timer ticks, or buffers of data.
Implemented in TmSampleCount, TmVirtualTime, and TmRealTime.
void tick | ( | ) |
called on each buffer passing through the network
Tick calls readTimeSrc to adjust the current timer count. It then calls the trigger method.
Definition at line 88 of file TmTimer.cpp.
void trigger | ( | ) | [virtual] |
trigger the timer action.
Can be overriden to define a custom action of the timer. Normally trigger simply calls the dispatch method, although overriding trigger may be helpful to define pre or post actions around calling the dispatch method.
Definition at line 104 of file TmTimer.cpp.
void updtime | ( | ) | [virtual] |
called by tick() prior to events being triggered. This method calls readTimeSrc() and adds the difference since the last tick.
Reimplemented in TmRealTime.
Definition at line 95 of file TmTimer.cpp.
void updtimer | ( | std::string | cname, |
TmControlValue | value | ||
) | [virtual] |
set a particular parameter value in the timer.
cname | the control path to set |
value | the value to set cname with |
Reimplemented in TmSampleCount, and TmVirtualTime.
Definition at line 110 of file TmTimer.cpp.
set a particular parameter value in the timer.
param | a parameter to update this timer with |
Definition at line 119 of file TmTimer.cpp.
set a number of parameter values in the timer.
params | a vector containing parameters to update the timer with. |
Definition at line 125 of file TmTimer.cpp.