WSF
WsfApplication Class Reference

#include <WsfApplication.hpp>

Inheritance diagram for WsfApplication:

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
WsfApplicationExtensionFindExtension (const std::string &aName) const
WsfApplicationExtensionGetExtension (const std::string &aName) const
const WsfExtensionListGetExtensions () 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:

  • Operating system: "os:linux", "os:windows", "os:apple"
  • Processor: "cpu:intel"
  • Addressing mode: "addr:32-bit", "addr:64-bit"
  • Build type: "build:debug", "build:release"

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.
WsfSystemLogGetSystemLog ()
 Return a reference to the system log.

Detailed Description

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.

Member Typedef Documentation

◆ PluginPaths

using WsfApplication::PluginPaths = std::list<std::string>

Constructor & Destructor Documentation

◆ WsfApplication()

WsfApplication::WsfApplication ( 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 GetApplicationName(), wsf::version::GetReleaseString(), pp, and WsfScriptManager::RegisterTypes().

Referenced by WsfStandardApplication::WsfStandardApplication().

◆ ~WsfApplication()

WsfApplication::~WsfApplication ( )
virtual

Member Function Documentation

◆ ExtensionDepends()

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.

Parameters
aExtensionNameThe name of the dependent extension
aDependsOnExtensionNameThe 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().

◆ ExtensionIsRegistered()

◆ FindExtension()

WsfApplicationExtension * WsfApplication::FindExtension ( const std::string & aName) const

Returns a pointer to the extension with the given name.

Returns
Pointer to the extension or nullptr if the extension is not registered.

Referenced by WsfGrammarExtension::Find(), IsApplicationExtensionRegistered(), WsfStandardApplication::ProcessCommandLine(), WsfStandardApplication::ProcessCommandLineCommands(), and WsfStandardApplication::ShowUsage().

◆ GetApplicationName()

const std::string & WsfApplication::GetApplicationName ( ) const
inline

Return the name of the application.

Referenced by WsfStandardApplication::GetUsageString(), and WsfApplication().

◆ GetCommandLineArguments()

void WsfApplication::GetCommandLineArguments ( int & aArgc,
char **& aArgv )

Retrieves the command line argument list.

Parameters
aArgcThe number of command line arguments.
aArgvThe command line arguments.

Referenced by WsfStandardApplication::ProcessCommandLine().

◆ GetExtension()

WsfApplicationExtension & WsfApplication::GetExtension ( const std::string & aName) const

Returns a reference to the extension with the given name.

Exceptions
WsfUnknownExtensionif the extension is not registered.

◆ GetExtensions()

const WsfExtensionList & WsfApplication::GetExtensions ( ) const
inline

◆ GetRegisteredFeatures()

const std::vector< Feature > & WsfApplication::GetRegisteredFeatures ( )
inline

Returns a list of registered features.

Referenced by WsfScenario::ProcessInputP().

◆ GetScriptTypes()

◆ GetSystemLog()

WsfSystemLog & WsfApplication::GetSystemLog ( )
inline

Return a reference to the system log.

Referenced by WsfStandardApplication::RunEventLoop().

◆ IsTestingEnabled()

bool WsfApplication::IsTestingEnabled ( ) const
inline

Returns 'true' if application is executing under the control of an automated test executive.

◆ RegisterExtension()

void WsfApplication::RegisterExtension ( const std::string & aName,
std::unique_ptr< WsfApplicationExtension > aExtensionPtr )

◆ RegisterFeature()

◆ RemoveCommandLineOptions()

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.

Parameters
aArgcThe index of the first argument to be removed.
aArgCountThe number of arguments to be removed.

◆ WsfScenario


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