|
WSF
|
#include <WsfEvent.hpp>


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. | |
| WsfEvent & | operator= (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) |
| WsfSimulation * | GetSimulation () 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 |
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; }));
|
inline |
|
inlineoverridevirtual |
Execute the specified event.
Implements WsfEvent.
References WsfEventAdapterT< WsfEvent::EventDisposition, WsfEvent & >::mExecuteFn.