DetectorGraph  2.0
Public Member Functions | Protected Member Functions | List of all members
DetectorGraph::TestTimeoutPublisherService Class Reference

Push data to a topic when timer expires. More...

Collaboration diagram for DetectorGraph::TestTimeoutPublisherService:

Public Member Functions

 TestTimeoutPublisherService (Graph &arGraph)
 
virtual TimeOffset GetTime () const
 Should return the time offset to Epoch. More...
 
virtual TimeOffset GetMonotonicTime () const
 Should return monotonic time since some unspecified starting point. More...
 
void SetWallClockOffset (int64_t aWallClockOffset)
 
bool FireNextTimeout ()
 
bool ForwardTimeAndEvaluate (TimeOffset aFwdTime, Graph &aGraphToEvaluate)
 
TimeOffset GetMetronomePeriod ()
 
- Public Member Functions inherited from DetectorGraph::TimeoutPublisherService
 TimeoutPublisherService (Graph &graph)
 Constructor that initializes the service connected to a graph. More...
 
virtual ~TimeoutPublisherService ()
 Destructor. More...
 
void StartPeriodicPublishing ()
 Starts a Metronome to publish scheduled TopicStates. More...
 
TimeoutPublisherHandle GetUniqueTimerHandle ()
 Returns a unique id/handle for a new timer. More...
 
template<class T >
void SchedulePeriodicPublishing (const TimeOffset aPeriodInMilliseconds)
 Schedules a TopicState for publishing periodically. More...
 
template<class T >
void ScheduleTimeout (const T &aData, const TimeOffset aMillisecondsFromNow, const TimeoutPublisherHandle aTimerHandle)
 Schedules a TopicState for Publishing after a timeout. More...
 
void CancelPublishOnTimeout (const TimeoutPublisherHandle aTimerHandle)
 Cancels a timeout and deletes the stored TopicState. More...
 
bool HasTimeoutExpired (const TimeoutPublisherHandle aTimerHandle) const
 Returns weather the timeout for a given handle has expired/fired already. More...
 

Protected Member Functions

virtual void SetTimeout (const TimeOffset aMillisecondsFromNow, const TimeoutPublisherHandle aTimerId)
 Should setup a timeout for the given handle. More...
 
virtual void Start (const TimeoutPublisherHandle aTimerId)
 Should start a timer for the given handle. More...
 
virtual void Cancel (const TimeoutPublisherHandle aTimerId)
 Should cancel the timer the given handle. More...
 
virtual void StartMetronome (const TimeOffset aPeriodInMilliseconds)
 Should start the metronome (periodic timer) for the given period. More...
 
virtual void CancelMetronome ()
 Should stop the metronome. More...
 
- Protected Member Functions inherited from DetectorGraph::TimeoutPublisherService
void TimeoutExpired (const TimeoutPublisherHandle aTimerHandle)
 Fires/Dispatches a TopicState that was pending on a timeout. More...
 
void MetronomeFired ()
 Update metronome counters and Fires/Dispatches TopicStates that was pending on scheduled period. More...
 

Detailed Description

Push data to a topic when timer expires.

TimeoutPublisher provides a mechanism to schedule the publish of data to a topic. Additionally the detector can cancel/reset a scheduled job.

Definition at line 42 of file testtimeoutpublisherservice.hpp.

Constructor & Destructor Documentation

◆ TestTimeoutPublisherService()

DetectorGraph::TestTimeoutPublisherService::TestTimeoutPublisherService ( Graph arGraph)

Definition at line 28 of file testtimeoutpublisherservice.cpp.

Member Function Documentation

◆ Cancel()

void DetectorGraph::TestTimeoutPublisherService::Cancel ( const TimeoutPublisherHandle  )
protectedvirtual

Should cancel the timer the given handle.

This must be implemented by subclasses. This should cancel the timer.

Implements DetectorGraph::TimeoutPublisherService.

Definition at line 53 of file testtimeoutpublisherservice.cpp.

◆ CancelMetronome()

void DetectorGraph::TestTimeoutPublisherService::CancelMetronome ( )
protectedvirtual

Should stop the metronome.

This must be implemented by subclasses. This should stop the periodic timer.

Implements DetectorGraph::TimeoutPublisherService.

Definition at line 69 of file testtimeoutpublisherservice.cpp.

◆ FireNextTimeout()

bool DetectorGraph::TestTimeoutPublisherService::FireNextTimeout ( )

Definition at line 79 of file testtimeoutpublisherservice.cpp.

◆ ForwardTimeAndEvaluate()

bool DetectorGraph::TestTimeoutPublisherService::ForwardTimeAndEvaluate ( TimeOffset  aFwdTime,
Graph aGraphToEvaluate 
)

Definition at line 104 of file testtimeoutpublisherservice.cpp.

◆ GetMetronomePeriod()

TimeOffset DetectorGraph::TestTimeoutPublisherService::GetMetronomePeriod ( )

Definition at line 195 of file testtimeoutpublisherservice.cpp.

◆ GetMonotonicTime()

TimeOffset DetectorGraph::TestTimeoutPublisherService::GetMonotonicTime ( ) const
virtual

Should return monotonic time since some unspecified starting point.

This must be implemented by subclasses. Returns the time offset to an unspecified point back in time that should not change for the duration of this instance. Different detectors may call this to acquire a consistent, strictly increasing, time offset valid for the duration of this object's instance.

Implements DetectorGraph::TimeoutPublisherService.

Definition at line 172 of file testtimeoutpublisherservice.cpp.

◆ GetTime()

TimeOffset DetectorGraph::TestTimeoutPublisherService::GetTime ( ) const
virtual

Should return the time offset to Epoch.

This must be implemented by subclasses. Different detectors may call this to acquire a timestamp - usually used to "stamp" a TopicState. This clock may jump back & forth due to time sync.

Implements DetectorGraph::TimeoutPublisherService.

Definition at line 167 of file testtimeoutpublisherservice.cpp.

◆ SetTimeout()

void DetectorGraph::TestTimeoutPublisherService::SetTimeout ( const TimeOffset  aMillisecondsFromNow,
const TimeoutPublisherHandle   
)
protectedvirtual

Should setup a timeout for the given handle.

This must be implemented by subclasses. This should initialize a unique timer for that handle (if it doesn't already exist) and set it's timeout accordingly.

Implements DetectorGraph::TimeoutPublisherService.

Definition at line 39 of file testtimeoutpublisherservice.cpp.

◆ SetWallClockOffset()

void DetectorGraph::TestTimeoutPublisherService::SetWallClockOffset ( int64_t  aWallClockOffset)

Definition at line 74 of file testtimeoutpublisherservice.cpp.

◆ Start()

void DetectorGraph::TestTimeoutPublisherService::Start ( const TimeoutPublisherHandle  )
protectedvirtual

Should start a timer for the given handle.

This must be implemented by subclasses. This should start the timer.

Implements DetectorGraph::TimeoutPublisherService.

Definition at line 48 of file testtimeoutpublisherservice.cpp.

◆ StartMetronome()

void DetectorGraph::TestTimeoutPublisherService::StartMetronome ( const TimeOffset  aPeriodInMilliseconds)
protectedvirtual

Should start the metronome (periodic timer) for the given period.

This must be implemented by subclasses. This should start the periodic timer.

Implements DetectorGraph::TimeoutPublisherService.

Definition at line 62 of file testtimeoutpublisherservice.cpp.


The documentation for this class was generated from the following files: