WSF
WsfScenarioExtension Class Reference

#include <WsfScenarioExtension.hpp>

Inheritance diagram for WsfScenarioExtension:
Collaboration diagram for WsfScenarioExtension:

Public Member Functions

 WsfScenarioExtension ()
 ~WsfScenarioExtension () override
WsfScenarioGetScenario () const
WsfApplicationGetApplication () const
Public Member Functions inherited from WsfExtension
virtual ~WsfExtension ()=default
const std::string & GetExtensionName () const

Friends

class WsfScenario

Notifications from the scenario.

These are called in the order they are listed.

virtual void AddedToScenario ()
virtual bool ProcessInput (UtInput &aInput)
virtual void FileLoaded (const std::string &aFileName)
virtual bool Complete ()
virtual bool Complete2 ()
virtual void SimulationCreated (WsfSimulation &aSimulation)
virtual bool AlwaysCreate ()

Additional Inherited Members

Protected Member Functions inherited from WsfExtension
void InitializeExtensionName (const std::string &aName)

Detailed Description

A base class for 'scenario extensions'.

A scenario extension is a object created and registered with an scenario object. A scenario object will allow scenario extensions to examine the input stream and process commands as necessary.

An application extension may instantiate and register a derived version of this class, typically from within the derived class method WsfApplicationExtension::ScenarioCreated.

Note
The instance is owned by the scenario object once it is registered.

Constructor & Destructor Documentation

◆ WsfScenarioExtension()

◆ ~WsfScenarioExtension()

WsfScenarioExtension::~WsfScenarioExtension ( )
override

Member Function Documentation

◆ AddedToScenario()

void WsfScenarioExtension::AddedToScenario ( )
virtual

Called when the extension has been added to the scenario. This is typically used to register new component type objects and object factories, e.g.:

WsfScenario& scenario(GetScenario());
WsfMoverTypes::Get(scenario).AddCoreType("MY_MOVER", new MyMover(scenario));
WsfAntennaPatterTypes::Get(scenario).AddObjectFactor(MyAntennaPattern::ObjectFactory);
static WSF_EXPORT WsfMoverTypes & Get(WsfScenario &aScenario)
Return a modifiable reference to the type list associated with the specified scenario.
Definition WsfMoverTypes.cpp:53
bool AddCoreType(WsfStringId aId, std::unique_ptr< T > aDefinitionPtr)
Definition WsfObjectTypeList.hpp:102
WsfScenario & GetScenario() const
Definition WsfScenarioExtension.hpp:46
friend class WsfScenario
Definition WsfScenarioExtension.hpp:39

Script classes must NOT be registered here because they are global to the entire application. They should be registered in WsfApplication::AddedToApplication.

Note
GetScenario() and GetApplication() are now valid.

Reimplemented in Fires::FiresTables, IADSC2ScenarioExtension, ToolManager, wsf::coverage::ScenarioExtension, wsf::cyber::ScenarioExtension, wsf::OMS_UCI_Extension, wsf::six_dof::Environment, wsf::six_dof::TypeManager, wsf::space::AtmosphereScenarioExtension, WsfAirCombatTypeManager, WsfAnnotationExtension, WsfBrawler, WsfExtInput, WsfMilExtension, WsfMultiresolutionTypesRegistration, WsfP6DOF_TypeManager, WsfSensorPlotExtension, WsfSOSM_Interface, and WsfSpaceExtension.

◆ AlwaysCreate()

bool WsfScenarioExtension::AlwaysCreate ( )
virtual

Declare if the extension is required or optional. An extension may be declared optional if this method returns 'false'. An optional extension is one that is not loaded unless required by some other extension.

Returns
'true' if required or 'false' if optional.

◆ Complete()

bool WsfScenarioExtension::Complete ( )
virtual

Called when all inputs are processed. This is called when the application calls WsfScenario::LoadComplete to signify that all input data has been loaded into the scenario. The extension should perform any additional validity checking or other processing on its input data. Constant data may be created and stored here. Unless Complete2() is also implement, the contents of this class should not be changed after this call.

The extension should not assume anything about the state of another extension unless this a dependency has been registered to ensure the other extension has been called prior to this, e.g.:

app.ExtensionDepends("my_ext", "other_ext");
Returns
'true' if no problems or 'false' if an error occurred that would prevent execution.

Reimplemented in engage::InputConfig, wsf::console::ScenarioExtension, wsf::EarthGravityModelExtension, WsfConfigureAccessReport, WsfExtInput, and WsfSOSM_Interface.

Referenced by WsfScenario::CompleteLoad().

◆ Complete2()

bool WsfScenarioExtension::Complete2 ( )
virtual

Phase 2 Complete. This is called after all extensions have their Complete() methods called. The contents of this class should remain constant after this call.

Reimplemented in WsfSensorPlotExtension.

Referenced by WsfScenario::CompleteLoad().

◆ FileLoaded()

void WsfScenarioExtension::FileLoaded ( const std::string & aFileName)
virtual

Called after a file has been loaded into the scenario.

Parameters
aFileNameThe name of the file thast has been loaded into the scenario.

Reimplemented in WsfGrammarCheckExtension.

Referenced by WsfScenario::LoadFromFile().

◆ GetApplication()

WsfApplication & WsfScenarioExtension::GetApplication ( ) const

Returns the application which owns the scenario

Note
This is not valid until AddedToScenario() has been called.

Referenced by WsfGrammarCheckExtension::FileLoaded().

◆ GetScenario()

◆ ProcessInput()

bool WsfScenarioExtension::ProcessInput ( UtInput & aInput)
virtual

Process potential input for the extension. This method examines the current input command to determine if it is one that is recognized by the extension. If it is one recognized by the extension then it processes the command and returns 'true', otherwise it returns 'false'.

Parameters
aInputa reference to a UtInput object.
Returns
'true' if the command was one recognized by the extension or 'false' if not.
Exceptions
UtInput::ExceptionBase(or an object derived from it) if the command was recognized but contains some sort of error.

Reimplemented in engage::InputConfig, Fires::FiresTables, StubInterface, ToolManager, wsf::console::ScenarioExtension, wsf::cyber::ScenarioExtension, wsf::dis::ScenarioExtension, wsf::EarthGravityModelExtension, wsf::event::output::ScenarioExtension< DATA, SIM_EXTENSION >, wsf::OMS_UCI_Extension, wsf::simdis::ScenarioExtension, wsf::six_dof::Environment, wsf::six_dof::TypeManager, WsfAnnotationExtension, WsfCloneableScenarioExtension, WsfConfigureAccessReport, WsfConfigureEclipseReport, WsfEventPipeExtension, WsfL16_Extension, WsfLegacyScenarioExtension< CLASS >, WsfLOS_ManagerExtension, WsfMilExtension, WsfMultiresolutionMultirunTable, WsfP6DOF_TypeManager, WsfRIPR_ModuleSetup, WsfScriptObserverExtension, WsfSensorPlotExtension, WsfSOSM_Interface, and WsfWeaponServerExtension.

Referenced by WsfScenario::ProcessExtensionInput(), and wsf::OMS_UCI_Extension::ProcessInput().

◆ SimulationCreated()

void WsfScenarioExtension::SimulationCreated ( WsfSimulation & aSimulation)
virtual

Called when a simulation has been created. (Technically this is called upon entry to WsfSimulation::Initialize()). This is typically used when a scenario extension also requires a simulation extension. The method would typically register the simulation extension as follows:

aSimulation.RegisterExtension("my_ext", new MySimulationExtension());
Parameters
aSimulationThe simulation that is being created. See note below!
Note
This is called upon entry to WsfSimulation::Initialize() and nothing can be assumed about the state of the simulation.
See also
WsfSimulationExtension, WsfApplicationExtension::SimulationCreated

Reimplemented in engage::InputConfig, IADSC2ScenarioExtension, wsf::comm::NetworkManagerExtension, wsf::console::ScenarioExtension, wsf::cyber::ScenarioExtension, wsf::dis::ScenarioExtension, wsf::EarthGravityModelExtension, wsf::event::output::ScenarioExtension< DATA, SIM_EXTENSION >, wsf::OMS_UCI_Extension, wsf::simdis::ScenarioExtension, wsf::six_dof::TypeManager, WsfAirCombatTypeManager, WsfAnnotationExtension, WsfCloneableScenarioExtension, WsfConfigureAccessReport, WsfConfigureEclipseEventManger, WsfConfigureEclipseReport, WsfDefaultScenarioExtension< SIMULATION_EXTENSION >, WsfEventPipeExtension, WsfExtInput, WsfL16_Extension, WsfLegacyScenarioExtension< CLASS >, WsfLOS_ManagerExtension, WsfMultiresolutionMultirunTable, WsfP6DOF_TypeManager, WsfRIPR_ModuleSetup, WsfScriptObserverExtension, WsfSpaceExtension, and WsfWeaponServerExtension.

Referenced by WsfScenario::SimulationCreated().

◆ WsfScenario


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