12#ifndef WSFCOMMPROTOCOLSTACK_HPP
13#define WSFCOMMPROTOCOLSTACK_HPP
15#include "wsf_export.h"
62 std::unique_ptr<Layer>
ReplaceLayer(
size_t aLayerIndex, std::unique_ptr<Layer> aLayerPtr);
82 auto layerTypePtr =
dynamic_cast<T*
>(
layer->GetCommLayerImp());
95 std::vector<T*> layers;
98 auto layerTypePtr =
dynamic_cast<T*
>(
layer->GetCommLayerImp());
101 layers.push_back(layerTypePtr);
107 Layer* GetLayerByID(
size_t aLayerID)
const;
119 virtual bool Initialize(
double aSimTime);
120 virtual bool Initialize2(
double aSimTime);
121 virtual bool ProcessInput(UtInput& aInput);
124 void SetParent(
Comm* aParentCommPtr);
126 void SetDebugEnabled(
bool aDebugEnabled);
130 virtual bool Receive(
double aSimTime,
Comm* aXmtrPtr,
Message& aMessage);
131 virtual bool Send(
double aSimTime,
Message& aMessage);
136 virtual bool ProcessLayerMessage(
double aSimTime,
size_t aLayerIndex,
layer::Message aLayerMessage,
Message* aCommMessagePtr);
141 void ValidateAdjacentLayers();
145 ProtocolVector::iterator FindLayerByID(
size_t aID);
146 ProtocolVector::const_iterator FindLayerByID(
size_t aID)
const;
#define WSF_EXPORT
Definition WsfXIO_Export.hpp:35
Definition WsfComm.hpp:43
Definition WsfCommLayer.hpp:40
LayerType
Definition WsfCommLayer.hpp:45
Definition WsfCommMessage.hpp:51
std::vector< T * > GetLayers() const
Template method for return of all layers of the template type.
Definition WsfCommProtocolStack.hpp:93
bool RemoveLayer(size_t aLayerIndex)
Removes a layer at the indicated position.
Definition WsfCommProtocolStack.cpp:77
std::vector< Layer * > RawProtocolVector
Definition WsfCommProtocolStack.hpp:42
ProtocolStack()=default
Constructors and virtual destructor.
size_t Size() const
Returns the number of layers in the stack.
Definition WsfCommProtocolStack.hpp:112
ProtocolVector mProtocolStack
Protocol stack for communication device.
Definition WsfCommProtocolStack.hpp:150
virtual ~ProtocolStack()=default
void ClearLayers()
Removes all layers from the stack.
Definition WsfCommProtocolStack.hpp:115
ProtocolStack & operator=(const ProtocolStack &aRhs)=delete
std::vector< std::unique_ptr< Layer > > ProtocolVector
Definition WsfCommProtocolStack.hpp:41
Layer * AddLayer(std::unique_ptr< Layer > aLayerPtr)
Definition WsfCommProtocolStack.cpp:46
RawProtocolVector GetLayers(LayerType aLayerType) const
Definition WsfCommProtocolStack.cpp:161
std::unique_ptr< Layer > ReplaceLayer(size_t aLayerIndex, std::unique_ptr< Layer > aLayerPtr)
Definition WsfCommProtocolStack.cpp:109
Comm * GetParent() const
Definition WsfCommProtocolStack.hpp:125
Comm * mParent
Pointer to the stack Parent.
Definition WsfCommProtocolStack.hpp:153
Layer * InsertLayer(size_t aLayerIndex, std::unique_ptr< Layer > aLayerPtr)
Definition WsfCommProtocolStack.cpp:126
bool RemoveLayerByID(size_t aLayerID)
Removes a layer via unique ID.
Definition WsfCommProtocolStack.cpp:91
Layer::LayerType LayerType
Definition WsfCommProtocolStack.hpp:39
Layer * GetLayer(size_t aLayerIndex) const
Returns a pointer to the layer at the indicated position.
Definition WsfCommProtocolStack.cpp:142
T * GetLayer() const
Template method for return of the first layer of the template object type.
Definition WsfCommProtocolStack.hpp:78
Definition WsfCommLayerMessage.hpp:36
Definition WsfCommLayerMessage.hpp:24
Definition WsfComm.cpp:34
Function definitions for those who need run-time access to the version.
Definition WsfComm.cpp:32