WSF
wsf::comm::Network Class Reference

#include <WsfCommNetwork.hpp>

Inheritance diagram for wsf::comm::Network:
Collaboration diagram for wsf::comm::Network:

Classes

struct  NamedComm

Public Types

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

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

Add/Remove Implementation Behavior Methods

These methods allow implementations to add functionality to the base add/remove methods.

Note
These methods are called after container actions have been completed (add/remove), in an assumptive "true" state in the public method call. Thus, the implementation may undo these changes and return a different value. In addition, these methods are required for correct establishment of linkage, as they should notify the network manager to create the necessary linkage so that implementation details are local.
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.
virtual bool AddMemberP (const Address &aAddress, WsfSimulation &aSimulation, const Address &aOptionalAddress=Address())
virtual bool RemoveMemberP (const Address &aAddress, WsfSimulation &aSimulation, const Address &aOptionalAddress=Address())
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())

InitializeLinkage

Required method for creating links for this particular network topology. This class only converts named comms to addresses. Implementations should use the protected version for implementing their behavior.

bool InitializeLinkage (WsfSimulation &aSimulation)
bool ProcessInput (UtInput &aInput) override
NetworkClone () const override
const char * GetScriptClassName () const override
virtual bool Initialize (WsfSimulation &aSim)

Remove/Add Public Methods

These methods are the interface accessible methods for adding/removing to the network. These base methods only add/remove to the applicable container depending on the implementation specific call of the same name. The optional address parameter is included for passage of an additional address via the Network interface that may or may not be used on by various implementations.

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())

Update method

This method is called when a re-evaluation of linkage should occur within the network topology. This is useful on special network implementations where linkage isn't solely defined on membership or edge definitions, i.e. add-hoc networking. The derived member implementations should define the logic for establishment/removal of linkage via the protected version of this method.

void SetAddress (const Address &aAddress)
void SetIsManaged (bool aManaged)
const AddressGetAddress () const
size_t GetHostsMax () const
bool IsManaged () const

GetNamedMemberList

This method returns the named member list for this network, as provided by user input with the network type definition. These members must be available for external inspection (namely by the network manager) so that any associated comm interface can have its definition modified to specify inclusion into this network, otherwise it may be incorrectly assigned elsewhere (default network). This isn't required for other member types, as they are static and indicate network membership directly with the address itself.

const NamedListGetNamedMemberList () const

HasMember

Checks for existence of address in network. Should only be used during runtime/after comm framework is initialized.

bool HasMember (const Address &aAddress) const
virtual bool InitializeLinkageP (WsfSimulation &aSimulation)

GetAddressFromNamedComm

Helper method for obtaining an address from a named comm. This is provided as a public member for conversion of named platform/comms to the address interface used by the the network object.

static Address GetAddressFromNamedComm (WsfStringId aPlatformName, WsfStringId aCommName, WsfSimulation &aSimulation)

ProcessInput helper methods

These methods parse input based on the particular container they are applicable to. These are provided for individual usage as indicated by implementation.

virtual bool ProcessAddressListInput (UtInput &aInput)
virtual bool ProcessAddressLinkListInput (UtInput &aInput)
virtual bool ProcessNamedListInput (UtInput &aInput)
virtual bool ProcessNamedLinkListInput (UtInput &aInput)

Additional Inherited Members

 WsfObject (const WsfObject &aSrc)
 Copy constructor (for Clone()).

Member Typedef Documentation

◆ AddressLinkList

using wsf::comm::Network::AddressLinkList = std::vector<std::pair<Address, Address>>

◆ AddressList

◆ NamedLinkList

using wsf::comm::Network::NamedLinkList = std::vector<std::pair<NamedComm, NamedComm>>

◆ NamedList

Constructor & Destructor Documentation

◆ Network() [1/4]

wsf::comm::Network::Network ( )
default

Need to provide a default constructor for instantiation prior to address provisioning. Setters need to be called on Network objects created this way prior to usage.

Referenced by Clone(), Network(), Network(), wsf::comm::NetworkGeneric::NetworkGeneric(), wsf::comm::NetworkMesh::NetworkMesh(), wsf::comm::NetworkPointToPoint::NetworkPointToPoint(), wsf::comm::NetworkRing::NetworkRing(), wsf::comm::NetworkStar::NetworkStar(), operator=(), and ~Network().

◆ ~Network()

wsf::comm::Network::~Network ( )
overridedefault

References Network().

◆ Network() [2/4]

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

◆ Network() [3/4]

wsf::comm::Network::Network ( const Network & aSrc)
default

References Network().

◆ Network() [4/4]

wsf::comm::Network::Network ( Network && aSrc)
default

References InitializeLinkage(), and Network().

Member Function Documentation

◆ AddLink()

bool wsf::comm::Network::AddLink ( const Address & aSourceAddress,
const Address & aDestinationAddress,
WsfSimulation & aSimulation,
const Address & aOptionalAddress = Address() )

◆ AddLinkP()

virtual bool wsf::comm::Network::AddLinkP ( const Address & aSourceAddress,
const Address & aDestinationAddress,
WsfSimulation & aSimulation,
const Address & aOptionalAddress = Address() )
inlineprotectedvirtual

Reimplemented in wsf::comm::NetworkGeneric.

Referenced by AddLink().

◆ AddMember()

bool wsf::comm::Network::AddMember ( const Address & aAddress,
WsfSimulation & aSimulation,
const Address & aOptionalAddress = Address() )

Avoid duplicates

References AddMemberP(), and mAddressList.

◆ AddMemberP()

virtual bool wsf::comm::Network::AddMemberP ( const Address & aAddress,
WsfSimulation & aSimulation,
const Address & aOptionalAddress = Address() )
inlineprotectedvirtual

◆ Clone()

Network * wsf::comm::Network::Clone ( ) const
inlineoverridevirtual

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

Implements WsfObject.

Reimplemented in wsf::comm::NetworkAdHoc, wsf::comm::NetworkDirectedRing, wsf::comm::NetworkGeneric, wsf::comm::NetworkMesh, wsf::comm::NetworkMeshLegacy, wsf::comm::NetworkPointToPoint, wsf::comm::NetworkRing, and wsf::comm::NetworkStar.

References Network().

◆ GetAddress()

const Address & wsf::comm::Network::GetAddress ( ) const
inline

◆ GetAddressFromNamedComm()

◆ GetHostsMax()

size_t wsf::comm::Network::GetHostsMax ( ) const
inline

References mAddress.

◆ GetNamedMemberList()

const NamedList & wsf::comm::Network::GetNamedMemberList ( ) const
inline

References mNamedList.

◆ GetScriptClassName()

const char * wsf::comm::Network::GetScriptClassName ( ) const
override

◆ HasMember()

bool wsf::comm::Network::HasMember ( const Address & aAddress) const

References mAddressList.

◆ Initialize()

virtual bool wsf::comm::Network::Initialize ( WsfSimulation & aSim)
inlinevirtual

Reimplemented in wsf::comm::NetworkAdHoc.

◆ InitializeLinkage()

◆ InitializeLinkageP()

virtual bool wsf::comm::Network::InitializeLinkageP ( WsfSimulation & aSimulation)
inlineprotectedvirtual

◆ IsManaged()

bool wsf::comm::Network::IsManaged ( ) const
inline

References mManaged.

◆ operator=()

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

References Network().

◆ ProcessAddressLinkListInput()

bool wsf::comm::Network::ProcessAddressLinkListInput ( UtInput & aInput)
protectedvirtual

◆ ProcessAddressListInput()

◆ ProcessInput()

bool wsf::comm::Network::ProcessInput ( UtInput & aInput)
inlineoverridevirtual

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

Reimplemented in wsf::comm::NetworkAdHoc, wsf::comm::NetworkGeneric, wsf::comm::NetworkMesh, wsf::comm::NetworkPointToPoint, wsf::comm::NetworkRing, and wsf::comm::NetworkStar.

◆ ProcessNamedLinkListInput()

bool wsf::comm::Network::ProcessNamedLinkListInput ( UtInput & aInput)
protectedvirtual

◆ ProcessNamedListInput()

◆ RemoveLink()

bool wsf::comm::Network::RemoveLink ( const Address & aSourceAddress,
const Address & aDestinationAddress,
WsfSimulation & aSimulation,
const Address & aOptionalAddress = Address() )

◆ RemoveLinkP()

virtual bool wsf::comm::Network::RemoveLinkP ( const Address & aSourceAddress,
const Address & aDestinationAddress,
WsfSimulation & aSimulation,
const Address & aOptionalAddress = Address() )
inlineprotectedvirtual

Reimplemented in wsf::comm::NetworkGeneric.

Referenced by RemoveLink().

◆ RemoveMember()

bool wsf::comm::Network::RemoveMember ( const Address & aAddress,
WsfSimulation & aSimulation,
const Address & aOptionalAddress = Address() )

◆ RemoveMemberP()

virtual bool wsf::comm::Network::RemoveMemberP ( const Address & aAddress,
WsfSimulation & aSimulation,
const Address & aOptionalAddress = Address() )
inlineprotectedvirtual

◆ SetAddress()

void wsf::comm::Network::SetAddress ( const Address & aAddress)
inline

References mAddress.

◆ SetIsManaged()

void wsf::comm::Network::SetIsManaged ( bool aManaged)
inline

References mManaged.

Member Data Documentation

◆ mAddress

◆ mAddressLinkList

◆ mAddressList

◆ mInputAddressLinkList

AddressLinkList wsf::comm::Network::mInputAddressLinkList {}
protected

Same case as "mInputAddressList" above, except with link definitions.

Referenced by InitializeLinkage().

◆ mInputAddressList

AddressList wsf::comm::Network::mInputAddressList {}
protected

Because we use the "mAddressList" member as a container for all address input, we have to use an additional container to distinguish between addresses converted during object processing, and those set via user input. This object is only for addresses provided directly by the user via ProcessInput, or via direct access.

Referenced by InitializeLinkage(), and ProcessAddressListInput().

◆ mManaged

bool wsf::comm::Network::mManaged {false}
protected

True if this network is being managed by the simulation.

Referenced by IsManaged(), and SetIsManaged().

◆ mNamedLinkList

NamedLinkList wsf::comm::Network::mNamedLinkList {}
protected

◆ mNamedList

NamedList wsf::comm::Network::mNamedList {}
protected

These member variables only exist to handle ProcessInput parsing of comms defined by names, since these comms are not instantiated yet, and do not have addresses.

Referenced by GetNamedMemberList(), InitializeLinkage(), and ProcessNamedListInput().


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