WSF
wsf::comm::Component Class Reference

#include <WsfCommComponent.hpp>

Inheritance diagram for wsf::comm::Component:
Collaboration diagram for wsf::comm::Component:

Public Member Functions

 Component ()=default
 ~Component () override=default
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 WsfComponentCloneComponent () const =0
virtual WsfStringId GetComponentName () const =0
virtual const int * GetComponentRoles () const =0
virtual void * QueryInterface (int aRole)=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 void PreInput ()

Utility methods.

CommGetComm () const
WsfPlatformGetPlatform () const
WsfSimulationGetSimulation () const

Generic methods.

Actual comm model implementations do not need to worry about calling these directly because they are required to call base class methods that end up calling these methods. (e.g. WsfCommXmtrRcvr::ProcessInput calls WsfComm::ProcessInput).

These always have the same argument lists as the routine from which they are called.

virtual void TurnOn (double aSimTime)
virtual void TurnOff (double aSimTime)
virtual void Setup ()
virtual void PendingStart ()
virtual bool Initialize (double aSimTime)
virtual bool Initialize2 (double aSimTime)
virtual bool PreInitialize (double aSimTime)
virtual bool ProcessInput (UtInput &aInput)

Model-specific methods.

Actual comm models (e.g. WsfCommXmtrRcvr, WsfRadioXmtrRcvr, etc.) must place calls in their code because there is no common location from where these methods could be called. See the static wrapper methods below.

virtual void AttemptToTransmit (double aSimTime, Result &aResult)
virtual void AttemptToReceive (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)

Model-specific wrapper methods.

These wrap the model-specific methods so specific models only need to have one line inserted into their code where component effects need to be evaluated.

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)

Additional Inherited Members

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

Detailed Description

A abstract base class for comm system extension components. Components can be added to implement additional functionality beyond what is provided by a specific model. The responsibilities of a derived class include: -) Implementing the 'required interface' methods as defined in WsfComponent. -) Implementing any desired 'common framework' methods defined in WsfComponent. -) Implementing any desired methods as defined below. -) Implementing the specific capabilities required by the derived class.

Constructor & Destructor Documentation

◆ Component()

◆ ~Component()

wsf::comm::Component::~Component ( )
overridedefault

Member Function Documentation

◆ AttemptToReceive() [1/2]

void wsf::comm::Component::AttemptToReceive ( Comm & aComm,
double aSimTime,
Result & aResult )
static

Called by model implementations when attempting to receive a message.

References Component(), and wsf::comm::Comm::GetComponents().

◆ AttemptToReceive() [2/2]

virtual void wsf::comm::Component::AttemptToReceive ( double aSimTime,
Result & aResult )
inlinevirtual

◆ AttemptToTransmit() [1/2]

void wsf::comm::Component::AttemptToTransmit ( Comm & aComm,
double aSimTime,
Result & aResult )
static

Called by model implementations when attempting to send a message.

References Component(), and wsf::comm::Comm::GetComponents().

◆ AttemptToTransmit() [2/2]

virtual void wsf::comm::Component::AttemptToTransmit ( double aSimTime,
Result & aResult )
inlinevirtual

◆ CanInteractWith()

bool wsf::comm::Component::CanInteractWith ( const Comm * aXmtrPtr)
virtual

◆ GetComm()

◆ GetPlatform()

◆ GetSimulation()

◆ Initialize()

bool WsfComponent::Initialize ( double aSimTime)
virtual

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.

Reimplemented in wsf::comm::ComponentHW, wsf::comm::ComponentHW_JTIDS, wsf::comm::ProtocolIGMP, wsf::comm::ProtocolInterface, and WsfEW_CommComponent.

◆ Initialize2()

bool WsfComponent::Initialize2 ( double aSimTime)
virtual

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 WsfComponent.

Reimplemented in WsfEW_CommComponent.

◆ PendingStart()

virtual void wsf::comm::Component::PendingStart ( )
inlinevirtual

◆ PreInitialize()

bool WsfComponent::PreInitialize ( double aSimTime)
virtual

Perform pre-initializion function. This is called by WsfPlatform::Initialize prior to actually initializing the components on a platform (i.e.: calling Initialize and Initialize2 for each component). The primary reason for this method is to allow components to add other components that will then be subsequently initialized. The component may examine the component list and add components, but it must not assume ANYTHING about the actual state of the component.

Parameters
aSimTimeThe current simulation time.
Returns
true if successful or false if unsuccessful (bad input data, etc.)

Reimplemented from WsfComponent.

◆ ProcessInput()

bool WsfComponent::ProcessInput ( UtInput & aInput)
virtual

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 WsfComponent.

Reimplemented in wsf::comm::ComponentHW, wsf::comm::ComponentHW_JTIDS, wsf::comm::ComponentHW_LASER, wsf::comm::ComponentHW_Subsurface, wsf::comm::ProtocolIGMP, wsf::comm::ProtocolInterface, and WsfEW_CommComponent.

Referenced by wsf::comm::ComponentHW::ProcessInput().

◆ Receive() [1/2]

bool wsf::comm::Component::Receive ( Comm & aComm,
double aSimTime,
Comm * aXmtrPtr,
Message & aMessage )
static

◆ Receive() [2/2]

virtual bool wsf::comm::Component::Receive ( double aSimTime,
Comm * aXmtrPtr,
Message & aMessage )
inlinevirtual

Reimplemented in wsf::xio::CommComponent.

Referenced by wsf::comm::Comm::Receive().

◆ Send() [1/2]

bool wsf::comm::Component::Send ( Comm & aComm,
double aSimTime,
const WsfMessage & aMessage,
const Address & aAddress )
static

◆ Send() [2/2]

virtual bool wsf::comm::Component::Send ( double aSimTime,
const WsfMessage & aMessage,
const Address & aAddress )
inlinevirtual

Referenced by wsf::comm::Comm::Send().

◆ Setup()

virtual void wsf::comm::Component::Setup ( )
inlinevirtual

Reimplemented in wsf::comm::ProtocolIGMP.

◆ TurnOff()

virtual void wsf::comm::Component::TurnOff ( double aSimTime)
inlinevirtual

Reimplemented in wsf::comm::ComponentHW.

◆ TurnOn()

virtual void wsf::comm::Component::TurnOn ( double aSimTime)
inlinevirtual

Reimplemented in wsf::comm::ComponentHW.


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