WSF
wsf::ExternalLinks Class Reference

#include <WsfExternalLinks.hpp>

Collaboration diagram for wsf::ExternalLinks:

Classes

struct  CommandChainTarget

Public Types

enum class  CommandChainRecipient : unsigned int { cCOMMANDER , cSUBORDINATES , cPEERS , cNONE }
using Address = comm::Address
using LinkVec = std::vector<ExternalLink>
using LinkIt = LinkVec::iterator
using LinkConstIt = LinkVec::const_iterator
using CommPair = std::pair<WsfStringId, WsfStringId>
using AddressVec = std::vector<Address>

Public Member Functions

 ExternalLinks ()=default
virtual ~ExternalLinks ()=default
bool HasLinks () const
bool Initialize (double aSimTime, WsfPlatform *aPlatformPtr)
bool ProcessInput (UtInput &aInput)
bool CommandChainCommand (const std::string &aCommand, CommandChainRecipient &aReportType)
void SendMessage (double aSimTime, const WsfMessage &aMessage)
void SendMessage (double aSimTime, const WsfMessage &aMessage, WsfStringId aExcludedPlatformName)
WsfSimulationGetSimulation () const
WsfPlatformGetPlatform () const

Recipient management methods.

LinkVec mLinks {}
WsfPlatformmPlatformPtr {nullptr}
bool mDebug {false}
bool AddRecipient (WsfStringId aXmtrName, const Address &aRcvrAddress)
bool AddRecipient (WsfStringId aXmtrName, WsfStringId aCommGroupName)
bool AddRecipient (WsfStringId aXmtrName, const CommandChainTarget &aCommandChainTarget)
bool AddRecipient (WsfStringId aXmtrName, const CommPair &aCommPair)
bool RemoveRecipient (WsfStringId aXmtrName, const Address &aRcvrAddress)
bool RemoveRecipient (WsfStringId aXmtrName, WsfStringId aCommGroupName)
bool RemoveRecipient (WsfStringId aXmtrName, const CommandChainTarget &aCommandChainTarget)
bool RemoveRecipient (WsfStringId aXmtrName, const CommPair &aCommPair)
void DeleteAllRecipients ()
size_t GetRecipientCount () const
size_t GetRecipientCount (WsfStringId aXmtrName) const
size_t GetLinkCount () const
ExternalLinkGetLink (size_t aIndex)
LinkIt FindLink (WsfStringId aXmtrName)
LinkConstIt FindLink (WsfStringId aXmtrName) const

Detailed Description

The external link object is a standardized API for designating how an object (typically a platform component) communicates. Any communication between objects in AFSIM that are not local to the same platform are considered external, and require the usage of this object (along with appropriate communication modeling) to enable the transmission and reception of data using an external link. As such, external links do NOT define new linkage between comm objects in AFSIM, but SPECIFY the endpoints of communication to be used to transfer information. Note that what data is sent is based on the implementation of the sending object utilizing external linkage.

Note that this class does NOT handle transfer of data local to a platform, (beyond the initial transfer of data to the sending comm) as this is handled by the Internal Link object. Thus, if a user wishes any data received by a comm device to be forwarded to a specific platform component locally, the user should use this class in conjunction with internal links to forward the data to the correct local component.

External linkage requires a single transmitter, and one or more receivers (comm objects). Comm objects may be identified in multiple ways, such as a WsfComm object reference, a platform name / comm name pair, or comm address. Multiple receivers may be specified as well, by using the intrinsic comm functionality available via broadcasting, multicasting (if available), or via specification of multiple comm objects via a WsfGroup object. In the case of using a WsfGroup object of comm receivers, the method of comm transport of such messages is multiple unicast transmissions.

Note: This class has been modified to utilize the changes to the AFSIM comms framework. Previously, it was sufficient to use the command chain to specify the target of a transmission. This is too ambiguous now, and has modified. While one may still use such commands to specify a particular set of platforms to send to, a commonly named comm must also be specified (that is consistent) across all members of the command chain to continue using command chains in this way.

Member Typedef Documentation

◆ Address

◆ AddressVec

◆ CommPair

◆ LinkConstIt

using wsf::ExternalLinks::LinkConstIt = LinkVec::const_iterator

◆ LinkIt

using wsf::ExternalLinks::LinkIt = LinkVec::iterator

◆ LinkVec

Member Enumeration Documentation

◆ CommandChainRecipient

enum class wsf::ExternalLinks::CommandChainRecipient : unsigned int
strong
Enumerator
cCOMMANDER 
cSUBORDINATES 
cPEERS 
cNONE 

Constructor & Destructor Documentation

◆ ExternalLinks()

wsf::ExternalLinks::ExternalLinks ( )
default

◆ ~ExternalLinks()

virtual wsf::ExternalLinks::~ExternalLinks ( )
virtualdefault

Member Function Documentation

◆ AddRecipient() [1/4]

bool wsf::ExternalLinks::AddRecipient ( WsfStringId aXmtrName,
const Address & aRcvrAddress )

◆ AddRecipient() [2/4]

bool wsf::ExternalLinks::AddRecipient ( WsfStringId aXmtrName,
const CommandChainTarget & aCommandChainTarget )

◆ AddRecipient() [3/4]

bool wsf::ExternalLinks::AddRecipient ( WsfStringId aXmtrName,
const CommPair & aCommPair )

◆ AddRecipient() [4/4]

bool wsf::ExternalLinks::AddRecipient ( WsfStringId aXmtrName,
WsfStringId aCommGroupName )

◆ CommandChainCommand()

bool wsf::ExternalLinks::CommandChainCommand ( const std::string & aCommand,
CommandChainRecipient & aReportType )

References cCOMMANDER, cNONE, cPEERS, and cSUBORDINATES.

Referenced by ProcessInput().

◆ DeleteAllRecipients()

void wsf::ExternalLinks::DeleteAllRecipients ( )

References mLinks.

Referenced by ProcessInput().

◆ FindLink() [1/2]

◆ FindLink() [2/2]

ExternalLinks::LinkConstIt wsf::ExternalLinks::FindLink ( WsfStringId aXmtrName) const
protected

References ExternalLinks().

◆ GetLink()

ExternalLink & wsf::ExternalLinks::GetLink ( size_t aIndex)
inline

References mLinks.

Referenced by getLinkedAndReachablePlatformParts().

◆ GetLinkCount()

size_t wsf::ExternalLinks::GetLinkCount ( ) const
inline

References mLinks.

Referenced by getLinkedAndReachablePlatformParts().

◆ GetPlatform()

WsfPlatform * wsf::ExternalLinks::GetPlatform ( ) const
inline

References mPlatformPtr.

Referenced by SendMessage(), and SendMessage().

◆ GetRecipientCount() [1/2]

size_t wsf::ExternalLinks::GetRecipientCount ( ) const

Note: Do not use these calls prior to simulation pending start. They require full initialization of the comm framework to resolve addressing.

References mLinks.

◆ GetRecipientCount() [2/2]

size_t wsf::ExternalLinks::GetRecipientCount ( WsfStringId aXmtrName) const

References FindLink(), and mLinks.

◆ GetSimulation()

WsfSimulation * wsf::ExternalLinks::GetSimulation ( ) const

References mPlatformPtr.

Referenced by SendMessage().

◆ HasLinks()

bool wsf::ExternalLinks::HasLinks ( ) const
inline

◆ Initialize()

bool wsf::ExternalLinks::Initialize ( double aSimTime,
WsfPlatform * aPlatformPtr )

Ensure that any and all links have valid transmitters.

We won't check for actual existence of any addresses, command chains, or groups. These objects may not be available during initialization, or may be dynamic in nature.

References mLinks, mPlatformPtr, and ok.

◆ ProcessInput()

bool wsf::ExternalLinks::ProcessInput ( UtInput & aInput)

Multiple versions of the report_to/external_link command may be used, depending on how the user wishes to ultimately designate which comm device the message gets sent to. The difference is that comms now require an explicit target receiver for all transmissions, and will not accept ambiguous targets (such as a platform, since it may have multiple comms). The input has changed slightly to reflect this, while attempting to minimize changes to the greatest extent possible. The updates are as follows: A. Command chains may still be used to designate the target platform. However, the transmitter is now required to be named (using the 'via' token, as was done previously). In addition, comms require a target receiver be named for a destination. This may be explicitly named by using the 'to' token, or it is assumed implicitly to be the same name as the transmitter. B. Groups of platforms are no longer sufficient as recipients. These are now replaced by groups of comms. C. Linkage now has the added capability to be specified by a platform-name comm-name pair, or via specifying a specific address. Using an address as the link target allows for non-standard methods of reporting, such that an appropriate broadcast or multicast address will result in those methods being used for external link message transmissions (as opposed to unicast).

  1. [external_link | report_to] [ command_chain <cmd-chain-name> ] [commander | peers | subordinates] [ via <xmtr-name> ] [ to <rcvr-name> ]
  2. [report_to_group] <group-name> [ via <xmtr-name> ]
  3. [external_link | report_to] [ platform <platform-name> ] [ comm <comm-name> ] [ via <xmtr-name> ]
  4. [external_link | report_to] [ address <comm-address> ] [ via <xmtr-name> ]

References AddRecipient(), cNONE, CommandChainCommand(), DeleteAllRecipients(), wsf::ExternalLinks::CommandChainTarget::mChainName, mDebug, wsf::ExternalLinks::CommandChainTarget::mRcvrName, wsf::ExternalLinks::CommandChainTarget::mReportType, and wsf::comm::Address::ProcessInput().

Referenced by WsfMessageProcessor::Action::ProcessInput().

◆ RemoveRecipient() [1/4]

bool wsf::ExternalLinks::RemoveRecipient ( WsfStringId aXmtrName,
const Address & aRcvrAddress )

References FindLink(), and mLinks.

◆ RemoveRecipient() [2/4]

bool wsf::ExternalLinks::RemoveRecipient ( WsfStringId aXmtrName,
const CommandChainTarget & aCommandChainTarget )

References FindLink(), and mLinks.

◆ RemoveRecipient() [3/4]

bool wsf::ExternalLinks::RemoveRecipient ( WsfStringId aXmtrName,
const CommPair & aCommPair )

References FindLink(), and mLinks.

◆ RemoveRecipient() [4/4]

bool wsf::ExternalLinks::RemoveRecipient ( WsfStringId aXmtrName,
WsfStringId aCommGroupName )

References FindLink(), and mLinks.

◆ SendMessage() [1/2]

void wsf::ExternalLinks::SendMessage ( double aSimTime,
const WsfMessage & aMessage )

◆ SendMessage() [2/2]

void wsf::ExternalLinks::SendMessage ( double aSimTime,
const WsfMessage & aMessage,
WsfStringId aExcludedPlatformName )

Legacy method used by the track manager to avoid reporting tracks back to the last contributor.

References WsfSimulation::GetCommNetworkManager(), WsfObject::GetName(), GetPlatform(), WsfSimulation::GetPlatformByName(), GetSimulation(), mDebug, mLinks, and SendMessage().

Member Data Documentation

◆ mDebug

bool wsf::ExternalLinks::mDebug {false}
protected

◆ mLinks

◆ mPlatformPtr

WsfPlatform* wsf::ExternalLinks::mPlatformPtr {nullptr}
protected

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