WSF
wsf::UCI_Component Class Reference

#include <WsfUCI_Component.hpp>

Inheritance diagram for wsf::UCI_Component:
Collaboration diagram for wsf::UCI_Component:

Definitions to support templated component methods.

static const int cWSF_COMPONENT_UCI = 1234568
 UCI_Component (const WsfScenario &aScenario, int aPartType)
 UCI_Component (const UCI_Component &aSrc)
virtual ~UCI_Component ()
UCI_InterfaceGetInterface ()
double GetUpdateInterval () const override
void SetUpdateInterval (double aUpdateInterval) override
virtual std::set< std::string > GetCapabilityUUIDs () const

Component infrastructure methods.

std::string mSubsystemUUID
std::string mSubsystemLabel
WsfStringId GetComponentName () const override
const int * GetComponentRoles () const override
void * QueryInterface (int aRole) override
virtual bool InjectConditionally (double aSimTime, WsfPlatform &aPlatform)
bool Initialize2 (double aSimTime) override
bool ProcessInput (UtInput &aInput) override
bool IsActive ()
 Is this interface active (i.e., it has a valid corresponding UCI interface; otherwise it does nothing).
bool RegisterWithInterface (double aSimTime)
void DeregisterWithInterface ()
void RegisterCapabilitiesWithInterface ()
void DeregisterCapabilitiesWithInterface ()
virtual void ReceiveUCI_Message (const uci::type::MessageType *aMessagePtr)
WsfSimulationGetSimulation () const
 Convenience Methods.
bool CanHandleMessage () const

Additional Inherited Members

Public Types inherited from WsfPlatformPart
enum  { cLEVEL_ONE_DEBUG = 0x00000001 , cLEVEL_TWO_DEBUG = 0x00000002 }
using InternalMessageQueue = std::queue<WsfMessage*>
using RecipientMessageQueue = std::queue<std::pair<WsfPlatformPart*, WsfMessage*>>
Public Types inherited from WsfObject
typedef std::vector< WsfStringIdTypeList
 The list of types returned by GetTypeList.
Public Types inherited from WsfComponentT< WsfPlatform >
typedef WsfPlatform ParentType
 This is needed to support the WsfComponentList template.
Public Member Functions inherited from WsfPlatformPart
 WsfPlatformPart (const WsfScenario &aScenario, int aPartType)
WsfPlatformPartoperator= (const WsfPlatformPart &aRhs)=delete
 ~WsfPlatformPart () override
const int * GetComponentRoles () const override
void * QueryInterface (int aRole) override
bool DebugEnabled () const
 Returns 'true' if debugging is enabled for this instance.
void SetDebugEnabled (bool aDebugEnabled)
unsigned int GetDebugMask ()
bool IsExternallyControlled () const
virtual void SetExternallyControlled (double aSimTime, bool aIsExternallyControlled)
int GetPartType () const
const char * GetScriptClassName () const override
WsfSimulationGetSimulation () const
const WsfScenarioGetScenario () const
WsfStringId GetComponentName () const override
void ComponentParentChanged (WsfPlatform *aPlatformPtr) override
bool Initialize (double aSimTime) override
bool Initialize2 (double aSimTime) override
bool ProcessInput (UtInput &aInput) override
virtual void Update (double aSimTime)
WsfPlatformGetPlatform () const
virtual void SetPlatform (WsfPlatform *aPlatformPtr)
virtual void PlatformAdded (double aSimTime, WsfPlatform *aPlatformPtr)
virtual void PlatformDeleted (WsfPlatform *aPlatformPtr)
double GetLastStatusChangeTime () const
void SetLastStatusChangeTime (double aSimTime)
 Allows a system to set the time at which the device was initialized.
bool CanBeMadeOperational () const
 Returns an indication that this system can be made operational.
bool CanBeMadeNonOperational () const
 Returns an indication that this system can be made non-operational.
bool CanBeTurnedOn () const
 Returns an indication that this system can be turned on.
bool CanBeTurnedOff () const
 Returns an indication that this system can be turned off.
bool IsTurnedOn () const
bool InitiallyTurnedOn () const
 Is the system to be turned 'on' when added to the simulation?
void SetInitiallyTurnedOn (bool aInitiallyTurnedOn)
 Sets if the system is turned on when added to the simulation.
virtual void TurnOff (double aSimTime)
virtual void TurnOn (double aSimTime)
virtual void SetOperational (double aSimTime)
virtual void SetNonOperational (double aSimTime)
virtual void PartBroken (double aSimTime)
virtual void Restore (double aSimTime)
bool IsOperational () const
bool SetOperational (double aSimTime, bool aMakeOperational)
double GetDamageFactor () const
bool SetDamageFactor (double aSimTime, double aDamageFactor)
bool IsCritical () const
void SetCritical (bool aValue)
virtual void OnPlatformBrokenEvent (double aSimTime)
 Owning platform has issued a broken event.
bool IsBroken () const
WsfInternalLinksGetInternalLinks ()
 Return the internal links for this part.
virtual bool HasInternalLinks () const
 Does this platform part have a communication link to other platform parts?
virtual bool ProcessMessage (double aSimTime, const WsfMessage &aMessage)
virtual bool ReceiveMessage (double aSimTime, const WsfMessage &aMessage)
virtual void SendMessage (double aSimTime, const WsfMessage &aMessage)
virtual void SendMessageTo (double aSimTime, const WsfMessage &aMessage, WsfStringId aRecipientId)
void SendMessageToProcessor (double aSimTime, const WsfMessage &aMessage, WsfStringId aRecipientId)
virtual void SendQueuedMessages (double aSimTime)
const WsfCategoryListGetCategories () const
 Get the categories to which this part belongs.
void AddCategory (WsfStringId aCategoryId)
 Adds the provided category to the platform part's category list.
bool IsCategoryMember (WsfStringId aCategoryId) const
const WsfGroupListGetGroups () const
 Get the groups to which this platform part belongs.
void JoinGroup (WsfGroup *aGroupPtr)
 Join the given group.
void LeaveGroup (WsfGroup *aGroupPtr)
 Leave the given group.
bool IsGroupMember (WsfStringId aGroupId)
unsigned int GetUpdateEventEpoch () const
void IncrementUpdateEventEpoch ()
bool UpdateEventActive () const
 Is an 'Update' event active?
void SetUpdateEventActive (bool aUpdateEventActive)
 Indicate if the 'Update' event is active.
Public Member Functions inherited from WsfObject
 WsfObject ()
 This is the constructor for the WsfObject class.
 ~WsfObject () override
 This is the destructor for the WsfObject class.
const char * GetScriptClassName () const override
virtual WsfObjectClone () const =0
const std::string & GetType () const
WsfStringId GetTypeId () const
 Get the string ID of the 'type' of the object.
void SetType (WsfStringId aType)
const std::string & GetBaseType () const
WsfStringId GetBaseTypeId () const
const TypeListGetTypeList () const
bool IsA_TypeOf (WsfStringId aType) const
WsfObjectoperator= (const WsfObject &aRhs)
 Assignment operator.
template<typename T>
void Serialize (T &aBuff)
 For XIO (de)serialization.
const std::string & GetName () const
WsfStringId GetNameId () const
void SetName (WsfStringId aName)
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
virtual WsfComponentCloneComponent () const =0
virtual int GetComponentInitializationOrder () const
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 void PreInput ()
Public Member Functions inherited from WsfUniqueId
 WsfUniqueId ()
 Construtor initializes the unique identifier to 0.
 WsfUniqueId (const WsfUniqueId &)
 Copy constructor initializes the unique identifier to 0.
WsfUniqueIdoperator= (const WsfUniqueId &)
unsigned int GetUniqueId () const
 Get the unique identifier assigned to this object.
template<typename T>
void Serialize (T &aBuff)
 For XIO (de)serialization.
Public Member Functions inherited from WsfAuxDataEnabled
 WsfAuxDataEnabled ()=default
 WsfAuxDataEnabled (const WsfAuxDataEnabled &aSrc)=default
WsfAuxDataEnabledoperator= (const WsfAuxDataEnabled &aRhs)
 WsfAuxDataEnabled (WsfAuxDataEnabled &&)=default
WsfAuxDataEnabledoperator= (WsfAuxDataEnabled &&)=default
virtual ~WsfAuxDataEnabled () noexcept
void SetAuxData (const WsfAttributeContainer &aAuxData)
void DeleteAuxData ()
 Delete the aux data container from the object.
void MergeAuxData (const WsfAuxDataEnabled &aSrc)
 Merge the object's aux data with aux data from an existing object.
void UpdateAuxData (const WsfAuxDataEnabled &aSrc)
 Update the object's aux data with aux data from an existing object.
bool HasAuxData () const
 Returns true if this object has aux data.
bool ProcessInput (UtInput &aInput)
template<typename T>
void Serialize (T &aBuff)
 (De)serialization for XIO
WsfAttributeContainerGetAuxData ()
const WsfAttributeContainerGetAuxData () const noexcept
const WsfAttributeContainerGetAuxDataConst () const noexcept
Static Public Attributes inherited from WsfAuxDataEnabled
static UtCallbackListN< void(const WsfAuxDataEnabled *)> AuxDataAccessed
static UtCallbackListN< void(const WsfAuxDataEnabled *)> AuxDataDestroyed
 WsfPlatformPart (const WsfPlatformPart &aSrc)
 Copy constructor (for Clone()).
 WsfObject (const WsfObject &aSrc)
 Copy constructor (for Clone()).
Protected Member Functions inherited from WsfUniqueId
void AssignUniqueId (WsfSimulation *aSimulationPtr)

Detailed Description

An example of a simple platform component (See WsfSimplePlatformCompoent). UCI_ are meant to be single instances on platforms with only a defined quantity.

Constructor & Destructor Documentation

◆ UCI_Component() [1/2]

◆ UCI_Component() [2/2]

wsf::UCI_Component::UCI_Component ( const UCI_Component & aSrc)

◆ ~UCI_Component()

wsf::UCI_Component::~UCI_Component ( )
virtual

Member Function Documentation

◆ CanHandleMessage()

◆ DeregisterCapabilitiesWithInterface()

void wsf::UCI_Component::DeregisterCapabilitiesWithInterface ( )

◆ DeregisterWithInterface()

void wsf::UCI_Component::DeregisterWithInterface ( )

◆ GetCapabilityUUIDs()

virtual std::set< std::string > wsf::UCI_Component::GetCapabilityUUIDs ( ) const
inlinevirtual

◆ GetComponentName()

WsfStringId wsf::UCI_Component::GetComponentName ( ) const
inlineoverridevirtual

Returns the component's name. Each component in a component list has a unique name. Names are usually defined by the user, but they may also be generated by code and prefixed with a '#' to guarantee no collisions with user-defined names.

Implements WsfComponent.

References WsfObject::GetNameId().

◆ GetComponentRoles()

const int * wsf::UCI_Component::GetComponentRoles ( ) const
overridevirtual

Returns a zero-terminated array of component roles. Note that the array should be in decreasing order of specificity and should generally the inheritance hierarchy. The first entry should be the components 'primary' role. For example a sensor would do the following:

return roles;
@ cWSF_COMPONENT_SENSOR
A 'sensor' component (WsfSensor).
Definition WsfComponentRoles.hpp:105
@ cWSF_COMPONENT_PLATFORM_PART
The component derives from WsfPlatformPart.
Definition WsfComponentRoles.hpp:98
@ cWSF_COMPONENT_ARTICULATED_PART
The component derives from WsfArticulatedPart.
Definition WsfComponentRoles.hpp:99

Implements WsfComponent.

Reimplemented in wsf::UCI_Computer, wsf::UCI_ESM_Component, wsf::UCI_IRST_Component, wsf::UCI_PartComponent, wsf::UCI_SensorComponent, and wsf::UCI_WeaponComponent.

References cWSF_COMPONENT_NULL, cWSF_COMPONENT_PLATFORM_PART, and cWSF_COMPONENT_UCI.

◆ GetInterface()

◆ GetSimulation()

◆ GetUpdateInterval()

double wsf::UCI_Component::GetUpdateInterval ( ) const
overridevirtual

Get interval at which Update() is called. This value is set by calling WsfSimulation::GetInstance().SetProcessorUpdateInterval();

Implements WsfPlatformPart.

◆ Initialize2()

bool wsf::UCI_Component::Initialize2 ( double aSimTime)
overridevirtual

Save whether this component was successfully initialized. In overriding this method, this base class method should be called last. (see destructor).

Reimplemented from WsfComponent.

Reimplemented in wsf::UCI_ESM_Component, wsf::UCI_IRST_Component, wsf::UCI_PartComponent, wsf::UCI_SensorComponent, and wsf::UCI_WeaponComponent.

References WsfPlatformPart::Initialize2().

Referenced by wsf::UCI_PartComponent::Initialize2().

◆ InjectConditionally()

virtual bool wsf::UCI_Component::InjectConditionally ( double aSimTime,
WsfPlatform & aPlatform )
inlinevirtual

◆ IsActive()

bool wsf::UCI_Component::IsActive ( )
inline

◆ ProcessInput()

bool wsf::UCI_Component::ProcessInput ( UtInput & aInput)
overridevirtual

Process input from a generic source.

Examine the current input command. If it is NOT one of the commands recognized by this class then it simply returns 'false'. If it is one of the commands recognized by this class then it processes the command and returns 'true'.

Parameters
aInputa reference to a UtInput object.
Returns
'true' if the command was one recognized by the class or 'false' if not.
Exceptions
UtInput::ExceptionBase(or an object derived from it) if the command was recognized but contains some sort of error.
Note
If a derived class does not recognize the command (i.e.: the return value is false) then it should call the base class ProcessInput method. This chain should continue until either the command is recognized or the top-level base class is encountered.

Reimplemented from WsfObject.

Reimplemented in wsf::UCI_PartComponent, wsf::UCI_SensorComponent, and wsf::UCI_WeaponComponent.

References mSubsystemLabel, mSubsystemUUID, and WsfPlatformPart::ProcessInput().

Referenced by wsf::UCI_PartComponent::ProcessInput().

◆ QueryInterface()

void * wsf::UCI_Component::QueryInterface ( int aRole)
overridevirtual

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.

Reimplemented in wsf::UCI_Computer, wsf::UCI_ESM_Component, wsf::UCI_IRST_Component, wsf::UCI_PartComponent, wsf::UCI_SensorComponent, and wsf::UCI_WeaponComponent.

References cWSF_COMPONENT_PLATFORM_PART, cWSF_COMPONENT_UCI, and WsfPlatformPart::WsfPlatformPart().

Referenced by wsf::UCI_PartComponent::QueryInterface().

◆ ReceiveUCI_Message()

virtual void wsf::UCI_Component::ReceiveUCI_Message ( const uci::type::MessageType * aMessagePtr)
inlinevirtual

Receive a raw UCI message. By default do nothing.

Reimplemented in wsf::UCI_Computer.

◆ RegisterCapabilitiesWithInterface()

◆ RegisterWithInterface()

bool wsf::UCI_Component::RegisterWithInterface ( double aSimTime)

◆ SetUpdateInterval()

void wsf::UCI_Component::SetUpdateInterval ( double aUpdateInterval)
overridevirtual

Set the time interval between the periodic calls to Update(). A value of less than or equal to zero indicates periodic updates are not to be performed.

Parameters
aUpdateIntervalThe new update interval.
Note
Users should call WsfSimulation::GetInstance().SetProcessorUpdateInterval() to set the interval.

Implements WsfPlatformPart.

Member Data Documentation

◆ cWSF_COMPONENT_UCI

◆ mSubsystemLabel

std::string wsf::UCI_Component::mSubsystemLabel
protected

◆ mSubsystemUUID


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