|
WSF
|
#include <WsfStandardApplication.hpp>


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< WsfSimulation > | CreateSimulation (WsfScenario &aScenario, SimType aSimulationType, unsigned int aRunNumber) |
| virtual std::unique_ptr< WsfSimulation > | CreateSimulation (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 |
| WsfApplicationExtension * | FindExtension (const std::string &aName) const |
| WsfApplicationExtension & | GetExtension (const std::string &aName) const |
| const WsfExtensionList & | GetExtensions () 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. | |
| WsfSystemLog & | GetSystemLog () |
| 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 |
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.
| WsfStandardApplication::WsfStandardApplication | ( | const std::string & | aApplicationName, |
| int | aArgc, | ||
| char * | aArgv[], | ||
| const PluginPaths & | aPluginPaths = PluginPaths() ) |
Constructor
| aApplicationName | The name of the application. |
| aArgc | The number of arguments. This is typically the 'argc' argument from 'main()'. |
| aArgv | The argument list. This is typically the 'argv' argument from 'main()'. |
| aPluginPaths | Optional list of paths (relative to executable) to load plugins from. |
References mLogServer, and WsfApplication::WsfApplication().
|
overridedefault |
|
virtual |
Creates a simulation given an Options object.
| aScenario | The scenario to be executed. |
| aOptions | A reference to the Options object. |
| aRunNumber | The Monte-Carlo iteration number. |
References CreateSimulation(), WsfStandardApplication::Options::mSimType, and WsfApplication::WsfScenario.
|
virtual |
Create the specified simulation type.
| aScenario | The scenario to be executed. |
| aSimulationType | The type of simulation object to be created. |
| aRunNumber | The Monte-Carlo iteration number. |
References cFRAME_STEPPED, cREAL_TIME, and WsfApplication::WsfScenario.
Referenced by CreateSimulation(), main(), and ~WsfStandardApplication().
|
protectedvirtual |
References WsfApplication::GetApplicationName().
Referenced by ShowUsage().
| bool WsfStandardApplication::InitializeSimulation | ( | WsfSimulation * | aSimPtr | ) |
Initialize a simulation.
| aSimPtr | Pointer to the simulation. |
References WsfSimulation::cPENDING_INITIALIZE, WsfScenario::GetClassificationString(), WsfScenario::GetFinalRunNumber(), WsfSimulation::GetRunNumber(), WsfSimulation::GetScenario(), WsfSimulation::GetState(), WsfSimulation::Initialize(), and profiling::TimedRegion::REGION.
Referenced by main(), and ~WsfStandardApplication().
| 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().
| void WsfStandardApplication::ProcessCommandLine | ( | Options & | aOptions, |
| int | argc, | ||
| char * | argv[] ) |
Process the command line arguments. Returns 'true' if the application should continue
References cEVENT_STEPPED, cFRAME_STEPPED, cLIST_VARIABLES, cREAL_TIME, cSHOW_USAGE, WsfApplication::FindExtension(), WsfExtensionList::GetExtensionOrder(), WsfApplication::GetExtensions(), WsfStandardApplication::Options::mFlushIO, WsfStandardApplication::Options::mInputFiles, mLogServerHost, mLogServerPort, WsfStandardApplication::Options::mMessageInterval, WsfStandardApplication::Options::mRealtimeMessageInterval, WsfStandardApplication::Options::mRunMode, mShouldConnectToLogServer, WsfStandardApplication::Options::mSimType, WsfApplicationExtension::ProcessCommandLine(), and ShowUsage().
| void WsfStandardApplication::ProcessCommandLineCommands | ( | WsfScenario & | aScenario, |
| const Options & | aOptions ) |
Process any commands included in the command line.
| aScenario | The scenario that is being loaded. |
| aOptions | The options from the command line. |
References cLIST_VARIABLES, cRUN_SCENARIO, cSHOW_USAGE, WsfApplication::FindExtension(), WsfExtensionList::GetExtensionOrder(), WsfApplication::GetExtensions(), WsfScenario::GetInput(), WsfStandardApplication::Options::mRunMode, WsfApplicationExtension::ProcessCommandLineCommands(), ShowUsage(), and WsfApplication::WsfScenario.
Referenced by main(), weapon_tools(), and ~WsfStandardApplication().
| void WsfStandardApplication::ProcessInputFiles | ( | WsfScenario & | aScenario, |
| const std::vector< std::string > & | aFileList ) |
Load the specified scenario with the input from a list of files.
| aScenario | The scenario to be loaded from the supplied list of input files. |
| aFileList | The list of files to be loaded into the scenario. |
| exception | if error is encountered. |
References WsfScenario::CompleteLoad(), WsfScenario::HadUnexpectedError(), WsfScenario::LoadFromFile(), and WsfApplication::WsfScenario.
Referenced by main(), weapon_tools(), and ~WsfStandardApplication().
| WsfStandardApplication::SimulationResult WsfStandardApplication::RunEventLoop | ( | WsfSimulation * | aSimPtr, |
| Options | aOptions ) |
Execute the simulation event loop until it is complete or is reset.
| aSimPtr | The pointer to the simulation to execute. |
| aOptions | The options derived from the command line (or explicitly by code). |
References WsfSimulation::AdvanceTime(), WsfSimulation::cEND_TIME_REACHED, WsfSimulation::Complete(), WsfSimulation::cPENDING_START, WsfSimulation::cRESET, WsfSimulation::GetCompletionReason(), WsfSimulation::GetCompletionReasonString(), profiling::TimedRegion::GetCpuTime(), WsfSimulation::GetRealTime(), WsfSimulation::GetRunNumber(), WsfSimulation::GetState(), WsfApplication::GetSystemLog(), profiling::TimedRegion::GetWallTime(), WsfSimulation::IsActive(), WsfSimulation::IsRealTime(), WsfStandardApplication::Options::mDeferredConnectionTime, mLogServer, WsfStandardApplication::Options::mMessageInterval, WsfStandardApplication::Options::mRealtimeMessageInterval, WsfStandardApplication::SimulationResult::mResetRequested, simTime, WsfSimulation::Start(), profiling::TimedRegion::StartSubregion(), profiling::TimedRegion::StopSubregion(), profiling::TimedRegion::SUBREGION, UpdateOptionsP(), WsfSimulation::WaitForAdvanceTime(), and WsfSystemLog::WriteLogEntry().
Referenced by main(), and ~WsfStandardApplication().
| void WsfStandardApplication::ShowUsage | ( | ) |
Displays the application command-line usage.
References WsfApplication::FindExtension(), WsfExtensionList::GetExtensionOrder(), WsfApplication::GetExtensions(), GetUsageString(), and WsfApplicationExtension::PrintCommandLineArguments().
Referenced by ProcessCommandLine(), ProcessCommandLineCommands(), and ~WsfStandardApplication().
|
protected |
References WsfSimulation::FindExtension(), WsfExtInterface::GetDeferredConnectionTime(), WsfSimulation::GetSimTime(), WsfSimulation::IsRealTime(), WsfStandardApplication::Options::mDeferredConnectionTime, WsfStandardApplication::Options::mMessageInterval, and WsfSimulation::SetRealtime().
Referenced by RunEventLoop().
|
protected |
Log Server members.
Referenced by RunEventLoop(), and WsfStandardApplication().
|
protected |
Referenced by ProcessCommandLine().
|
protected |
Referenced by ProcessCommandLine().
|
protected |
Referenced by ProcessCommandLine().