41 explicit layer() : upperLayers(), lowerLayers(), type(
std::string(
"")) { };
50 explicit layer(
const std::string& p_type) : upperLayers(), lowerLayers(), type(
std::string(p_type.begin(), p_type.end())) { };
58 std::for_each(lowerLayers.rbegin(), lowerLayers.rend(), [](
layer* it) {
delete it; } );
78 if (p_layer != NULL) {
79 upperLayers.push_back(p_layer);
124 for (std::vector<layer*>::const_iterator it = layers.cbegin(); it != layers.cend(); ++it) {
131 for (std::vector<layer*>::const_iterator it = upperLayers.cbegin(); it != upperLayers.cend(); ++it) {
138 for (std::vector<layer*>::const_iterator it = lowerLayers.cbegin(); it != lowerLayers.cend(); ++it) {
virtual void send_data(OCTETSTRING &p_data, Params &p_params)
Send bytes formated data to the lower layers.
Definition: layer.hh:101
std::vector< layer * > lowerLayers
List of the upper protocol layers.
Definition: layer.hh:31
layer(const std::string &p_type)
Specialized constructor Create a new instance of the layer class with its type description.
Definition: layer.hh:50
Forward declaration of TITAN class.
Definition: layer.hh:29
virtual void receive_data(OCTETSTRING &p_data, Params &p_params)
Receive bytes formated data from the lower layers.
Definition: layer.hh:112
void receive_to_all_layers(OCTETSTRING &data, Params ¶ms)
Definition: layer.hh:130
layer()
Type description, it indicates the protocol type (e.g. CAM, DENM, GN, ETH, PCAP...)
Definition: layer.hh:41
void to_all_layers(std::vector< layer *> &layers, OCTETSTRING &data, Params ¶ms)
Definition: layer.hh:123
Header file for the parameter dictionary.
std::string type
List of the lower protocol layers.
Definition: layer.hh:34
This class provides basic functionalities for an ITS dictionary.
Definition: Params.hh:21
std::vector< layer * > upperLayers
Definition: layer.hh:30
const std::string & to_string() const
Remove the specified upper layer protocol from the list of the upper layer.
Definition: layer.hh:120
void send_to_all_layers(OCTETSTRING &data, Params ¶ms)
Definition: layer.hh:137
void delete_layer()
Delete this layer.
Definition: layer.hh:68
void add_upper_layer(layer *p_layer)
Add a new layer in the list of the upper layer.
Definition: layer.hh:77
virtual ~layer()
Default destructor.
Definition: layer.hh:56
void remove_upper_layer(layer *p_layer)
Remove the specified upper layer protocol from the list of the upper layer.
Definition: layer.hh:90