12#ifndef WSFEXTERNALLINKS_HPP
13#define WSFEXTERNALLINKS_HPP
15#include "wsf_export.h"
18#include <unordered_set>
22#include "UtTypeTraits.hpp"
74 using LinkVec = std::vector<ExternalLink>;
77 using CommPair = std::pair<WsfStringId, WsfStringId>;
108 return (std::hash<WsfStringId>()(aKey.first) * 3 + std::hash<WsfStringId>()(aKey.second) * 7);
117 return ((std::hash<WsfStringId>()(aKey.
mChainName)) * 3 ^
118 (
static_cast<ut::underlying_type_t<CommandChainRecipient>
>(aKey.
mReportType)) ^
119 (std::hash<WsfStringId>()(aKey.
mRcvrName))) *
127 using CommandSet = std::unordered_set<CommandChainTarget, CommandHash>;
128 using CommSet = std::unordered_set<CommPair, CommPairHash>;
174 bool Initialize(
double aSimTime,
WsfPlatform* aPlatformPtr);
176 bool ProcessInput(UtInput& aInput);
177 bool CommandChainCommand(
const std::string& aCommand, CommandChainRecipient& aReportType);
180 void SendMessage(
double aSimTime,
const WsfMessage& aMessage);
193 bool AddRecipient(
WsfStringId aXmtrName,
const CommandChainTarget& aCommandChainTarget);
194 bool AddRecipient(
WsfStringId aXmtrName,
const CommPair& aCommPair);
197 bool RemoveRecipient(
WsfStringId aXmtrName,
const CommandChainTarget& aCommandChainTarget);
198 bool RemoveRecipient(
WsfStringId aXmtrName,
const CommPair& aCommPair);
200 void DeleteAllRecipients();
204 size_t GetRecipientCount()
const;
205 size_t GetRecipientCount(
WsfStringId aXmtrName)
const;
wsf::comm::Address Address
Definition WsfScriptCommRouterClass.cpp:29
UtStringId WsfStringId
WsfStringId – the same thing as UtStringId.
Definition WsfStringId.hpp:23
#define WSF_EXPORT
Definition WsfXIO_Export.hpp:35
A base class for messages sent among simulation communication objects, processors and sensors.
Definition WsfMessage.hpp:33
The main controller for a simulation.
Definition WsfSimulation.hpp:109
Definition WsfExternalLinks.hpp:98
bool RemoveAddressRecipient(const Address &aAddress)
Definition WsfExternalLinks.cpp:54
bool AddCommRecipient(const CommPair &aCommPair)
Definition WsfExternalLinks.cpp:48
AddressSet mAddressRecipients
Definition WsfExternalLinks.hpp:162
size_t GetRecipientCount() const
Definition WsfExternalLinks.cpp:261
std::unordered_set< CommandChainTarget, CommandHash > CommandSet
Definition WsfExternalLinks.hpp:127
void DeleteAllRecipients()
Definition WsfExternalLinks.cpp:78
bool RemoveGroupRecipient(WsfStringId aGroupName)
Definition WsfExternalLinks.cpp:60
WsfStringSet mGroups
Definition WsfExternalLinks.hpp:163
void SetParent(ExternalLinks *aParentPtr)
Definition WsfExternalLinks.hpp:158
bool RemoveCommandRecipient(const CommandChainTarget &aCommandChainTarget)
Definition WsfExternalLinks.cpp:66
std::unordered_set< WsfStringId > WsfStringSet
Definition WsfExternalLinks.hpp:126
WsfStringId GetXmtrName() const
Definition WsfExternalLinks.hpp:156
CommandSet mCommandRecipients
Definition WsfExternalLinks.hpp:164
std::unordered_set< CommPair, CommPairHash > CommSet
Definition WsfExternalLinks.hpp:128
bool AddGroupRecipient(WsfStringId aGroupName)
Definition WsfExternalLinks.cpp:36
std::unordered_set< Address > AddressSet
Definition WsfExternalLinks.hpp:125
bool RemoveCommRecipient(const CommPair &aCommPair)
Definition WsfExternalLinks.cpp:72
AddressVec GetRecipients(bool aNotify=false) const
Definition WsfExternalLinks.cpp:87
ExternalLinks * mParentPtr
Definition WsfExternalLinks.hpp:166
CommSet mCommRecipients
Definition WsfExternalLinks.hpp:165
comm::Comm * GetXmtr() const
Definition WsfExternalLinks.cpp:250
virtual ~ExternalLink()=default
WsfStringId mXmtrName
Definition WsfExternalLinks.hpp:161
bool AddCommandRecipient(const CommandChainTarget &aCommandChainTarget)
Definition WsfExternalLinks.cpp:42
bool AddAddressRecipient(const Address &aAddress)
Definition WsfExternalLinks.cpp:30
void SetXmtrName(WsfStringId aXmtrName)
Definition WsfExternalLinks.hpp:157
WsfPlatform * GetPlatform() const
Definition WsfExternalLinks.hpp:187
virtual ~ExternalLinks()=default
LinkVec::const_iterator LinkConstIt
Definition WsfExternalLinks.hpp:76
std::vector< ExternalLink > LinkVec
Definition WsfExternalLinks.hpp:74
std::vector< Address > AddressVec
Definition WsfExternalLinks.hpp:78
std::pair< WsfStringId, WsfStringId > CommPair
Definition WsfExternalLinks.hpp:77
comm::Address Address
Definition WsfExternalLinks.hpp:73
LinkVec::iterator LinkIt
Definition WsfExternalLinks.hpp:75
WsfPlatform * mPlatformPtr
Definition WsfExternalLinks.hpp:216
bool mDebug
Definition WsfExternalLinks.hpp:217
size_t GetLinkCount() const
Definition WsfExternalLinks.hpp:208
CommandChainRecipient
Definition WsfExternalLinks.hpp:65
bool HasLinks() const
Definition WsfExternalLinks.hpp:172
LinkVec mLinks
Definition WsfExternalLinks.hpp:215
ExternalLink & GetLink(size_t aIndex)
Definition WsfExternalLinks.hpp:209
Definition WsfCommAddress.hpp:57
Definition WsfComm.hpp:43
Definition WsfComm.cpp:34
Function definitions for those who need run-time access to the version.
Definition WsfComm.cpp:32
Definition WsfExternalLinks.hpp:81
WsfStringId mChainName
Definition WsfExternalLinks.hpp:82
bool operator==(const CommandChainTarget &aRhs) const
Definition WsfExternalLinks.hpp:86
CommandChainRecipient mReportType
Definition WsfExternalLinks.hpp:83
WsfStringId mRcvrName
Definition WsfExternalLinks.hpp:84
Definition WsfExternalLinks.hpp:104
size_t operator()(const CommPair &aKey) const
Definition WsfExternalLinks.hpp:105
Definition WsfExternalLinks.hpp:113
size_t operator()(const CommandChainTarget &aKey) const
Definition WsfExternalLinks.hpp:114