|CDPTimerMs(bool editableTimeout = false)|
|virtual void||Create(const char *shortName, CDPBaseObject *pParent)|
|void||SetModel(const std::string &model)|
|void||SetTimeoutDelayCallback(std::function<void( CDP::StudioAPI::CDPVariantValue ) > callback)|
Reimplemented Public Functions
|virtual void||FillNodeChildren(CDP::StudioAPI::NodeStream &stream) const override|
|virtual const std::string||GetNodeName() const override|
|virtual std::string||GetNodeTypeName() const override|
- 26 public functions inherited from CDP::StudioAPI::CDPNode
- 22 public functions inherited from CDP::StudioAPI::ICDPNode
Additional Inherited Members
- 1 protected function inherited from CDP::StudioAPI::CDPNode
Real-time timer for delay and time monitoring with 1 ms resolution. Provides better performance by reducing the cpu load, but should not be used in threads. May be used as delay timer, does not need to know sample interval.
Note that 1 ms resolution is only true if any components are running at 1000Hz. CDPTimerMs gets its value from globalTime which is updated by CDPEngine scheduler. Resolution may also become better than 1ms, if any components are running faster than 1000Hz.
If the timer is used in a CDPComponent based class, the timer and it's values may show up in CDP Studio under the component's Timers section if
Create() is called. In component's
myTimer.Create("MyTimer",this), and in component's
Use as delay timer:
- Init using Reset(delay in s);
- Call Start() (or Restart()) to enable timeout checking.
- Call TimedOut() to check if time has expired.
- Call Restart() to reset and start new timeout check when time has expired.
Use as stopwatch-timer:
Member Function Documentation
Constructs a CDPTimerMs instance.
[virtual] void CDPTimerMs::Create(const char *shortName, CDPBaseObject *pParent)
Stores shortName, calls parent's
RegisterCDPNode() and sets up callback when
Returns the delay (in seconds) set by Reset(delay).
Returns time (in seconds) between last two TimedOut() calls.
This method allows a CDPTimer to be used as stop-watch. Interval time in sec = delta count / timer counts per sec.
Reimplemented from CDPNode::FillNodeChildren().
Writes its CDPSettings to stream.
Reimplemented from ICDPNode::GetNodeName().
Reimplemented from ICDPNode::GetNodeTypeName().
true if timer is running.
Returns time [s] (since application startup), as calculated by the previous TimedOut() call.
Resets and sets the delay timeout in seconds.
Resets the timeout timer flag and stops the timer.
This method automatically intitialises the timer if necessary. Remember to call Start() to enable the timeout timer after a call to Reset().
Resets and starts the timer.
Sets m_timedout to
void CDPTimerMs::SetTimeoutDelayCallback(std::function<void( CDP::StudioAPI::CDPVariantValue ) > callback)
Sets up callback when
Starts the timer.
Returns the state of the timeout flag as calculated by the previous TimedOut() call.
Returns time [s] since application startup.
See also DeltaTime().
true if timer has timed out.
Automatic timer system initialisation if Init() has not been called. Remember to Restart() the timer after reaching timeout delay time. It is not necessary to call TimedOut() periodically at an accurate time interval, the timer keeps track of real time internally.
Member Variable Documentation
This variable holds current time [s]. Updated by TimedOut().
This variable holds timer object's modelname ('CDPTimerMs').
This variable holds previous time [s]. Updated by TimedOut().
This variable holds set to true when timer is running.
This variable holds time when Start() was called [s].
This variable holds time elapsed [s] since Start()/Restart(), as calculated by TimedOut() function.
This variable holds set to true when timer has timed out.
This variable holds timeout delay [s]. Set in Reset(double delay) and returned in Delay().
This variable holds timeout absolute time [s]. Sum of m_startTime and m_timeoutDelay, set in Start().