WSF
WsfObserver::Router Class Reference

#include <WsfCommRouter.hpp>

Inheritance diagram for WsfObserver::Router:
Collaboration diagram for WsfObserver::Router:

Classes

class  SendData
struct  Gateway

Public Types

using CommVector = std::vector<Comm*>
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.

Component List support

using ComponentList = WsfComponentListT<WsfComponentT<Router>>
ComponentListGetComponents ()
const ComponentListGetComponents () const
bool AddComponent (RouterComponent *aComponentPtr)
bool RemoveComponent (RouterComponent *aComponentPtr)
virtual bool Receive (double aSimTime, Comm *aXmtrPtr, Comm *aRcvrPtr, Message &aMessage, bool &aOverrideForward)
virtual bool Send (double aSimTime, SendData &aData)
 Router (const WsfScenario &aScenario)
 Router (Router &&aSrc)=delete
RouterClone () const override
Routeroperator= (const Router &aRhs)=delete
Routeroperator= (Router &&aRhs)=delete
 ~Router () override=default

Interface/Comm Member methods

Note
Prefer usage of the comm pointer methods when applicable, as they are better performing.
virtual void AddInterface (double aSimTime, Comm *aCommPtr)
void AddInterface (double aSimTime, const Address &aAddress)
virtual void RemoveInterface (double aSimTime, Comm *aCommPtr)
void RemoveInterface (double aSimTime, const Address &aAddress)
bool HasInterface (Comm *aCommPtr) const
bool HasInterface (const Address &aAddress) const
void ClearInterfaces ()
const CommVectorGetInterfaces () const
bool IsActive () const
virtual void InitializeCallbacks ()
 Setup the callbacks for this router.
virtual bool AddLink (double aSimTime, const Address &aSender, const Address &aDestination, ProtocolInterface &aProtocol, bool aNotifyObserver=true)
virtual bool RemoveLink (double aSimTime, const Address &aSender, const Address &aDestination, ProtocolInterface &aProtocol, bool aNotifyObserver=true)
virtual bool AddNode (double aSimTime, const Address &aNodeAddress, ProtocolInterface &aProtocol, bool aNotifyObserver=true)
virtual bool RemoveNode (double aSimTime, const Address &aNodeAddress, ProtocolInterface &aProtocol, bool aNotifyObserver=true)
virtual bool EnableLink (double aSimTime, const Address &aSender, const Address &aDestination, ProtocolInterface &aProtocol, bool aNotifyObserver=true)
virtual bool DisableLink (double aSimTime, const Address &aSender, const Address &aDestination, ProtocolInterface &aProtocol, bool aNotifyObserver=true)
virtual bool EnableNode (double aSimTime, const Address &aNodeAddress, ProtocolInterface &aProtocol)
virtual bool DisableNode (double aSimTime, const Address &aNodeAddress, ProtocolInterface &aProtocol)
const AddressGetGateway () const
void SetGateway (const Address &aAddress)
size_t GetHopLimit () const
NetworkManager * GetNetworkManager () const
void SetHopLimit (size_t aHopLimit)
virtual bool Broadcast (double aSimTime, SendData &aData)
std::vector< ProtocolInterface * > GetSortedProtocols () const
 Router (const Router &aSrc)
virtual bool ValidateGateway ()
virtual bool AutomateAddedLinkage (double aSimTime, Comm *aCommPtr)
virtual void PerfectCommAdded (double aSimTime, Comm *aCommPtr)
virtual void PerfectCommRemoved (double aSimTime, Comm *aCommPtr)
virtual void PerfectNetworkAdded (double aSimTime, Network *aNetworkPtr)
virtual void PerfectNetworkRemoved (double aSimTime, Network *aNetworkPtr)
virtual void PerfectCommEnabled (double aSimTime, Comm *aCommPtr)
virtual void PerfectCommDisabled (double aSimTime, Comm *aCommPtr)
virtual void PerfectConnectionAdded (double aSimTime, const Address &aSourceAddress, const Address &aDestinationAddress)
virtual void PerfectConnectionRemoved (double aSimTime, const Address &aSourceAddress, const Address &aDestinationAddress)
virtual void PerfectConnectionEnabled (double aSimTime, const Address &aSourceAddress, const Address &aDestinationAddress)
virtual void PerfectConnectionDisabled (double aSimTime, const Address &aSourceAddress, const Address &aDestinationAddress)

Component infrastructure methods

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

Common infrastructure methods

bool PreInitialize (double aSimTime) override
bool Initialize (double aSimTime) override
bool Initialize2 (double aSimTime) override
void PreInput () override
virtual void Setup ()
virtual void PendingStart ()
bool ProcessInput (UtInput &aInput) override
virtual bool ProcessTypeAddEditDelete (UtInput &aInput)
const char * GetScriptClassName () const override

Status methods.

void PartBroken (double aSimTime) override
void SetNonOperational (double aSimTime) override
void SetOperational (double aSimTime) override
void TurnOff (double aSimTime) override
void TurnOn (double aSimTime) override
void SetUpdateInterval (double aInterval) override
double GetUpdateInterval () const override

Additional Inherited Members

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 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
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
template<typename T>
bool QueryInterfaceT (T *&aRolePtr)
bool ComponentHasRole (int aRole)
 Returns true if the component has the specified role.
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

The router class object for AFSIM communications. This object is held on every comm object in AFSIM to aid in determination of the path a message is transmitted. It is applicable to both traditional wired networks as well as EM based systems, such as radio. Knowledge of the communications network depends on the protocols used with this router. The default "legacy" protocol simply uses the simulation truth for routing decisions. Other protocols that are based on potentially incomplete, stale, or incorrect network states maintain their own graph that is used for routing.

Member Typedef Documentation

◆ CommVector

◆ ComponentList

Constructor & Destructor Documentation

◆ Router() [1/3]

◆ Router() [2/3]

wsf::comm::router::Router::Router ( Router && aSrc)
delete

◆ Router() [3/3]

wsf::comm::router::Router::Router ( const Router & aSrc)
protected

◆ ~Router()

Member Function Documentation

◆ AddComponent()

bool wsf::comm::router::Router::AddComponent ( RouterComponent * aComponentPtr)

Wrapper for adding components directly to the router. Used by the various component typelist factories to pass created objects to the router.

◆ AddInterface() [1/2]

void wsf::comm::router::Router::AddInterface ( double aSimTime,
Comm * aCommPtr )
virtual

◆ AddInterface() [2/2]

void wsf::comm::router::Router::AddInterface ( double aSimTime,
const Address & aAddress )

◆ AddLink()

bool wsf::comm::router::Router::AddLink ( double aSimTime,
const Address & aSender,
const Address & aDestination,
ProtocolInterface & aProtocol,
bool aNotifyObserver = true )
virtual

Router graph manipulation methods. These methods add/remove nodes/links on the graph, and/or enables/disables connections. These methods alter what information is available to the router to make decisions. If the router is set to perfect routing, these calls will be initiated by the router "listening" to the callbacks from the network manager. If the router is using dynamic routing capabilities provided by an associated protocol, then these calls are made when appropriate and may result in a network representation locally that differs from "truth" (a.k.a. the network manager).

First, add (or find) the node(s) required.

Now add (or find) the edge.

◆ AddNode()

bool wsf::comm::router::Router::AddNode ( double aSimTime,
const Address & aNodeAddress,
ProtocolInterface & aProtocol,
bool aNotifyObserver = true )
virtual

Check for existence of node in graph.

Node doesn't exist. Add it to the graph.

Notify observer, if set to do so.

◆ AutomateAddedLinkage()

bool wsf::comm::router::Router::AutomateAddedLinkage ( double aSimTime,
Comm * aCommPtr )
protectedvirtual

Helper method for creating linkage between comm interfaces. This also queries the network type for correct add/removal of linkage, to prevent the addition of links that violate the specified network rules of topology, if applicable.

◆ Broadcast()

bool wsf::comm::router::Router::Broadcast ( double aSimTime,
SendData & aData )
virtual

This method enables basic broadcasting functionality. Be warned that this message isn't true broadcasting, as it simply sends multiple messages to each member of the network. This functionality requires a more robust modeling of interface connections, which is currently lacking. When and if that capability is developed, this method can be deprecated. Returns true if successful, prompting appropriate usage in the RouterSend usage of this method.

Note: This method uses only truth data from the network manager. Protocols can handle broadcasts as they see fit, since they get first crack at handling a send. This is only provided for basic functionality as a commonly available router mechanic.

This is safe, since we already validated this in Router::Send()

We only support this call from an originator

◆ ClearInterfaces()

◆ Clone()

Router * wsf::comm::router::Router::Clone ( ) const
overridevirtual

Return a copy of this object. Must be implemented by all derived types. If cloning is impossible, a WsfUncloneableException should be thrown.

Implements WsfObject.

◆ CloneComponent()

WsfComponent * wsf::comm::router::Router::CloneComponent ( ) const
inlineoverridevirtual

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

Implements WsfComponent.

◆ DisableLink()

bool wsf::comm::router::Router::DisableLink ( double aSimTime,
const Address & aSender,
const Address & aDestination,
ProtocolInterface & aProtocol,
bool aNotifyObserver = true )
virtual

One or both nodes are not in the local graph. Can't disable a missing link.

◆ DisableNode()

bool wsf::comm::router::Router::DisableNode ( double aSimTime,
const Address & aNodeAddress,
ProtocolInterface & aProtocol )
virtual

◆ EnableLink()

bool wsf::comm::router::Router::EnableLink ( double aSimTime,
const Address & aSender,
const Address & aDestination,
ProtocolInterface & aProtocol,
bool aNotifyObserver = true )
virtual

One or both nodes are not in the local graph. Can't enable a missing link.

◆ EnableNode()

bool wsf::comm::router::Router::EnableNode ( double aSimTime,
const Address & aNodeAddress,
ProtocolInterface & aProtocol )
virtual

◆ GetComponentInitializationOrder()

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

Reimplemented from WsfComponent.

◆ GetComponentName()

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 * wsf::comm::router::Router::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.

◆ GetComponents() [1/2]

◆ GetComponents() [2/2]

◆ GetGateway()

GetGateway returns the gateway address. It must only be called during runtime, as gateways specified by platform and comm name can only be reconciled after simulation initialization. If the platform/comm name was used to specify the gateway, the gateway validation method fills the missing address.

◆ GetHopLimit()

size_t wsf::comm::router::Router::GetHopLimit ( ) const
inline

◆ GetInterfaces()

◆ GetNetworkManager()

NetworkManager * wsf::comm::router::Router::GetNetworkManager ( ) const
inline

◆ GetScriptClassName()

const char * wsf::comm::router::Router::GetScriptClassName ( ) const
override

◆ GetSortedProtocols()

This method call handles the query of protocols associated with this router object (via the component list) and provides a list of these protocols in their order of precedence of operation.

◆ GetUpdateInterval()

double wsf::comm::router::Router::GetUpdateInterval ( ) const
inlineoverridevirtual

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

Implements WsfPlatformPart.

◆ HasInterface() [1/2]

◆ HasInterface() [2/2]

bool wsf::comm::router::Router::HasInterface ( const Address & aAddress) const

◆ Initialize()

bool wsf::comm::router::Router::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.

◆ Initialize2()

bool wsf::comm::router::Router::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 WsfComponent.

◆ InitializeCallbacks()

Setup the callbacks for this router.

◆ IsActive()

The really just returns if the router is turned on, but we need to wrap it since WsfPlatformPart::IsTurnedOn() returns false before the simulation starts.

◆ operator=() [1/2]

Router & wsf::comm::router::Router::operator= ( const Router & aRhs)
delete

◆ operator=() [2/2]

Router & wsf::comm::router::Router::operator= ( Router && aRhs)
delete

◆ PartBroken()

void wsf::comm::router::Router::PartBroken ( double aSimTime)
overridevirtual

Inform the internal systems that this part is broken.

Parameters
aSimTimeThe current simulation time.

Reimplemented from WsfPlatformPart.

◆ PendingStart()

◆ PerfectCommAdded()

void wsf::comm::router::Router::PerfectCommAdded ( double aSimTime,
Comm * aCommPtr )
protectedvirtual

Network Manager Callbacks Handles the local graph actions on notification from the network manager when this router is using perfect routing.

◆ PerfectCommDisabled()

void wsf::comm::router::Router::PerfectCommDisabled ( double aSimTime,
Comm * aCommPtr )
protectedvirtual

◆ PerfectCommEnabled()

void wsf::comm::router::Router::PerfectCommEnabled ( double aSimTime,
Comm * aCommPtr )
protectedvirtual

◆ PerfectCommRemoved()

void wsf::comm::router::Router::PerfectCommRemoved ( double aSimTime,
Comm * aCommPtr )
protectedvirtual

◆ PerfectConnectionAdded()

void wsf::comm::router::Router::PerfectConnectionAdded ( double aSimTime,
const Address & aSourceAddress,
const Address & aDestinationAddress )
protectedvirtual

◆ PerfectConnectionDisabled()

void wsf::comm::router::Router::PerfectConnectionDisabled ( double aSimTime,
const Address & aSourceAddress,
const Address & aDestinationAddress )
protectedvirtual

◆ PerfectConnectionEnabled()

void wsf::comm::router::Router::PerfectConnectionEnabled ( double aSimTime,
const Address & aSourceAddress,
const Address & aDestinationAddress )
protectedvirtual

◆ PerfectConnectionRemoved()

void wsf::comm::router::Router::PerfectConnectionRemoved ( double aSimTime,
const Address & aSourceAddress,
const Address & aDestinationAddress )
protectedvirtual

◆ PerfectNetworkAdded()

void wsf::comm::router::Router::PerfectNetworkAdded ( double aSimTime,
Network * aNetworkPtr )
protectedvirtual

◆ PerfectNetworkRemoved()

void wsf::comm::router::Router::PerfectNetworkRemoved ( double aSimTime,
Network * aNetworkPtr )
protectedvirtual

◆ PreInitialize()

bool wsf::comm::router::Router::PreInitialize ( double aSimTime)
overridevirtual

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.

◆ PreInput()

void wsf::comm::router::Router::PreInput ( )
overridevirtual

Perform pre-input processing. This is called in certain contexts just before input processing is FIRST done for a component (See WsfObjectTypeListBase::LoadComponentP.) The primary motivation is to allow the newly created component to invoke the type/role-specific PreInput method in the component factories, which may in turn add any sub-components that MAY be required for input processing or for run-time.

This is currently implemented only for platform level components such as WsfComm, WsfProcessor, WsfSensor and some components implemented in optional projects. You can look at the PreInput methods in each of these and see they are very simple.

The reason for this is that WsfObjectTypeListBase::LoadComponentP cannot simply invoke the PreInput methods in the component factories. PreInput is only defined in the template WsfComponentFactoryT<>, and the PreInput method in the template defines a method whose argument is a reference to the object being created. There is no way for LoadComponentP to do this in general. Delegating it to to component solves the problem.

Note
This method may get called more than once as input objects derive from other input type-objects.

Reimplemented from WsfComponent.

◆ ProcessInput()

bool wsf::comm::router::Router::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.

Usage: gateway_address "xxx.xxx.xxx.xxx"

This router's gateway, specified by address.

Usage: gateway "comm_name"

Use int to check for invalid user input < 0 to avoid unsigned rollover and excessive values without error

Component based input.

Reimplemented from WsfObject.

◆ ProcessTypeAddEditDelete()

bool wsf::comm::router::Router::ProcessTypeAddEditDelete ( UtInput & aInput)
virtual

◆ QueryInterface()

void * wsf::comm::router::Router::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.

◆ Receive()

bool wsf::comm::router::Router::Receive ( double aSimTime,
Comm * aXmtrPtr,
Comm * aRcvrPtr,
Message & aMessage,
bool & aOverrideForward )
virtual

The router virtual send/receive methods. The router handles layer processing (typically the network layer) of send/receive methods to determine where a message should be sent (the next hop) to reach its destination.

The send method also contains an optional vector of messages. The functionality of some protocols require sending multiple messages to satisfy a send request. In such a case, any additional messages will be fully populated with necessary data members and returned with the send method for handling by the calling comm interface layer.

The return of the receive method indicates whether or not forwarding of the message is required, while allowing message inspection by the protocols. This return is typically overridden by a check in addressing against the receiving interface, such that an address that doesn't map to the interface will attempt forwarding regardless of the receive return call. The reference passed boolean value in the receive call indicates to override this behavior, as some protocols utilize unique addressing that circumvents typical processing (such as multicast).

◆ RemoveComponent()

bool wsf::comm::router::Router::RemoveComponent ( RouterComponent * aComponentPtr)

◆ RemoveInterface() [1/2]

void wsf::comm::router::Router::RemoveInterface ( double aSimTime,
Comm * aCommPtr )
virtual

◆ RemoveInterface() [2/2]

void wsf::comm::router::Router::RemoveInterface ( double aSimTime,
const Address & aAddress )

◆ RemoveLink()

bool wsf::comm::router::Router::RemoveLink ( double aSimTime,
const Address & aSender,
const Address & aDestination,
ProtocolInterface & aProtocol,
bool aNotifyObserver = true )
virtual

Finally, we must check any removed link to ensure it isn't the gateway. If it is the gateway, then we will provide a warning and clear the gateway, as it is no longer viable.

◆ RemoveNode()

bool wsf::comm::router::Router::RemoveNode ( double aSimTime,
const Address & aNodeAddress,
ProtocolInterface & aProtocol,
bool aNotifyObserver = true )
virtual

Check for existence of node in graph.

Node exists. Remove all incoming and outgoing edges. Track the existing edges first, so we can notify the observer after the fact and track applicable local event logging.

Remove the node itself.

◆ Send()

bool wsf::comm::router::Router::Send ( double aSimTime,
SendData & aData )
virtual

Ensure the gateway specified isn't the potential sender when this message is not originated from that sender.

◆ SetGateway()

◆ SetHopLimit()

void wsf::comm::router::Router::SetHopLimit ( size_t aHopLimit)
inline

◆ SetNonOperational()

void wsf::comm::router::Router::SetNonOperational ( double aSimTime)
overridevirtual

Set the system status as Non-Operational.

Parameters
aSimTimeThe current simulation time.

Reimplemented from WsfPlatformPart.

◆ SetOperational()

void wsf::comm::router::Router::SetOperational ( double aSimTime)
overridevirtual

Set the system status as Operational.

Parameters
aSimTimeThe current simulation time.

Reimplemented from WsfPlatformPart.

◆ Setup()

◆ SetUpdateInterval()

void wsf::comm::router::Router::SetUpdateInterval ( double aUpdateInterval)
inlineoverridevirtual

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.

◆ TurnOff()

void wsf::comm::router::Router::TurnOff ( double aSimTime)
overridevirtual

Turn off the platform part (system).

Parameters
aSimTimeThe current simulation time.

Reimplemented from WsfPlatformPart.

◆ TurnOn()

void wsf::comm::router::Router::TurnOn ( double aSimTime)
overridevirtual

Turn on the platform part (system).

Parameters
aSimTimeThe current simulation time.

Reimplemented from WsfPlatformPart.

◆ ValidateGateway()

bool wsf::comm::router::Router::ValidateGateway ( )
protectedvirtual

Helper method for determining if user set values indicate a valid gateway. Returns true if valid, or if the gateway was not set.


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