WSF
wsf::comm::NetworkRing Class Reference

#include <WsfCommNetworkRing.hpp>

Inheritance diagram for wsf::comm::NetworkRing:
Collaboration diagram for wsf::comm::NetworkRing:

Public Member Functions

 NetworkRing ()=default
 NetworkRing (const std::string &aNetworkName, const Address &aAddress)
 ~NetworkRing () override=default
NetworkRingoperator= (const NetworkRing &aRhs)=default
bool ProcessInput (UtInput &aInput) override
NetworkRingClone () 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
virtual bool Initialize (WsfSimulation &aSim)
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 InitializeLinkageP (WsfSimulation &aSimulation) override
bool AddMemberP (const Address &aAddress, WsfSimulation &aSimulation, const Address &aOptionalAddress=Address()) override
bool RemoveMemberP (const Address &aAddress, WsfSimulation &aSimulation, const Address &aOptionalAddress=Address()) override
virtual bool AddLinkP (const Address &aSourceAddress, const Address &aDestinationAddress, WsfSimulation &aSimulation, const Address &aOptionalAddress=Address())
virtual bool RemoveLinkP (const Address &aSourceAddress, const Address &aDestinationAddress, 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

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

A network implementation, where all members have bi-directional linkage to two other unique members in the network.

Note
If at least three comms are not defined by the user, this network will not establish its links.

Constructor & Destructor Documentation

◆ NetworkRing() [1/2]

wsf::comm::NetworkRing::NetworkRing ( )
default

◆ NetworkRing() [2/2]

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

◆ ~NetworkRing()

wsf::comm::NetworkRing::~NetworkRing ( )
overridedefault

Member Function Documentation

◆ AddMemberP()

bool wsf::comm::NetworkRing::AddMemberP ( const Address & aAddress,
WsfSimulation & aSimulation,
const Address & aOptionalAddress = Address() )
overrideprotectedvirtual

It takes at least three members to make this topology.

If the pending size is 3 (current size == 2), then we currently don't have any links in this network, and need to establish links for all members, not just the currently added member. (Note - This will only occur during runtime, as either there are sufficient members to establish linkage or not at initialization - this is a condition of members being added or removed during a simulation run.)

The ring is established, add this member to the "end" of the ring. Since this is an "incremental" add, we have to delete links where we insert the new member.

A special insertion location has been specified and located. If the location isn't at the end (where we ordinarily insert), then handle it, otherwise continue processing at the "end" of the ring.

Insert the new member at the "end" of the ring.

Reimplemented from wsf::comm::Network.

References WsfSimulation::GetCommNetworkManager(), WsfSimulation::GetSimTime(), wsf::comm::Network::mAddressList, ok, and simTime.

◆ Clone()

NetworkRing * wsf::comm::NetworkRing::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 NetworkRing().

Referenced by operator=().

◆ GetScriptClassName()

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

◆ InitializeLinkageP()

bool wsf::comm::NetworkRing::InitializeLinkageP ( WsfSimulation & aSimulation)
overrideprotectedvirtual

Linkage initialized by this implementation will order the members of the ring by the order in which they were processed via ProcessInput(). Thus, the order in which the user lists members matters in this case. For programmatic or script method control of addition or removal at specific locations, see the Add/RemoveMemberRing methods.

No linkage necessary for insufficient members.

Note: We don't incrementally add the members one at a time in the ring topology to avoid creating and removing links with every add. This will either cause a bunch of output we don't want, or we have to suppress it, neither of which is favorable. Instead, we'll just do it all here in one pass if the minimum conditions are correct, so that event output actually reflects the true state of the network without a bunch of noise.

Complete the ring by connecting the first and last members.

Reimplemented from wsf::comm::Network.

References WsfSimulation::GetCommNetworkManager(), WsfSimulation::GetSimTime(), wsf::comm::Network::mAddressList, ok, and simTime.

◆ operator=()

NetworkRing & wsf::comm::NetworkRing::operator= ( const NetworkRing & aRhs)
default

◆ ProcessInput()

bool wsf::comm::NetworkRing::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 wsf::comm::Network::mAddress, wsf::comm::Network::ProcessAddressListInput(), wsf::comm::Address::ProcessInput(), and wsf::comm::Network::ProcessNamedListInput().

Referenced by operator=().

◆ RemoveMemberP()

bool wsf::comm::NetworkRing::RemoveMemberP ( const Address & aAddress,
WsfSimulation & aSimulation,
const Address & aOptionalAddress = Address() )
overrideprotectedvirtual

No links to remove is size is already less than 3

If the size is exactly 3, we lose all linkage.

Remove the member and its connections, and add connections between adjacent members.

The removed member is at the "end" of the ring.

Re-connect

The removed member is at the "beginning" of the ring.

Re-connect

Re-connect

Reimplemented from wsf::comm::Network.

References WsfSimulation::GetCommNetworkManager(), WsfSimulation::GetSimTime(), wsf::comm::Network::mAddressList, ok, and simTime.


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