WSF
WsfStableOrderEventManager Class Reference

#include <WsfStableOrderEventManager.hpp>

Inheritance diagram for WsfStableOrderEventManager:
Collaboration diagram for WsfStableOrderEventManager:

Public Types

typedef std::pair< WsfEvent *, unsigned int > StableEvent

Public Member Functions

 WsfStableOrderEventManager ()
virtual ~WsfStableOrderEventManager ()
virtual void AddEvent (WsfEvent *aEventPtr)
virtual WsfEventPeekEvent ()
virtual WsfEventPopEvent ()
virtual void Reset ()
 Reset the event queue back to an empty state.
Public Member Functions inherited from WsfEventManager
 WsfEventManager (WsfSimulation &aSimulation)
 WsfEventManager (const WsfEventManager &aSrc)=delete
WsfEventManageroperator= (const WsfEventManager &aRhs)=delete
 WsfEventManager (WsfEventManager &&)=default
WsfEventManageroperator= (WsfEventManager &&)=default
virtual ~WsfEventManager ()=default
virtual void AddEvent (std::unique_ptr< WsfEvent > aEventPtr)
 Add an event to the event queue.
virtual WsfEventPeekEvent () const
 Get, but do not remove, the next event that should be dispatched.

Additional Inherited Members

Protected Attributes inherited from WsfEventManager
std::recursive_mutex mMutex {}

Detailed Description

A manager for a stable time-ordered queue of WsfEvent objects

This class is used by WsfSimulation to implement an event queue. It could also be used by other classes that want to retain their own time-ordered event queues.

Member Typedef Documentation

◆ StableEvent

typedef std::pair<WsfEvent*, unsigned int> WsfStableOrderEventManager::StableEvent

Constructor & Destructor Documentation

◆ WsfStableOrderEventManager()

WsfStableOrderEventManager::WsfStableOrderEventManager ( )
inline

◆ ~WsfStableOrderEventManager()

virtual WsfStableOrderEventManager::~WsfStableOrderEventManager ( )
inlinevirtual

Member Function Documentation

◆ AddEvent()

virtual void WsfStableOrderEventManager::AddEvent ( WsfEvent * aEventPtr)
inlinevirtual

Add an event to the event queue.

Parameters
aEventPtrPointer to the event to be added to the queue. The WsfEvent::GetTime method will be used to determine when the event should be dispatched. The event manager becomes the owner of the event.

If multiple events are queued with the same time, the order in which those events are dispatched is not guaranteed to be the same as the order of insertion. The only guarantee is that events with a smaller time will be dispatched before those with a greater time.

References WsfEventManager::mMutex.

◆ PeekEvent()

virtual WsfEvent * WsfStableOrderEventManager::PeekEvent ( )
inlinevirtual

Get, but do not remove, the next event that should be dispatched

The next event is the one with the lowest time value.

Returns
The pointer to the next event or 0 if there is no next event.

References WsfEventManager::mMutex.

◆ PopEvent()

virtual WsfEvent * WsfStableOrderEventManager::PopEvent ( )
inlinevirtual

Get and remove the next event that should be dispatched

The next event is the one with the lowest time value.

Returns
The pointer to the next event or 0 if there is no next event.

Reimplemented from WsfEventManager.

References WsfEventManager::mMutex.

◆ Reset()

virtual void WsfStableOrderEventManager::Reset ( )
inlinevirtual

Reset the event queue back to an empty state.

Reimplemented from WsfEventManager.

References WsfEventManager::mMutex.


The documentation for this class was generated from the following file:
Copyrights Multiple, All Rights Reserved