WSF
WsfOneShotEvent Class Reference

#include <WsfEvent.hpp>

Inheritance diagram for WsfOneShotEvent:
Collaboration diagram for WsfOneShotEvent:

Public Member Functions

 WsfOneShotEvent (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< void >
using ExecuteFn
Protected Member Functions inherited from WsfEventAdapterT< void >
 WsfEventAdapterT (double aSimTime, const ExecuteFn &aExecuteFn)
 ~WsfEventAdapterT () override=default
Protected Attributes inherited from WsfEventAdapterT< void >
ExecuteFn mExecuteFn

Detailed Description

A "one-shot" event that executes once and is deleted. Constructor takes a std::function<void()> that will be called from Execute() when the event is dispatched. Example usage: simulationPtr->AddEvent(new WsfOneShotEvent(simTime, [=]() { ... }));

Constructor & Destructor Documentation

◆ WsfOneShotEvent()

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

Member Function Documentation

◆ Execute()

EventDisposition WsfOneShotEvent::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 WsfEvent::cDELETE, and WsfEventAdapterT< void >::mExecuteFn.


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