WSF
WsfStandardApplication Class Reference

#include <WsfStandardApplication.hpp>

Inheritance diagram for WsfStandardApplication:
Collaboration diagram for WsfStandardApplication:

Classes

class  InvalidCommandLineArgument
 An exception that is thrown when a command line argument cannot be parsed. More...
class  InputProcessingFailure
 An exception that is thrown when a command line argument cannot be parsed. More...
struct  SimulationResult
 The result of simulation execution. More...
struct  Options
 Application options; Command line or otherwise. More...

Public Types

enum  SimType { cEVENT_STEPPED , cFRAME_STEPPED , cREAL_TIME }
 The simulation type requested from the command line. More...
enum  RunMode { cRUN_SCENARIO , cLIST_VARIABLES , cSHOW_USAGE , cWRITE_GRAMMAR }
 The type of run from the command line. More...
Public Types inherited from WsfApplication
using PluginPaths = std::list<std::string>

Public Member Functions

 WsfStandardApplication (const std::string &aApplicationName, int argc, char *argv[], const PluginPaths &aPluginPaths=PluginPaths())
 ~WsfStandardApplication () override=default
void ShowUsage ()
 Displays the application command-line usage.
void ProcessCommandLine (Options &aOptions)
void ProcessCommandLine (Options &aOptions, int argc, char *argv[])
void ProcessCommandLineCommands (WsfScenario &aScenario, const Options &aOptions)
void ProcessInputFiles (WsfScenario &aScenario, const std::vector< std::string > &aFileList)
virtual std::unique_ptr< WsfSimulationCreateSimulation (WsfScenario &aScenario, SimType aSimulationType, unsigned int aRunNumber)
virtual std::unique_ptr< WsfSimulationCreateSimulation (WsfScenario &aScenario, const Options &aOptions, unsigned int aRunNumber)
bool InitializeSimulation (WsfSimulation *aSimPtr)
SimulationResult RunEventLoop (WsfSimulation *aSimPtr, Options aOptions)
Public Member Functions inherited from WsfApplication
 WsfApplication (const std::string &aApplicationName, int aArgc, char *aArgv[], const PluginPaths &aPluginPaths=PluginPaths())
virtual ~WsfApplication ()
const std::string & GetApplicationName () const
 Return the name of the application.
bool IsTestingEnabled () const
 Returns 'true' if application is executing under the control of an automated test executive.
void GetCommandLineArguments (int &aArgc, char **&aArgv)
void RemoveCommandLineOptions (int aArgc, int aArgCount)
void RegisterExtension (const std::string &aName, std::unique_ptr< WsfApplicationExtension > aExtensionPtr)
void ExtensionDepends (const std::string &aExtensionName, const std::string &aDependsOnExtensionName, bool aRequired)
bool ExtensionIsRegistered (const std::string &aName) const
WsfApplicationExtensionFindExtension (const std::string &aName) const
WsfApplicationExtensionGetExtension (const std::string &aName) const
const WsfExtensionListGetExtensions () const
 Returns all extension dependencies, added by ExtensionDepends().
void RegisterFeature (const std::string &aFeature, const std::string &aProjectName=std::string())
const std::vector< Feature > & GetRegisteredFeatures ()
 Returns a list of registered features.
UtScriptTypes * GetScriptTypes () const
 Return a pointer to the script types/classes.
WsfSystemLogGetSystemLog ()
 Return a reference to the system log.

Protected Member Functions

virtual std::string GetUsageString () const
void UpdateOptionsP (Options &aOptions, WsfSimulation *aSimPtr)

Protected Attributes

log_server::LogSubscriber mLogServer
 Log Server members.
std::string mLogServerHost = "localhost"
int mLogServerPort = 18888
bool mShouldConnectToLogServer = false

Detailed Description

An implementation of WsfApplication that provides features common to 'standard' application.

Many (but not all) WSF applications perform a fairly common set of operations. This function of this class is to provide those features.

An application that does not wish this standard behavior can simply use WsfApplication.

Member Enumeration Documentation

◆ RunMode

The type of run from the command line.

Enumerator
cRUN_SCENARIO 

Run the scenario (implied if no other command specified).

cLIST_VARIABLES 

List the preprocessor variables.

cSHOW_USAGE 

Show command line options and exit.

cWRITE_GRAMMAR 

Write the grammar file out, used by the IDE.

◆ SimType

The simulation type requested from the command line.

Enumerator
cEVENT_STEPPED 

'-es' was specified

cFRAME_STEPPED 

'-fs' was specified

cREAL_TIME 

'-rt' was specified

Constructor & Destructor Documentation

◆ WsfStandardApplication()

WsfStandardApplication::WsfStandardApplication ( const std::string & aApplicationName,
int aArgc,
char * aArgv[],
const PluginPaths & aPluginPaths = PluginPaths() )

Constructor

Parameters
aApplicationNameThe name of the application.
aArgcThe number of arguments. This is typically the 'argc' argument from 'main()'.
aArgvThe argument list. This is typically the 'argv' argument from 'main()'.
aPluginPathsOptional list of paths (relative to executable) to load plugins from.

References mLogServer, and WsfApplication::WsfApplication().

◆ ~WsfStandardApplication()

Member Function Documentation

◆ CreateSimulation() [1/2]

std::unique_ptr< WsfSimulation > WsfStandardApplication::CreateSimulation ( WsfScenario & aScenario,
const Options & aOptions,
unsigned int aRunNumber )
virtual

Creates a simulation given an Options object.

Parameters
aScenarioThe scenario to be executed.
aOptionsA reference to the Options object.
aRunNumberThe Monte-Carlo iteration number.
Returns
A pointer to the created simulation.

References CreateSimulation(), WsfStandardApplication::Options::mSimType, and WsfApplication::WsfScenario.

◆ CreateSimulation() [2/2]

std::unique_ptr< WsfSimulation > WsfStandardApplication::CreateSimulation ( WsfScenario & aScenario,
SimType aSimulationType,
unsigned int aRunNumber )
virtual

Create the specified simulation type.

Parameters
aScenarioThe scenario to be executed.
aSimulationTypeThe type of simulation object to be created.
aRunNumberThe Monte-Carlo iteration number.
Returns
A pointer to the created simulation.

References cFRAME_STEPPED, cREAL_TIME, and WsfApplication::WsfScenario.

Referenced by CreateSimulation(), main(), and ~WsfStandardApplication().

◆ GetUsageString()

std::string WsfStandardApplication::GetUsageString ( ) const
protectedvirtual

◆ InitializeSimulation()

bool WsfStandardApplication::InitializeSimulation ( WsfSimulation * aSimPtr)

◆ ProcessCommandLine() [1/2]

void WsfStandardApplication::ProcessCommandLine ( Options & aOptions)

Process the command line inputs Returns 'true' if the application should continue

References WsfApplication::GetCommandLineArguments(), and ProcessCommandLine().

Referenced by main(), ProcessCommandLine(), weapon_tools(), and ~WsfStandardApplication().

◆ ProcessCommandLine() [2/2]

◆ ProcessCommandLineCommands()

void WsfStandardApplication::ProcessCommandLineCommands ( WsfScenario & aScenario,
const Options & aOptions )

◆ ProcessInputFiles()

void WsfStandardApplication::ProcessInputFiles ( WsfScenario & aScenario,
const std::vector< std::string > & aFileList )

Load the specified scenario with the input from a list of files.

Parameters
aScenarioThe scenario to be loaded from the supplied list of input files.
aFileListThe list of files to be loaded into the scenario.
Exceptions
exceptionif error is encountered.

References WsfScenario::CompleteLoad(), WsfScenario::HadUnexpectedError(), WsfScenario::LoadFromFile(), and WsfApplication::WsfScenario.

Referenced by main(), weapon_tools(), and ~WsfStandardApplication().

◆ RunEventLoop()

◆ ShowUsage()

◆ UpdateOptionsP()

Member Data Documentation

◆ mLogServer

log_server::LogSubscriber WsfStandardApplication::mLogServer
protected

Log Server members.

Referenced by RunEventLoop(), and WsfStandardApplication().

◆ mLogServerHost

std::string WsfStandardApplication::mLogServerHost = "localhost"
protected

Referenced by ProcessCommandLine().

◆ mLogServerPort

int WsfStandardApplication::mLogServerPort = 18888
protected

Referenced by ProcessCommandLine().

◆ mShouldConnectToLogServer

bool WsfStandardApplication::mShouldConnectToLogServer = false
protected

Referenced by ProcessCommandLine().


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