WSF
WsfEW_CommComponent Class Reference

The EW component that will be attached to all comm systems. More...

#include <WsfEW_CommComponent.hpp>

Inheritance diagram for WsfEW_CommComponent:
Collaboration diagram for WsfEW_CommComponent:

Public Member Functions

 ~WsfEW_CommComponent () override=default
Public Member Functions inherited from wsf::comm::Component
 Component ()=default
 ~Component () override=default
CommGetComm () const
WsfPlatformGetPlatform () const
WsfSimulationGetSimulation () const
virtual void TurnOn (double aSimTime)
virtual void TurnOff (double aSimTime)
virtual void Setup ()
virtual void PendingStart ()
virtual bool PreInitialize (double aSimTime)
virtual void AttemptToTransmit (double aSimTime, Result &aResult)
virtual bool CanInteractWith (const Comm *aXmtrPtr)
virtual bool Receive (double aSimTime, Comm *aXmtrPtr, Message &aMessage)
virtual bool Send (double aSimTime, const WsfMessage &aMessage, const Address &aAddress)
Public Member Functions inherited from WsfComponentT< Comm >
 WsfComponentT ()
WsfComponentToperator= (const WsfComponentT &) noexcept
 ~WsfComponentT () override=default
virtual void ComponentParentChanged (ParentType *aParentPtr)
ParentTypeGetComponentParent () const
void SetComponentParent (ParentType *aParentPtr)
Public Member Functions inherited from WsfComponent
virtual ~WsfComponent ()=default
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 void PreInput ()

Static Public Member Functions

static void RegisterComponentFactory (WsfScenario &aScenario)
 Register the component factory that handles input for this component.
static WsfEW_CommComponentFind (const wsf::comm::Comm &aParent)
 Find the instance of this component attached to the specified processor.
static WsfEW_CommComponentFindOrCreate (wsf::comm::Comm &aParent)
static void AttemptToTransmit (Comm &aComm, double aSimTime, Result &aResult)
 Called by model implementations when attempting to send a message.
static void AttemptToReceive (Comm &aComm, double aSimTime, Result &aResult)
 Called by model implementations when attempting to receive a message.
static bool Receive (Comm &aComm, double aSimTime, Comm *aXmtrPtr, Message &aMessage)
static bool Send (Comm &aComm, double aSimTime, const WsfMessage &aMessage, const Address &aAddress)

WsfEW_CommComponent methods.

bool CanPerceiveJamming () const
bool JammingPerceived ()
double GetJammingFirstPerceived () const
double GetJammingLastPerceived () const

Required interface from WsfComponent.

WsfComponentCloneComponent () const override
WsfStringId GetComponentName () const override
const int * GetComponentRoles () const override
void * QueryInterface (int aRole) override

Interface from WsfCommComponent.

bool Initialize (double aSimTime) override
bool Initialize2 (double aSimTime) override
bool ProcessInput (UtInput &aInput) override
void AttemptToReceive (double aSimTime, wsf::comm::Result &aResult) override

Additional Inherited Members

Public Types inherited from WsfComponentT< Comm >
typedef Comm ParentType
 This is needed to support the WsfComponentList template.

Detailed Description

The EW component that will be attached to all comm systems.

Constructor & Destructor Documentation

◆ ~WsfEW_CommComponent()

WsfEW_CommComponent::~WsfEW_CommComponent ( )
overridedefault

Member Function Documentation

◆ AttemptToReceive()

◆ CanPerceiveJamming()

bool WsfEW_CommComponent::CanPerceiveJamming ( ) const

Checks to see if jamming can be perceived by the sensor beam.

Returns
'true' if jamming can be perceived by the sensor beam, 'false' otherwise.

Referenced by ~WsfEW_CommComponent().

◆ CloneComponent()

WsfComponent * WsfEW_CommComponent::CloneComponent ( ) const
overridevirtual

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

Implements WsfComponent.

◆ Find()

WsfEW_CommComponent * WsfEW_CommComponent::Find ( const wsf::comm::Comm & aParent)
static

Find the instance of this component attached to the specified processor.

References WsfComponentList::FindByRole(), and wsf::comm::Comm::GetComponents().

Referenced by FindOrCreate(), WsfEW_AgilityEffect::UpdateEffects(), and WsfCommScriptMethods::UT_DEFINE_SCRIPT_METHOD_EXT().

◆ FindOrCreate()

WsfEW_CommComponent * WsfEW_CommComponent::FindOrCreate ( wsf::comm::Comm & aParent)
static

Find the instance of this component attached to the specified processor, and create it if it doesn't exist.

References WsfComponentListT< COMPONENT_TYPE >::AddComponent(), Find(), and wsf::comm::Comm::GetComponents().

◆ GetComponentName()

WsfStringId WsfEW_CommComponent::GetComponentName ( ) const
overridevirtual

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.

◆ GetComponentRoles()

const int * WsfEW_CommComponent::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.

References cWSF_COMPONENT_COMM, cWSF_COMPONENT_EW_COMM, and cWSF_COMPONENT_NULL.

◆ GetJammingFirstPerceived()

double WsfEW_CommComponent::GetJammingFirstPerceived ( ) const
inline

◆ GetJammingLastPerceived()

double WsfEW_CommComponent::GetJammingLastPerceived ( ) const
inline

◆ Initialize()

bool WsfEW_CommComponent::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 wsf::comm::Component.

◆ Initialize2()

bool WsfEW_CommComponent::Initialize2 ( double aSimTime)
overridevirtual

Perform phase 2 initialization. This is called by WsfPlatform::Initialize() during phase 2 of platform initialization. This method is typically used when a component may have some dependency on another component having completed its phase 1 initialization. The component should be ready for use in the simulation upon completion of this method.

The order in which components are initialized is defined by GetComponentInitializationOrder.

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

Reimplemented from wsf::comm::Component.

◆ JammingPerceived()

bool WsfEW_CommComponent::JammingPerceived ( )

Checks to see if jamming is being perceived by the comm.

Returns
Returns 'true' if jamming is perceived by the comm, 'false' otherwise.

Referenced by WsfEW_AgilityEffect::UpdateEffects(), WsfCommScriptMethods::UT_DEFINE_SCRIPT_METHOD_EXT(), and ~WsfEW_CommComponent().

◆ ProcessInput()

bool WsfEW_CommComponent::ProcessInput ( UtInput & aInput)
overridevirtual

Evaluate the current input command and determine if it is one processed by the component. The component should get the current command from the input stream and determine if it is one that it recognizes. If it does not recognize the command then it should leave the command in the input stream and return false. If it does recognize the command then it should process the command and return true. If invalid arguments are encountered then it should throw an exception.

Parameters
aInputThe input stream.
Returns
true if the current command was recognized (and processed), or false if the command was not recognized.
Exceptions
UtInput::ExceptionBaseif an invalid input was encountered.

Reimplemented from wsf::comm::Component.

◆ QueryInterface()

void * WsfEW_CommComponent::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.

References cWSF_COMPONENT_COMM, and cWSF_COMPONENT_EW_COMM.

◆ RegisterComponentFactory()

void WsfEW_CommComponent::RegisterComponentFactory ( WsfScenario & aScenario)
static

Register the component factory that handles input for this component.

References WsfScenario::RegisterComponentFactory().

Referenced by WsfEW_EA_EP_Types::WsfEW_EA_EP_Types().


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