WSF
wsf::comm::NetworkAdHoc Class Reference

#include <WsfCommNetworkAdHoc.hpp>

Inheritance diagram for wsf::comm::NetworkAdHoc:
Collaboration diagram for wsf::comm::NetworkAdHoc:

Public Types

using NamedRateMap = std::unordered_map<NamedComm, WsfRandomVariable>
using AddressRateMap = std::unordered_map<Address, WsfRandomVariable>
Public Types inherited from wsf::comm::Network
using AddressList = std::vector<Address>
using AddressLinkList = std::vector<std::pair<Address, Address>>
using NamedList = std::vector<NamedComm>
using NamedLinkList = std::vector<std::pair<NamedComm, NamedComm>>
Public Types inherited from WsfObject
typedef std::vector< WsfStringIdTypeList
 The list of types returned by GetTypeList.

Public Member Functions

 NetworkAdHoc ()=default
 ~NetworkAdHoc () override=default
 NetworkAdHoc (const NetworkAdHoc &aSrc)
NetworkAdHocoperator= (const NetworkAdHoc &aRhs)
 NetworkAdHoc (const std::string &aNetworkName, const Address &aAddress)
bool ProcessInput (UtInput &aInput) override
NetworkAdHocClone () const override
const char * GetScriptClassName () const override
bool Initialize (WsfSimulation &aSim) override
void ChangeRate (WsfSimulation &aSim, const WsfRandomVariable &aRate)
void AddNamedRate (const NamedComm &aComm, const WsfRandomVariable &aRate, WsfSimulation *aSimPtr=nullptr)
void AddAddressRate (const Address &aAddress, const WsfRandomVariable &aRate, WsfSimulation *aSimPtr=nullptr)
bool RemoveNamedRate (const NamedComm &aComm)
bool RemoveAddressRate (const Address &aAddress)
WsfRandomVariableGetNamedRate (const NamedComm &aComm)
WsfRandomVariableGetAddressRate (const Address &aAddress)
Public Member Functions inherited from wsf::comm::NetworkGeneric
 NetworkGeneric ()=default
 NetworkGeneric (const std::string &aNetworkName, const Address &aAddress)
 ~NetworkGeneric () override=default
 NetworkGeneric (const NetworkGeneric &aSrc)=default
NetworkGenericoperator= (const NetworkGeneric &aRhs)=default
 NetworkGeneric (NetworkGeneric &&aRhs)=default
bool ProcessInput (UtInput &aInput) override
NetworkGenericClone () const override
const char * GetScriptClassName () const override
Public Member Functions inherited from wsf::comm::Network
 Network ()=default
 ~Network () override=default
 Network (const std::string &aNetworkName, const Address &aAddress)
 Network (const Network &aSrc)=default
Networkoperator= (const Network &aRhs)=default
 Network (Network &&aSrc)=default
bool InitializeLinkage (WsfSimulation &aSimulation)
const char * GetScriptClassName () const override
bool AddMember (const Address &aAddress, WsfSimulation &aSimulation, const Address &aOptionalAddress=Address())
bool RemoveMember (const Address &aAddress, WsfSimulation &aSimulation, const Address &aOptionalAddress=Address())
bool AddLink (const Address &aSourceAddress, const Address &aDestinationAddress, WsfSimulation &aSimulation, const Address &aOptionalAddress=Address())
bool RemoveLink (const Address &aSourceAddress, const Address &aDestinationAddress, WsfSimulation &aSimulation, const Address &aOptionalAddress=Address())
void SetAddress (const Address &aAddress)
void SetIsManaged (bool aManaged)
const AddressGetAddress () const
size_t GetHostsMax () const
bool IsManaged () const
const NamedListGetNamedMemberList () const
bool HasMember (const Address &aAddress) const
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)

Protected Member Functions

bool ProcessNamedRate (UtInput &aInput)
 Input methods for member-specific update rates.
bool ProcessAddressRate (UtInput &aInput)
void Update (WsfSimulation &aSim)
void Update (WsfSimulation &aSim, const NamedComm &aComm)
void Update (WsfSimulation &aSim, const Address &aAddress)
Protected Member Functions inherited from wsf::comm::NetworkGeneric
bool InitializeLinkageP (WsfSimulation &aSimulation) override
bool AddLinkP (const Address &aSourceAddress, const Address &aDestinationAddress, WsfSimulation &aSimulation, const Address &aOptionalAddress=Address()) override
bool RemoveLinkP (const Address &aSourceAddress, const Address &aDestinationAddress, WsfSimulation &aSimulation, const Address &aOptionalAddress=Address()) override
bool RemoveMemberP (const Address &aAddress, WsfSimulation &aSimulation, const Address &aOptionalAddress=Address()) override
virtual bool AddMemberP (const Address &aAddress, WsfSimulation &aSimulation, const Address &aOptionalAddress=Address())
virtual bool ProcessAddressListInput (UtInput &aInput)
virtual bool ProcessAddressLinkListInput (UtInput &aInput)
virtual bool ProcessNamedListInput (UtInput &aInput)
virtual bool ProcessNamedLinkListInput (UtInput &aInput)
 WsfObject (const WsfObject &aSrc)
 Copy constructor (for Clone()).

Additional Inherited Members

static Address GetAddressFromNamedComm (WsfStringId aPlatformName, WsfStringId aCommName, WsfSimulation &aSimulation)
Address mAddress {}
AddressList mAddressList {}
AddressList mInputAddressList {}
AddressLinkList mAddressLinkList {}
AddressLinkList mInputAddressLinkList {}
 Same case as "mInputAddressList" above, except with link definitions.
NamedList mNamedList {}
NamedLinkList mNamedLinkList {}
bool mManaged {false}
 True if this network is being managed by the simulation.

Detailed Description

NetworkAdHoc is a network type that, like the generic network, has no specific topology associated with it. However, this network type can alter the truth based (network manager) links within the network during the simulation run based on the query of comm model implementation dependent checks on connectivity with peers (via Comm::CanSendTo()). Thus, this network type dynamically updates the simulation truth state during runtime.

Note that this is not a replacement for a formal ad-hoc routing protocol. Such protocols are generally reactive based on the discovery (and loss of connectivity) of other nodes, and as such this network type can drive such a protocol.

Member Typedef Documentation

◆ AddressRateMap

◆ NamedRateMap

These definitions provide the containers used to associate update rates for specific members in the network. They can be provided either via a named comm pair, or an address. An update rate for a specific member overrides the generic update rate.

Constructor & Destructor Documentation

◆ NetworkAdHoc() [1/3]

wsf::comm::NetworkAdHoc::NetworkAdHoc ( )
default

◆ ~NetworkAdHoc()

wsf::comm::NetworkAdHoc::~NetworkAdHoc ( )
overridedefault

◆ NetworkAdHoc() [2/3]

wsf::comm::NetworkAdHoc::NetworkAdHoc ( const NetworkAdHoc & aSrc)

◆ NetworkAdHoc() [3/3]

wsf::comm::NetworkAdHoc::NetworkAdHoc ( const std::string & aNetworkName,
const Address & aAddress )

Member Function Documentation

◆ AddAddressRate()

void wsf::comm::NetworkAdHoc::AddAddressRate ( const Address & aAddress,
const WsfRandomVariable & aRate,
WsfSimulation * aSimPtr = nullptr )

◆ AddNamedRate()

void wsf::comm::NetworkAdHoc::AddNamedRate ( const NamedComm & aComm,
const WsfRandomVariable & aRate,
WsfSimulation * aSimPtr = nullptr )

Mutators for member-specific rate containers Returns true if add/remove operation successful Presence of optional simulation pointer indicates the need to schedule the event.

References WsfSimulation::AddEvent(), WsfSimulation::GetSimTime(), and Update().

Referenced by ProcessNamedRate().

◆ ChangeRate()

void wsf::comm::NetworkAdHoc::ChangeRate ( WsfSimulation & aSim,
const WsfRandomVariable & aRate )

Change the update rate Note: This only occurs after the next update. If the update rate is set to never fire, this will schedule the first update event from the time of this call.

References WsfSimulation::AddEvent(), WsfSimulation::GetSimTime(), WsfRandomVariable::SetGenerator(), and Update().

◆ Clone()

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

Reimplemented from wsf::comm::Network.

References NetworkAdHoc().

Referenced by ~NetworkAdHoc().

◆ GetAddressRate()

WsfRandomVariable * wsf::comm::NetworkAdHoc::GetAddressRate ( const Address & aAddress)

Referenced by Update().

◆ GetNamedRate()

WsfRandomVariable * wsf::comm::NetworkAdHoc::GetNamedRate ( const NamedComm & aComm)

Find methods for specified member rate Returns nullptr if rate is not found

Referenced by Update().

◆ GetScriptClassName()

const char * wsf::comm::NetworkAdHoc::GetScriptClassName ( ) const
inlineoverride

◆ Initialize()

bool wsf::comm::NetworkAdHoc::Initialize ( WsfSimulation & aSim)
overridevirtual

◆ operator=()

NetworkAdHoc & wsf::comm::NetworkAdHoc::operator= ( const NetworkAdHoc & aRhs)

◆ ProcessAddressRate()

bool wsf::comm::NetworkAdHoc::ProcessAddressRate ( UtInput & aInput)
protected

◆ ProcessInput()

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

Reimplemented from wsf::comm::Network.

References ProcessAddressRate(), wsf::comm::NetworkGeneric::ProcessInput(), and ProcessNamedRate().

Referenced by ~NetworkAdHoc().

◆ ProcessNamedRate()

bool wsf::comm::NetworkAdHoc::ProcessNamedRate ( UtInput & aInput)
protected

◆ RemoveAddressRate()

bool wsf::comm::NetworkAdHoc::RemoveAddressRate ( const Address & aAddress)

Referenced by ProcessAddressRate().

◆ RemoveNamedRate()

bool wsf::comm::NetworkAdHoc::RemoveNamedRate ( const NamedComm & aComm)

Referenced by ProcessNamedRate().

◆ Update() [1/3]

void wsf::comm::NetworkAdHoc::Update ( WsfSimulation & aSim)
protected

Update Methods These methods drive the connectivity updates for the network. The Update method with only the sim parameter is called for the generic update interval, while each member that has a specified rate uses the appropriate Update call. These methods are only called from within the class at appropriate times (via a scheduled event) and will reschedule the event as necessary.

References WsfSimulation::AddEvent(), wsf::comm::Network::AddLink(), GetAddressRate(), wsf::comm::NetworkManager::GetComm(), WsfSimulation::GetCommNetworkManager(), GetNamedRate(), WsfSimulation::GetSimTime(), wsf::comm::Network::mAddressList, wsf::comm::Network::RemoveLink(), and Update().

Referenced by AddAddressRate(), AddNamedRate(), ChangeRate(), Initialize(), Update(), Update(), and Update().

◆ Update() [2/3]

◆ Update() [3/3]


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