WSF
WsfCommandChain Class Reference

#include <WsfCommandChain.hpp>

Inheritance diagram for WsfCommandChain:
Collaboration diagram for WsfCommandChain:

Public Types

typedef std::vector< WsfPlatform * > PlatformList
typedef std::vector< WsfPlatform * >::iterator PlatformListIter
Public Types inherited from WsfComponentT< WsfPlatform >
typedef WsfPlatform ParentType
 This is needed to support the WsfComponentList template.

Public Member Functions

 WsfCommandChain ()
 WsfCommandChain (WsfStringId aCommandChainName, WsfStringId aCommanderName)
 Constructor with chain name and commander.
 ~WsfCommandChain () override=default
Public Member Functions inherited from WsfSimpleComponentT< WsfPlatformComponent >
 WsfSimpleComponentT ()=default
 Empty constructor for serialization.
 WsfSimpleComponentT (int aRole, WsfStringId aName)
 WsfSimpleComponentT (int aRole)
 WsfSimpleComponentT (WsfStringId aName)
 WsfSimpleComponentT (const WsfSimpleComponentT &aSrc)
WsfSimpleComponentToperator= (const WsfSimpleComponentT &aRhs)
 ~WsfSimpleComponentT () override=default
WsfStringId GetComponentName () const override
const int * GetComponentRoles () const override
Public Member Functions inherited from WsfComponentT< WsfPlatform >
 WsfComponentT ()
 WsfComponentT (const WsfComponentT &) noexcept
WsfComponentToperator= (const WsfComponentT &) noexcept
 ~WsfComponentT () override=default
ParentTypeGetComponentParent () const
void SetComponentParent (ParentType *aParentPtr)
Public Member Functions inherited from WsfComponent
virtual ~WsfComponent ()=default
template<typename T>
bool QueryInterfaceT (T *&aRolePtr)
bool ComponentHasRole (int aRole)
 Returns true if the component has the specified role.
virtual bool PreInitialize (double aSimTime)
virtual bool Initialize2 (double aSimTime)
virtual void PreInput ()
virtual bool ProcessInput (UtInput &aInput)
Public Member Functions inherited from WsfNamed
 WsfNamed ()
 WsfNamed (WsfStringId aName)
 WsfNamed (const WsfNamed &)=default
WsfNamedoperator= (const WsfNamed &)=default
virtual ~WsfNamed ()=default
const std::string & GetName () const
WsfStringId GetNameId () const
void SetName (WsfStringId aName)

Static Public Member Functions

static void RegisterComponentFactory (WsfScenario &aScenario)
static std::unique_ptr< UtScriptClass > CreateScriptClass (const std::string &aClassName, UtScriptTypes *aScriptTypesPtr)
static std::string GetDefaultName ()
 Get the name to be used for the default command chain.
static WsfStringId GetDefaultNameId ()
 Get the name (string ID) to be used for the default command chain.

Simulation infrastructure methods.

static bool LoadInstance (UtInput &aInput, WsfCommandChain *&aInstancePtr)
bool Initialize (double aSimTime) override
void PlatformAdded (WsfPlatform *aPlatformPtr)
void PlatformDeleted (WsfPlatform *aPlatformPtr)
 WsfCommandChain (const WsfCommandChain &aSrc)
 Copy constructor (for Clone()).
WsfCommandChainoperator= (const WsfCommandChain &aRhs)

Component infrastructure methods

WsfComponentCloneComponent () const override
void * QueryInterface (int aRole) override
int GetComponentInitializationOrder () const override
void ComponentParentChanged (WsfPlatform *aPlatformPtr) override
WsfPlatformGetPlatform () const

Commander methods.

WsfPlatformGetCommander () const
void SetCommander (WsfPlatform *aPlatformPtr)
std::string GetCommanderName () const
 Get the name of the commander.
WsfStringId GetCommanderNameId () const
 Get the name ID of the commander;.

Peer methods.

PlatformListGetPeers ()
void AddPeer (WsfPlatform *aPlatformPtr)
 Adds the given platform to the list of peers in the command chain.
void RemovePeer (WsfPlatform *aPlatformPtr)
 Removes the given platform from the list of peers in the command chain.

Subordinate methods.

PlatformListGetSubordinates ()
void AddSubordinate (WsfPlatform *aPlatformPtr)
 Adds the given platform to the list of subordinates in the command chain.
void RemoveSubordinate (WsfPlatform *aPlatformPtr)
 Removes the given platform from the list of subordinates in the command chain.

Additional Inherited Members

int mRoles [2]

Detailed Description

The command and control reporting structure of a platform.

This object indicates the immediate commander, peers and of a specific platform within a specific command chain.

Note
A platform may be part of more than one command chain.

Member Typedef Documentation

◆ PlatformList

◆ PlatformListIter

typedef std::vector<WsfPlatform*>::iterator WsfCommandChain::PlatformListIter

Constructor & Destructor Documentation

◆ WsfCommandChain() [1/3]

◆ WsfCommandChain() [2/3]

WsfCommandChain::WsfCommandChain ( WsfStringId aCommandChainName,
WsfStringId aCommanderName )

Constructor with chain name and commander.

References cWSF_COMPONENT_COMMAND_CHAIN.

◆ ~WsfCommandChain()

WsfCommandChain::~WsfCommandChain ( )
overridedefault

◆ WsfCommandChain() [3/3]

WsfCommandChain::WsfCommandChain ( const WsfCommandChain & aSrc)
protected

Copy constructor (for Clone()).

References WsfCommandChain().

Member Function Documentation

◆ AddPeer()

void WsfCommandChain::AddPeer ( WsfPlatform * aPlatformPtr)

Adds the given platform to the list of peers in the command chain.

Referenced by PlatformAdded(), and SetCommander().

◆ AddSubordinate()

void WsfCommandChain::AddSubordinate ( WsfPlatform * aPlatformPtr)

Adds the given platform to the list of subordinates in the command chain.

Referenced by PlatformAdded(), and SetCommander().

◆ CloneComponent()

WsfComponent * WsfCommandChain::CloneComponent ( ) const
inlineoverridevirtual

Clones a component. May return null if component does not support clone.

Implements WsfComponent.

References WsfCommandChain().

◆ ComponentParentChanged()

void WsfCommandChain::ComponentParentChanged ( WsfPlatform * aParentPtr)
inlineoverridevirtual

The parent to which the component is attached has been updated. This virtual method is called whenever the components parent attachment has been changed. This is provided so derived class receives notification of the change.

Parameters
aParentPtrPointer to the new parent. The new parent may be null if the attachment was severed.

Reimplemented from WsfComponentT< WsfPlatform >.

◆ CreateScriptClass()

std::unique_ptr< UtScriptClass > WsfCommandChain::CreateScriptClass ( const std::string & aClassName,
UtScriptTypes * aScriptTypesPtr )
static

Create the 'class' object for the script system. This is invoked once by WsfScriptManager to create the 'class' object that defines the interface to instances of this class from the script system.

Referenced by WsfScriptManager::RegisterTypes().

◆ GetCommander()

◆ GetCommanderName()

std::string WsfCommandChain::GetCommanderName ( ) const

Get the name of the commander.

Referenced by WsfExplicitWeapon::InitializeCommandChains().

◆ GetCommanderNameId()

WsfStringId WsfCommandChain::GetCommanderNameId ( ) const
inline

◆ GetComponentInitializationOrder()

int WsfCommandChain::GetComponentInitializationOrder ( ) const
inlineoverridevirtual

Forces a specific initialization order. Components are initialized in increasing initialization order value.

Reimplemented from WsfComponent.

References cWSF_INITIALIZE_ORDER_COMMAND_CHAIN.

◆ GetDefaultName()

◆ GetDefaultNameId()

◆ GetPeers()

◆ GetPlatform()

WsfPlatform * WsfCommandChain::GetPlatform ( ) const
inline

Get the platform associated with this node in the command chain.

Returns
The platform with which this node in the command chain is associated.

Referenced by wsf::comm::util::SelectRecipients(), UT_DEFINE_SCRIPT_METHOD(), UT_DEFINE_SCRIPT_METHOD(), UT_DEFINE_SCRIPT_METHOD(), and UT_DEFINE_SCRIPT_METHOD().

◆ GetSubordinates()

◆ Initialize()

bool WsfCommandChain::Initialize ( double aSimTime)
overridevirtual

Perform phase 1 initialization. This is called by WsfPlatform::Initialize() during phase 1 initialization of the platform. The component should complete validation of input data that could not be done by ProcessInput, as well as any other functions to prepare for simulation use (subject to the next paragraph).

The order in which components are initialized is defined by GetComponentInitializationOrder. In general a component implementation of this method should not be dependent on the state of another component, i.e.: it should not assume that the other components Initialize() method has been called. If such a dependency exists one should use Initialize2() if possible, or specify a value GetComponentInitializationOrder to force things to initialize in a particular order.

Parameters
aSimTimeThe current simulation time.
Returns
true if successful or false if unsuccessful (bad input data, etc.)
Note
This method should NOT add any other components to the platform. This MUST be done in PreInitialize().

Reimplemented from WsfComponent.

References ok.

Referenced by SetCommander().

◆ LoadInstance()

bool WsfCommandChain::LoadInstance ( UtInput & aInput,
WsfCommandChain *& aInstancePtr )
static

Create a command chain with the specified input.

Parameters
aInputA generic input.
aInstancePtr[output] The command chain to be created.
Returns
'true' if the command chain was created; 'false' otherwise.

References GetDefaultNameId(), and WsfCommandChain().

◆ operator=()

WsfCommandChain & WsfCommandChain::operator= ( const WsfCommandChain & aRhs)
protected

◆ PlatformAdded()

void WsfCommandChain::PlatformAdded ( WsfPlatform * aPlatformPtr)

Perform initialization associated with a platform's being added to the simulation.

Parameters
aPlatformPtrThe platform (WsfPlatform*) that was just added.

References AddPeer(), AddSubordinate(), WsfComponentList::GetComponent(), GetDefaultNameId(), WsfNamed::GetNameId(), WsfObject::GetNameId(), SetCommander(), and WsfCommandChain().

Referenced by WsfPlatform::PlatformAdded().

◆ PlatformDeleted()

void WsfCommandChain::PlatformDeleted ( WsfPlatform * aPlatformPtr)

Perform cleanup associated with a platform's being deleted from the simulation.

Parameters
aPlatformPtrThe platform (WsfPlatform*) that is about to be deleted.

References GetDefaultNameId(), WsfNamed::GetNameId(), RemovePeer(), RemoveSubordinate(), and WsfCommandChain().

Referenced by WsfPlatform::PlatformDeleted().

◆ QueryInterface()

void * WsfCommandChain::QueryInterface ( int aRole)
inlineoverridevirtual

Requests a component's role interface. A component can support one or more roles.

Parameters
aRoleThe role whose interface is to be returned.
Returns
A pointer to the object if it supports the indicated role, or 'null' if it does not. Usage: WsfProcessor* procPtrOrNull = (WsfProcessor*)componentPtr->QueryComponentInterface(cWSF_COMPONENT_PROCESSOR);

Implements WsfComponent.

References WsfSimpleComponentT< WsfPlatformComponent >::mRoles.

◆ RegisterComponentFactory()

void WsfCommandChain::RegisterComponentFactory ( WsfScenario & aScenario)
static

◆ RemovePeer()

void WsfCommandChain::RemovePeer ( WsfPlatform * aPlatformPtr)

Removes the given platform from the list of peers in the command chain.

Referenced by PlatformDeleted(), and SetCommander().

◆ RemoveSubordinate()

void WsfCommandChain::RemoveSubordinate ( WsfPlatform * aPlatformPtr)

Removes the given platform from the list of subordinates in the command chain.

Referenced by PlatformDeleted(), and SetCommander().

◆ SetCommander()

void WsfCommandChain::SetCommander ( WsfPlatform * aPlatformPtr)

Define a new commander for this command chain.

Parameters
aPlatformPtrThe new commander.
Note
This assumes that the new command defined by the input argument exists AND has been initialized.

References AddPeer(), AddSubordinate(), WsfNamed::GetNameId(), WsfObject::GetNameId(), GetSubordinates(), Initialize(), RemovePeer(), RemoveSubordinate(), and WsfCommandChain().

Referenced by PlatformAdded(), WsfWeaponServer::SetCommander(), UT_DEFINE_SCRIPT_METHOD(), and UT_DEFINE_SCRIPT_METHOD().


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