|
WSF
|
This class represents a communication devices protocol stack. More...
#include <WsfCommProtocolStack.hpp>

Public Types | |
| using | LayerType = Layer::LayerType |
| using | ProtocolVector = std::vector<std::unique_ptr<Layer>> |
| using | RawProtocolVector = std::vector<Layer*> |
Public Member Functions | |
| ProtocolStack ()=default | |
| Constructors and virtual destructor. | |
| ProtocolStack (const ProtocolStack &aSrc) | |
| ProtocolStack & | operator= (const ProtocolStack &aRhs)=delete |
| virtual | ~ProtocolStack ()=default |
| Layer * | AddLayer (std::unique_ptr< Layer > aLayerPtr) |
| bool | RemoveLayer (size_t aLayerIndex) |
| Removes a layer at the indicated position. | |
| bool | RemoveLayerByID (size_t aLayerID) |
| Removes a layer via unique ID. | |
| std::unique_ptr< Layer > | ReplaceLayer (size_t aLayerIndex, std::unique_ptr< Layer > aLayerPtr) |
| Layer * | InsertLayer (size_t aLayerIndex, std::unique_ptr< Layer > aLayerPtr) |
Comm event methods. | |
| ProtocolVector | mProtocolStack {} |
| Protocol stack for communication device. | |
| Comm * | mParent {nullptr} |
| Pointer to the stack Parent. | |
| virtual bool | ProcessLayerMessage (double aSimTime, size_t aLayerIndex, layer::Message aLayerMessage, Message *aCommMessagePtr) |
| Process a layer event. | |
| void | ValidateAdjacentLayers () |
| Reconciles upper/lower stack settings upon modifications. | |
| ProtocolVector::iterator | FindLayerByID (size_t aID) |
| Wrapped helper methods for finding a layer by ID. | |
| ProtocolVector::const_iterator | FindLayerByID (size_t aID) const |
Layer Retrieval Methods | |
| Layer * | GetLayer (size_t aLayerIndex) const |
| Returns a pointer to the layer at the indicated position. | |
| Layer * | GetLayer (LayerType aLayerType) const |
| RawProtocolVector | GetLayers (LayerType aLayerType) const |
| template<typename T> | |
| T * | GetLayer () const |
| Template method for return of the first layer of the template object type. | |
| template<typename T> | |
| std::vector< T * > | GetLayers () const |
| Template method for return of all layers of the template type. | |
| Layer * | GetLayerByID (size_t aLayerID) const |
| size_t | Size () const |
| Returns the number of layers in the stack. | |
| void | ClearLayers () |
| Removes all layers from the stack. | |
Common infrastructure methods. | |
| virtual bool | Initialize (double aSimTime) |
| virtual bool | Initialize2 (double aSimTime) |
| virtual bool | ProcessInput (UtInput &aInput) |
| void | SetParent (Comm *aParentCommPtr) |
| Comm * | GetParent () const |
| void | SetDebugEnabled (bool aDebugEnabled) |
Send/Receive methods | |
| virtual bool | Receive (double aSimTime, Comm *aXmtrPtr, Message &aMessage) |
| virtual bool | Send (double aSimTime, Message &aMessage) |
This class represents a communication devices protocol stack.
| using wsf::comm::ProtocolStack::ProtocolVector = std::vector<std::unique_ptr<Layer>> |
| using wsf::comm::ProtocolStack::RawProtocolVector = std::vector<Layer*> |
|
default |
Constructors and virtual destructor.
References ProtocolStack().
Referenced by operator=(), ProtocolStack(), and ProtocolStack().
| wsf::comm::ProtocolStack::ProtocolStack | ( | const ProtocolStack & | aSrc | ) |
References mParent, mProtocolStack, and ProtocolStack().
|
virtualdefault |
References AddLayer(), GetLayer(), GetLayers(), InsertLayer(), RemoveLayer(), RemoveLayerByID(), and ReplaceLayer().
Adds a layer at the top (end) of the stack. Returns a pointer to the added layer.
Adds the layer on the top of the stack. The stack takes ownership.
| aLayerPtr | [input] A pointer to a communication protocol layer. |
References GetParent(), mProtocolStack, and wsf::comm::Layer::SetIndex().
Referenced by ~ProtocolStack().
|
inline |
Removes all layers from the stack.
References mProtocolStack.
|
protected |
Wrapped helper methods for finding a layer by ID.
References mProtocolStack.
Referenced by GetLayerByID(), and RemoveLayerByID().
|
protected |
References mProtocolStack.
|
inline |
Template method for return of the first layer of the template object type.
References mProtocolStack.
References mProtocolStack.
| Layer * wsf::comm::ProtocolStack::GetLayer | ( | size_t | aLayerIndex | ) | const |
Returns a pointer to the layer at the indicated position.
| aLayerIndex | [input] The index of the layer to return. |
References mProtocolStack.
Referenced by WsfJTIDS_Terminal::Initialize(), wsf::comm::LASER_XmtrRcvr::LASER_XmtrRcvr(), wsf::comm::NetworkLayer::ProcessLayerMessage(), WsfJTIDS_Terminal::TurnOff(), and ~ProtocolStack().
| Layer * wsf::comm::ProtocolStack::GetLayerByID | ( | size_t | aLayerID | ) | const |
References FindLayerByID(), and mProtocolStack.
|
inline |
Template method for return of all layers of the template type.
References mProtocolStack.
| ProtocolStack::RawProtocolVector wsf::comm::ProtocolStack::GetLayers | ( | LayerType | aLayerType | ) | const |
References mProtocolStack.
Referenced by ~ProtocolStack().
|
inline |
References mParent.
Referenced by AddLayer(), Send(), and ValidateAdjacentLayers().
|
virtual |
Initializes the layers in the protocol stack.
| aSimTime | [input] The current simulation time. |
References mProtocolStack, and ok.
|
virtual |
Initializes the layers in the protocol stack.
| aSimTime | [input] The current simulation time. |
References mProtocolStack, and ok.
| Layer * wsf::comm::ProtocolStack::InsertLayer | ( | size_t | aLayerIndex, |
| std::unique_ptr< Layer > | aLayerPtr ) |
Inserts a layer at the indicated position. Returns a pointer to inserted layer, or a nullptr upon failure.
References mProtocolStack, and ValidateAdjacentLayers().
Referenced by ~ProtocolStack().
|
delete |
References ProtocolStack().
|
virtual |
References mProtocolStack.
|
virtual |
Process a layer event.
References mProtocolStack.
|
virtual |
Called from the communication device on receipt of a communication message.
| aSimTime | [input] The current simulation time. |
| aXmtrPtr | {input] The comm device that sent the message. |
| aMessage | [input] The communication message being received. |
References mProtocolStack.
| bool wsf::comm::ProtocolStack::RemoveLayer | ( | size_t | aLayerIndex | ) |
Removes a layer at the indicated position.
References mProtocolStack, and ValidateAdjacentLayers().
Referenced by ~ProtocolStack().
| bool wsf::comm::ProtocolStack::RemoveLayerByID | ( | size_t | aLayerID | ) |
Removes a layer via unique ID.
References FindLayerByID(), mProtocolStack, and ValidateAdjacentLayers().
Referenced by ~ProtocolStack().
| std::unique_ptr< Layer > wsf::comm::ProtocolStack::ReplaceLayer | ( | size_t | aLayerIndex, |
| std::unique_ptr< Layer > | aLayerPtr ) |
Replaces a layer with the provided layer. The replaced layer is returned for potential further usage.
Replace a layer and returns the layer being removed.
| aLayerIndex | [input] The index of the layer to replace. |
| aLayerPtr | [input] A pointer to the new communication protocol layer. |
References mProtocolStack, and ValidateAdjacentLayers().
Referenced by ~ProtocolStack().
|
virtual |
Called by the communication device to send a communication message.
| aSimTime | [input] The current simulation time. |
| aMessage | [input] The communication message being received. |
Set the required fields for the message. We don't leave this up to the specific implementations of comm objects due to being required across all comm objects. In addition, this avoids having to query the network manager within the implementations.
References GetParent(), mProtocolStack, and wsf::comm::Message::SourceMessage().
| void wsf::comm::ProtocolStack::SetDebugEnabled | ( | bool | aDebugEnabled | ) |
References mProtocolStack.
| void wsf::comm::ProtocolStack::SetParent | ( | Comm * | aParentCommPtr | ) |
Provides each layer with a pointer to the parent communication device.
| aParentCommPtr | [input] A pointer to the communication device that owns this stack. |
References mParent, and mProtocolStack.
|
inline |
Returns the number of layers in the stack.
References mProtocolStack.
|
protected |
Reconciles upper/lower stack settings upon modifications.
References GetParent(), and mProtocolStack.
Referenced by InsertLayer(), RemoveLayer(), RemoveLayerByID(), and ReplaceLayer().
|
protected |
Pointer to the stack Parent.
Referenced by GetParent(), ProtocolStack(), and SetParent().
|
protected |
Protocol stack for communication device.
Referenced by AddLayer(), ClearLayers(), FindLayerByID(), FindLayerByID(), GetLayer(), GetLayer(), GetLayer(), GetLayerByID(), GetLayers(), GetLayers(), Initialize(), Initialize2(), InsertLayer(), ProcessInput(), ProcessLayerMessage(), ProtocolStack(), Receive(), RemoveLayer(), RemoveLayerByID(), ReplaceLayer(), Send(), SetDebugEnabled(), SetParent(), Size(), and ValidateAdjacentLayers().