WSF
wsf::comm::NetworkStar Class Reference

#include <WsfCommNetworkStar.hpp>

Inheritance diagram for wsf::comm::NetworkStar:
Collaboration diagram for wsf::comm::NetworkStar:

Public Member Functions

 NetworkStar ()=default
 NetworkStar (const std::string &aNetworkName, const Address &aAddress)
 ~NetworkStar () override=default
NetworkStaroperator= (const NetworkStar &aRhs)=default
bool ProcessInput (UtInput &aInput) override
NetworkStarClone () 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)

Add/Remove Hub Methods

These methods are specific to the star topology implementation. They allow setting or removing of the special hub member. A hub may only be added if one does not currently exist, and will result in linkage to all currently defined members. Removing a hub will remove all linkage.

Note
These are for programmatic usage only, or for scripting. It is expected that typical usage is setting the hub via ProcessInput().
NamedComm mHubNamed {}
Address mHubAddress {}
virtual bool AddHub (const Address &aAddress, WsfSimulation &aSimulation)
virtual bool RemoveHub (const Address &aAddress, WsfSimulation &aSimulation)
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

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)
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()).
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 comms have bi-directional linkage to a single member.

Constructor & Destructor Documentation

◆ NetworkStar() [1/2]

wsf::comm::NetworkStar::NetworkStar ( )
default

References NetworkStar().

Referenced by Clone(), NetworkStar(), and operator=().

◆ NetworkStar() [2/2]

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

◆ ~NetworkStar()

wsf::comm::NetworkStar::~NetworkStar ( )
overridedefault

Member Function Documentation

◆ AddHub()

bool wsf::comm::NetworkStar::AddHub ( const Address & aAddress,
WsfSimulation & aSimulation )
virtual

◆ AddMemberP()

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

Only add links if the hub exists.

Reimplemented from wsf::comm::Network.

References WsfSimulation::GetCommNetworkManager(), WsfSimulation::GetSimTime(), mHubAddress, ok, and simTime.

Referenced by InitializeLinkageP().

◆ Clone()

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

Referenced by operator=().

◆ GetScriptClassName()

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

◆ InitializeLinkageP()

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

Check for existence of hub, and convert to an address, if necessary.

The user may later set the hub, but for now, we can't initialize any links since we don't have a hub. Warn the user, but continue.

Reimplemented from wsf::comm::Network.

References AddMemberP(), wsf::comm::Network::GetAddressFromNamedComm(), WsfObject::GetType(), wsf::comm::Network::mAddressList, mHubAddress, mHubNamed, and ok.

Referenced by AddHub().

◆ operator=()

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

◆ ProcessInput()

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

Referenced by operator=().

◆ RemoveHub()

bool wsf::comm::NetworkStar::RemoveHub ( const Address & aAddress,
WsfSimulation & aSimulation )
virtual

◆ RemoveMemberP()

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

If there is not a hub, there are no links to remove.

Reimplemented from wsf::comm::Network.

References WsfSimulation::GetCommNetworkManager(), WsfSimulation::GetSimTime(), mHubAddress, ok, and simTime.

Member Data Documentation

◆ mHubAddress

Address wsf::comm::NetworkStar::mHubAddress {}
protected

◆ mHubNamed

NamedComm wsf::comm::NetworkStar::mHubNamed {}
protected

Referenced by InitializeLinkageP(), and ProcessInput().


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