WSF
WsfRecurringEvent Class Reference

#include <WsfEvent.hpp>

Inheritance diagram for WsfRecurringEvent:
Collaboration diagram for WsfRecurringEvent:

Public Member Functions

 WsfRecurringEvent (double aSimTime, const ExecuteFn &aExecuteFn)
EventDisposition Execute () override
Public Member Functions inherited from WsfEvent
 WsfEvent ()=default
 WsfEvent (double aSimTime, int aPriority=0)
 WsfEvent (const WsfEvent &aSrc)=delete
 Copy constructor and copy assignment deleted to prevent copying.
WsfEventoperator= (const WsfEvent &aRhs)=delete
virtual ~WsfEvent ()=default
double GetTime () const
int GetPriority () const
bool ShouldExecute () const
void SetTime (double aSimTime)
void SetPriority (int aPriority)
void SetShouldExecute (bool aExecute)
WsfSimulationGetSimulation () const
void AddedToEventQueue (WsfSimulation &aSimulation)
 Called when the event is added to the event queue of the specified simulation.

Additional Inherited Members

Public Types inherited from WsfEvent
enum  EventDisposition { cDELETE , cRESCHEDULE }
Protected Types inherited from WsfEventAdapterT< WsfEvent::EventDisposition, WsfEvent & >
using ExecuteFn
Protected Member Functions inherited from WsfEventAdapterT< WsfEvent::EventDisposition, WsfEvent & >
 WsfEventAdapterT (double aSimTime, const ExecuteFn &aExecuteFn)
 ~WsfEventAdapterT () override=default
Protected Attributes inherited from WsfEventAdapterT< WsfEvent::EventDisposition, WsfEvent & >
ExecuteFn mExecuteFn

Detailed Description

An event that can be rescheduled. Constructor takes a std::function<EventDisposition(WsfEvent&)>. A reference to "this" is passed to the std::function when called from Execute() to give it access to the event. The std::function could then e.g. call SetTime to reschedule the event. Example usage: simulationPtr->AddEvent(new WsfRecurringEvent(simTime, [=](WsfEvent& e) { ... e.SetTime(e.GetTime() + interval); return WsfEvent::cRESCHEDULE; }));

Constructor & Destructor Documentation

◆ WsfRecurringEvent()

WsfRecurringEvent::WsfRecurringEvent ( double aSimTime,
const ExecuteFn & aExecuteFn )
inline

Member Function Documentation

◆ Execute()

EventDisposition WsfRecurringEvent::Execute ( )
inlineoverridevirtual

Execute the specified event.

Returns
The disposition of the event. This indicates to the event manager what should be done with the event. If cRESCHEDULE then Execute should have called SetTime to set the time for which the event manager should reschedule the event.

Implements WsfEvent.

References WsfEventAdapterT< WsfEvent::EventDisposition, WsfEvent & >::mExecuteFn.


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