DetectorGraph
2.0
|
Push data to a topic when timer expires. More...
Public Member Functions | |
TimeoutPublisher () | |
Basic Constructor. More... | |
void | SetTimeoutService (TimeoutPublisherService *apTimeoutPublisherService) |
Sets the timeout service and acquires a TimerHandle to be used by the default/simple API. More... | |
virtual | ~TimeoutPublisher () |
Empty Virtual Destructor. More... | |
void | PublishOnTimeout (const T &aData, const uint64_t aMillisecondsFromNow, TimeoutPublisherHandle aTimerId=kInvalidTimeoutPublisherHandle) |
Schedules a TopicState for Publishing after a timeout. More... | |
void | CancelPublishOnTimeout (TimeoutPublisherHandle aTimerId=kInvalidTimeoutPublisherHandle) |
Cancels the Scheduled PublishOnTimeout. More... | |
bool | HasTimeoutExpired (TimeoutPublisherHandle aTimerId=kInvalidTimeoutPublisherHandle) const |
Returns weather a timeout has expired or not. More... | |
Protected Attributes | |
TimeoutPublisherService * | mpTimeoutPublisherService |
TimeoutPublisherHandle | mDefaultHandle |
Push data to a topic when timer expires.
TimeoutPublisher provides a mechanism to schedule the publishing of a TopicState to the graph in the future. Similarly to FuturePublisher, the published TopicState goes into a separate (future) evaluation and so toposort constraints do not apply; this allows a detector to publish to itself.
Additionally the detector can cancel/reset a scheduled job.
Example:
Definition at line 57 of file timeoutpublisher.hpp.
|
inline |
Basic Constructor.
This constructor does not fully initialize the TimeoutPublisher as a TimeoutPublisherService is needed. That's done by SetTimeoutService.
Definition at line 66 of file timeoutpublisher.hpp.
|
inlinevirtual |
Empty Virtual Destructor.
Definition at line 84 of file timeoutpublisher.hpp.
|
inline |
Cancels the Scheduled PublishOnTimeout.
Definition at line 108 of file timeoutpublisher.hpp.
|
inline |
Returns weather a timeout has expired or not.
Definition at line 118 of file timeoutpublisher.hpp.
|
inline |
Schedules a TopicState for Publishing after a timeout.
This method is analogous to Publish() in the sense that it's a Detector output but with two big differences:
aData | is only published after |
aMillisecondsFromNow |
aData | is published to the Graph Input queue instead of another topic so TopoSort constraints do not apply; this allows a detector to publish and subscribe to the same topic. |
aTimerId | (optional) allows detectors to control multiple concurrent timers. TimeoutPublisherHandles are vended through TimeoutPublisherService::GetUniqueTimerHandle |
Definition at line 98 of file timeoutpublisher.hpp.
|
inline |
Sets the timeout service and acquires a TimerHandle to be used by the default/simple API.
Definition at line 75 of file timeoutpublisher.hpp.
|
protected |
Definition at line 128 of file timeoutpublisher.hpp.
|
protected |
Definition at line 127 of file timeoutpublisher.hpp.