|
WSF
|
#include <WsfApplication.hpp>

Classes | |
| class | Exception |
| An application exception. More... | |
| class | FeatureNotPresent |
| struct | Feature |
| An application feature, used for test if features exist. More... | |
Public Types | |
| using | PluginPaths = std::list<std::string> |
Public Member Functions | |
| 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. | |
Friends | |
| class | WsfScenario |
Automated testing methods. | |
| bool | IsTestingEnabled () const |
| Returns 'true' if application is executing under the control of an automated test executive. | |
Command line arguments methods. | |
| void | GetCommandLineArguments (int &aArgc, char **&aArgv) |
| void | RemoveCommandLineOptions (int aArgc, int aArgCount) |
Application extension methods. | |
Methods to add and find extensions. | |
| 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(). | |
Feature Management. | |
'Features' are simply strings that have been registered to indicate that certain features are present. Input files may test for the presence of features with the 'conditionals' block or the 'test_feature' command. This class registers certain standard features that define the execution environment:
In addition, extensions may register additional features. | |
| void | RegisterFeature (const std::string &aFeature, const std::string &aProjectName=std::string()) |
| const std::vector< Feature > & | GetRegisteredFeatures () |
| Returns a list of registered features. | |
Access to system-wide objects maintained by this class. | |
| UtScriptTypes * | GetScriptTypes () const |
| Return a pointer to the script types/classes. | |
| WsfSystemLog & | GetSystemLog () |
| Return a reference to the system log. | |
Define a WSF application.
An instance of WsfApplication (or a derived class thereof) should be created for any WSF application and is required to construct a WsfScenario. Only one instance of this object may exist at any given time.
The primary function of this object is to provide for the maintenance of application extensions, plugins and application-wide objects and to support the orderly creation of scenario and simulation objects.
This class provides only the minimum functions. A user will typically use WsfStandardApplication, which provides additional features that make it simpler to create WSF applications.
| using WsfApplication::PluginPaths = std::list<std::string> |
| WsfApplication::WsfApplication | ( | 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 GetApplicationName(), wsf::version::GetReleaseString(), pp, and WsfScriptManager::RegisterTypes().
Referenced by WsfStandardApplication::WsfStandardApplication().
|
virtual |
References WsfAttributeContainer::ClearTypes().
| void WsfApplication::ExtensionDepends | ( | const std::string & | aExtensionName, |
| const std::string & | aDependsOnExtensionName, | ||
| bool | aRequired ) |
Add an extension dependency. This guarantees that one extension is initialized before another. Because the initialization order is inherited by the scenario and simulation extensions, the dependency only needs declared here.
| aExtensionName | The name of the dependent extension |
| aDependsOnExtensionName | The name of the extension to be initialized first |
| aRequired | 'true' if the dependent extension cannot be used without the other 'false' if the dependent extension can still be used without the other |
Referenced by WsfSpaceExtension::AddedToScenario(), main(), Register_dis_interface(), Register_event_pipe(), Register_grammar_interface(), Register_wsf_air_combat(), Register_wsf_alternate_locations(), Register_wsf_annotation(), Register_wsf_brawler(), Register_wsf_cyber(), Register_wsf_fires(), Register_wsf_iads_c2(), Register_wsf_l16(), Register_wsf_mil(), Register_wsf_nx(), Register_wsf_p6dof(), Register_wsf_scenario_analyzer_iads_c2(), Register_wsf_six_dof(), Register_wsf_space(), wsf::Register_wsf_uci(), Register_wsf_weapon_server(), Register_xio_interface(), Register_xio_weapon_interface(), and weapon_tools().
| bool WsfApplication::ExtensionIsRegistered | ( | const std::string & | aName | ) | const |
Determines if the extension with the given name is registered.
| aName | The name of the extension. |
Referenced by Register_air_traffic(), Register_console_output(), Register_csv_event_output(), Register_dis_interface(), Register_event_output(), Register_event_pipe(), Register_ext_interface(), Register_grammar_interface(), Register_osm_traffic(), Register_profiling(), Register_road_traffic(), Register_sea_traffic(), Register_wsf_air_combat(), Register_wsf_alternate_locations(), Register_wsf_annotation(), Register_wsf_argo8(), Register_wsf_brawler(), Register_wsf_coverage(), Register_wsf_cyber(), Register_wsf_draw(), Register_wsf_fires(), Register_wsf_iads_c2(), Register_wsf_l16(), Register_wsf_mil(), Register_wsf_mtt(), Register_wsf_nx(), Register_wsf_p6dof(), Register_wsf_prompt(), Register_wsf_ripr(), Register_wsf_scenario_analyzer(), Register_wsf_scenario_analyzer_iads_c2(), Register_wsf_six_dof(), Register_wsf_sosm(), Register_wsf_space(), wsf::Register_wsf_uci(), Register_wsf_weapon_server(), Register_xio_interface(), and Register_xio_weapon_interface().
| WsfApplicationExtension * WsfApplication::FindExtension | ( | const std::string & | aName | ) | const |
Returns a pointer to the extension with the given name.
Referenced by WsfGrammarExtension::Find(), IsApplicationExtensionRegistered(), WsfStandardApplication::ProcessCommandLine(), WsfStandardApplication::ProcessCommandLineCommands(), and WsfStandardApplication::ShowUsage().
|
inline |
Return the name of the application.
Referenced by WsfStandardApplication::GetUsageString(), and WsfApplication().
| void WsfApplication::GetCommandLineArguments | ( | int & | aArgc, |
| char **& | aArgv ) |
Retrieves the command line argument list.
| aArgc | The number of command line arguments. |
| aArgv | The command line arguments. |
Referenced by WsfStandardApplication::ProcessCommandLine().
| WsfApplicationExtension & WsfApplication::GetExtension | ( | const std::string & | aName | ) | const |
Returns a reference to the extension with the given name.
| WsfUnknownExtension | if the extension is not registered. |
|
inline |
Returns all extension dependencies, added by ExtensionDepends().
Referenced by WsfStandardApplication::ProcessCommandLine(), WsfStandardApplication::ProcessCommandLineCommands(), and WsfStandardApplication::ShowUsage().
|
inline |
Returns a list of registered features.
Referenced by WsfScenario::ProcessInputP().
|
inline |
Return a pointer to the script types/classes.
Referenced by engage::ApplicationExtension::AddedToApplication(), wsf::cyber::ApplicationExtension::AddedToApplication(), wsf::dis::ApplicationExtension::AddedToApplication(), WsfScriptObserver::AddEvent(), IsClassTypeRegistered(), Register_wsf_fires(), Register_wsf_ripr(), RegisterBaseTypes(), WsfAssetManager::RegisterScriptTypes(), WsfBattleManager::RegisterScriptTypes(), WsfBMDisseminateC2::RegisterScriptTypes(), WsfBMSensorsManager::RegisterScriptTypes(), WsfBMWeaponsManager::RegisterScriptTypes(), WsfSensorsManagerFov::RegisterScriptTypes(), WsfSimpleSensorsManager::RegisterScriptTypes(), WsfUnclassifiedAssetManager::RegisterScriptTypes(), WsfUnclassifiedBattleManager::RegisterScriptTypes(), WsfUnclassifiedDisseminateC2::RegisterScriptTypes(), WsfWeaponsManagerAI::RegisterScriptTypes(), WsfWeaponsManagerSAM::RegisterScriptTypes(), RegisterUtilsScriptTypes(), and ScenarioAnalyzerRegisterScriptTypes().
|
inline |
Return a reference to the system log.
Referenced by WsfStandardApplication::RunEventLoop().
|
inline |
Returns 'true' if application is executing under the control of an automated test executive.
| void WsfApplication::RegisterExtension | ( | const std::string & | aName, |
| std::unique_ptr< WsfApplicationExtension > | aExtensionPtr ) |
Register an extension.
| aName | The name of the extension to be registered |
| aExtensionPtr | [input] A pointer to the extension instance to be registered. Upon successful registration this class assumes ownership of the registered object and will be responsible for its deletion. |
| DuplicateExtension | if an extension of the same name already exists. |
Referenced by main(), Register_air_traffic(), Register_console_output(), Register_csv_event_output(), Register_dis_interface(), Register_event_output(), Register_event_pipe(), Register_ext_interface(), Register_grammar_interface(), Register_laser_designations(), Register_osm_traffic(), Register_profiling(), Register_road_traffic(), Register_sea_traffic(), Register_sensor_plot_lib(), Register_wsf_air_combat(), Register_wsf_alternate_locations(), Register_wsf_annotation(), Register_wsf_argo8(), Register_wsf_brawler(), Register_wsf_coverage(), Register_wsf_cyber(), Register_wsf_draw(), Register_wsf_fires(), Register_wsf_grammar_check(), Register_wsf_iads_c2(), Register_wsf_l16(), Register_wsf_mil(), Register_wsf_mtt(), Register_wsf_nx(), Register_wsf_p6dof(), Register_wsf_prompt(), Register_wsf_ripr(), Register_wsf_scenario_analyzer(), Register_wsf_scenario_analyzer_iads_c2(), Register_wsf_simdis(), Register_wsf_six_dof(), Register_wsf_sosm(), Register_wsf_space(), wsf::Register_wsf_uci(), Register_wsf_weapon_server(), Register_xio_interface(), Register_xio_weapon_interface(), weapon_tools(), and WsfPluginSetup().
| void WsfApplication::RegisterFeature | ( | const std::string & | aFeature, |
| const std::string & | aProjectName = std::string() ) |
Register the presence of a feature.
| aFeature | The name of the feature whose presence is to be registered. |
| aProjectName | The name of the project/extension with which the feature is associated. |
References WsfApplication::Feature::mName, and WsfApplication::Feature::mProject.
Referenced by Register_profiling(), Register_sensor_plot_lib(), Register_wsf_air_combat(), Register_wsf_alternate_locations(), Register_wsf_annotation(), Register_wsf_argo8(), Register_wsf_brawler(), Register_wsf_coverage(), Register_wsf_cyber(), Register_wsf_fires(), Register_wsf_iads_c2(), Register_wsf_l16(), Register_wsf_mil(), Register_wsf_mtt(), Register_wsf_nx(), Register_wsf_p6dof(), Register_wsf_prompt(), Register_wsf_ripr(), Register_wsf_scenario_analyzer(), Register_wsf_scenario_analyzer_iads_c2(), Register_wsf_simdis(), Register_wsf_sosm(), Register_wsf_space(), wsf::Register_wsf_uci(), Register_wsf_weapon_server(), and WsfPluginSetup().
| void WsfApplication::RemoveCommandLineOptions | ( | int | aArgc, |
| int | aArgCount ) |
Removes command line options that have been processed. This should be called to remove any arguments that have been processed by WSF libraries to prevent the application from reading an option.
| aArgc | The index of the first argument to be removed. |
| aArgCount | The number of arguments to be removed. |
|
friend |