|
WSF
|
A simulation extension that serves as an abstract base class for observers which write an event output file. More...
#include <WsfEventOutputBase.hpp>


Classes | |
| class | EventGuard |
Public Member Functions | |
| SimulationExtension (Data &aData) | |
| bool | PrepareExtension () override |
| virtual void | OnSimulationComplete (double aSimTime) |
| bool | OpenFile (const std::string &aFileName) |
| const std::string & | GetFileName () const |
| Returns the name of the file in which the events are output. | |
| std::ostream & | StreamRef () const |
| bool | IsEnabled (const std::string &aEventName) const |
| void | AddEvent (const std::string &aEventName, std::unique_ptr< UtCallback > aCallbackPtr) |
| template<typename RESULT, typename... Args> | |
| void | AddEvent (const std::string &aEventName, UtCallbackListN< void(Args...)> &aObserver) |
| void | AddEventAlias (const std::string &aAliasEventName, const std::string &aCurrentEventName) |
| bool | EnableOrDisableEvent (const std::string &aEventName, bool aEnable) |
| void | RegisterMessagePrinter (WsfStringId aMessageType, const Settings::MessagePrintFunction &aFunction) |
| Settings & | GetSettings () |
| virtual void | PrintEvent (const Result &aResult) const =0 |
| Print an event result in the desired format. Must be implemented by derived classes. | |
| Public Member Functions inherited from WsfSimulationExtension | |
| WsfSimulationExtension () | |
| ~WsfSimulationExtension () override=default | |
| WsfSimulation & | GetSimulation () const |
| const WsfScenario & | GetScenario () const |
| virtual bool | Initialize () |
| virtual bool | PlatformsInitialized () |
| virtual void | PendingStart () |
| virtual void | Start () |
| virtual void | Complete (double aSimTime) |
| Public Member Functions inherited from WsfExtension | |
| virtual | ~WsfExtension ()=default |
| const std::string & | GetExtensionName () const |
Additional Inherited Members | |
| static void | __private_SetSim (WsfSimulationExtension &aExtension, WsfSimulation *aSimPtr) |
| Protected Member Functions inherited from WsfExtension | |
| void | InitializeExtensionName (const std::string &aName) |
A simulation extension that serves as an abstract base class for observers which write an event output file.
|
inline |
| void wsf::event::output::SimulationExtension::AddEvent | ( | const std::string & | aEventName, |
| std::unique_ptr< UtCallback > | aCallbackPtr ) |
Adds a new output event.
| aEventName | The name of the event. This name is used to reference the event in the input file. |
| aCallbackPtr | A callback that is already connected to the event source. UtCallback::Block() will be called if the event is disabled. |
Referenced by wsf::altloc::SimulationExtension::AddedToSimulation(), and AddEvent().
|
inline |
Register an event that will be produced upon invocation of the specified Observer
| RESULT | is the subclass of wsf::event::Result which will be printed |
| Args | are types passed by the Observer, which should be deduced from the aObserver argument |
| aEventName | is the name of the event as it will appear in the output |
| aObserver | is the Observer whose invocation will trigger this event |
References AddEvent().
| void wsf::event::output::SimulationExtension::AddEventAlias | ( | const std::string & | aAliasEventName, |
| const std::string & | aCurrentEventName ) |
Adds an alternative name for an event. The new name is usable from the input file.
| aAliasEventName | The new event alias name. |
| aCurrentEventName | The name of the existing event to be aliased. |
| bool wsf::event::output::SimulationExtension::EnableOrDisableEvent | ( | const std::string & | aEventName, |
| bool | aEnable ) |
References ok.
Referenced by PrepareExtension().
|
inline |
Returns the name of the file in which the events are output.
Referenced by engage::SimulationExtension::Initialize().
|
inline |
Referenced by WsfMilInterface::AddedToSimulation().
| bool wsf::event::output::SimulationExtension::IsEnabled | ( | const std::string & | aEventName | ) | const |
|
inlinevirtual |
Derived classes can override this method to be notified when the 'SimulationComplete' event is fired, but before EventOutput shuts down (i.e. closes its output stream).
| bool wsf::event::output::SimulationExtension::OpenFile | ( | const std::string & | aFileName | ) |
Opens a file for outputting events. If a file is already open, it will be closed first before opening a new file.
References WsfScenario::GetClassificationString(), WsfExtension::GetExtensionName(), WsfSimulationExtension::GetScenario(), WsfSimulationExtension::GetSimulation(), WsfScenario::GetSystemLog(), ok, WsfSimulation::SubstituteOutputFileVariables(), and WsfSystemLog::WriteOutputLogEntry().
Referenced by engage::SimulationExtension::Initialize(), and PrepareExtension().
|
overridevirtual |
Called in response to a call to WsfSimulation::Initialize and WsfSimulation::PrepareSimulation.
A simulation extension will typically implement either WsfSimulationExtension::Initialize or WsfSimulationExtension::PrepareExtension, or a combination of both. The main difference is that:
The primary criteria for deciding which method to use is to look at the extension and see if it uses any external resources such as files or sockets. If the extension uses external resources and wants to support snapshotting then it MUST use this this method so it can (re)establish connections to external resources (A snapshot cannot save the state of an open file or socket and so it must be reopened.)
Reimplemented from WsfSimulationExtension.
References EnableOrDisableEvent(), WsfExtension::GetExtensionName(), ok, and OpenFile().
|
pure virtual |
Print an event result in the desired format. Must be implemented by derived classes.
| void wsf::event::output::SimulationExtension::RegisterMessagePrinter | ( | WsfStringId | aMessageType, |
| const Settings::MessagePrintFunction & | aFunction ) |
Referenced by WsfMilInterface::AddedToSimulation().
|
inline |