DESERT 3.5.1
Loading...
Searching...
No Matches
UwMultiStackController Class Reference

#include <uwmulti-stack-controller.h>

Inheritance diagram for UwMultiStackController:
Collaboration diagram for UwMultiStackController:

Public Member Functions

 UwMultiStackController ()
 
virtual ~UwMultiStackController ()
 
virtual int command (int, const char *const *)
 
virtual void addLayer (int id, int order)
 
virtual void addThreshold (int i, int j, double thres_ij)
 
virtual void recv (Packet *p)
 
int getOrder (int layer_id)
 
int getId (int layer_order)
 

Static Public Attributes

static int const layer_not_exist = -1
 

Protected Types

enum  Mode { UW_MANUAL_SWITCH = 0 , UW_AUTOMATIC_SWITCH }
 

Protected Member Functions

virtual void recvFromUpperLayers (Packet *p)
 
virtual int getBestLayer (Packet *p)
 
virtual bool isLayerAvailable (int id)
 
virtual double getMetricFromSelectedLowerLayer (int id, Packet *p)
 
virtual bool getThreshold (int i, int j, double &thres_ij)
 
virtual void eraseThreshold (int i, int j)
 
void setThreshold (int i, int j, double thres_ij)
 

Protected Attributes

int debug_
 
double min_delay_
 
Mode switch_mode_
 
int lower_id_active_
 
std::map< int, int > id2order
 
ThresMatrix threshold_map
 
std::map< int, int > order2id
 
int signaling_pktSize_
 

Detailed Description

Class used to represents the UwMultiStackController layer of a node.

Definition at line 59 of file uwmulti-stack-controller.h.

Member Enumeration Documentation

◆ Mode

< Switch modes >

Enumerator
UW_MANUAL_SWITCH 

State to switch-mode manually.

UW_AUTOMATIC_SWITCH 

State to switch-mode automatically.

Definition at line 137 of file uwmulti-stack-controller.h.

Constructor & Destructor Documentation

◆ UwMultiStackController()

UwMultiStackController::UwMultiStackController ( )

Constructor of UwMultiPhy class.

Definition at line 62 of file uwmulti-stack-controller.cc.

◆ ~UwMultiStackController()

virtual UwMultiStackController::~UwMultiStackController ( )
inlinevirtual

Destructor of UwMultiPhy class.

Definition at line 75 of file uwmulti-stack-controller.h.

Member Function Documentation

◆ addLayer()

void UwMultiStackController::addLayer ( int  id,
int  order 
)
virtual

Add a layer in the layer map.

Parameters
idunique identifier of the module
orderof the id in the controller logic

Definition at line 128 of file uwmulti-stack-controller.cc.

◆ addThreshold()

void UwMultiStackController::addThreshold ( int  i,
int  j,
double  thres_ij 
)
virtual

set the threshold value for the transition from layer i to layer j, checking first whether the layers exists

Parameters
iid of the layer i
jid of the layer j
thres_ijthreshold to pass from i to j

Definition at line 137 of file uwmulti-stack-controller.cc.

◆ command()

int UwMultiStackController::command ( int  argc,
const char *const *  argv 
)
virtual

TCL command interpreter.

It implements the following OTcl methods:

Parameters
argcNumber of arguments in argv.
argvArray of strings which are the command parameters (Note that argv[0] is the name of the object).
Returns
TCL_OK or TCL_ERROR whether the command has been dispatched successfully or not.

parameters: layer_id, layer_order, a positive and unique integer to order the set if physical ids

parameters: layer_id1, layer_id2, transition threshold

Reimplemented in UwMultiStackControllerPhyMaster, UwMultiStackControllerPhySlave, and UwMultiStackControllerPhy.

Definition at line 78 of file uwmulti-stack-controller.cc.

◆ eraseThreshold()

void UwMultiStackController::eraseThreshold ( int  i,
int  j 
)
protectedvirtual

remove the threshold value for the transition from layer i to layer j, checking first whether the layers exists

Parameters
iid of the layer i
jid of the layer j

Definition at line 197 of file uwmulti-stack-controller.cc.

◆ getBestLayer()

virtual int UwMultiStackController::getBestLayer ( Packet *  p)
inlineprotectedvirtual

Return the best layer to forward the packet when the system works in AUTOMATIC_MODE.

It has to be overloaded in the extended classes to implement the choice rule.

Parameters
ppointer to the packet
Returns
id of the module representing the best layer. ///@fgue what if there is no layer id active?

Reimplemented in UwMultiStackControllerPhyMaster, and UwMultiStackControllerPhySlave.

Definition at line 166 of file uwmulti-stack-controller.h.

◆ getId()

int UwMultiStackController::getId ( int  layer_order)
inline

return the id of the controlled layer given its order in the controller logic

Parameters
orderof the mapped layer
Returns
the layer id

Definition at line 131 of file uwmulti-stack-controller.h.

◆ getMetricFromSelectedLowerLayer()

double UwMultiStackController::getMetricFromSelectedLowerLayer ( int  id,
Packet *  p 
)
protectedvirtual

return the new metrics value obtained from the selected lower layer, in proactive way via ClMessage

Parameters
idto select the lower layer
ppointer to the packet
Returns
the value of the new value of the metrics obtained in proactive way ///@fgue what happens if the requested id is not present?

Definition at line 175 of file uwmulti-stack-controller.cc.

◆ getOrder()

int UwMultiStackController::getOrder ( int  layer_id)
inline

return the order of the id for the controller logic

Parameters
idto select the layer
Returns
the order of the id

Definition at line 120 of file uwmulti-stack-controller.h.

◆ getThreshold()

bool UwMultiStackController::getThreshold ( int  i,
int  j,
double &  thres_ij 
)
protectedvirtual

get the threshold value for the transition from layer i to layer j, checking first whether the layers exists

Parameters
iid of the layer i
jid of the layer j
thres_ijoutput reference to threshold(i,j); if it doesn't exist, the original value is left untouched
Returns
True iff threshold exists and thres_ij is set

Definition at line 182 of file uwmulti-stack-controller.cc.

◆ isLayerAvailable()

bool UwMultiStackController::isLayerAvailable ( int  id)
protectedvirtual

return if the specified layer, identified by id, is available

Parameters
idunique identifier of the module
Returns
if the specified layer is available

Definition at line 170 of file uwmulti-stack-controller.cc.

◆ recv()

void UwMultiStackController::recv ( Packet *  p)
virtual

recv method.

It is called when a packet is received from the other layers

Parameters
Packet*Pointer to the packet that are going to be received

Definition at line 142 of file uwmulti-stack-controller.cc.

◆ recvFromUpperLayers()

void UwMultiStackController::recvFromUpperLayers ( Packet *  p)
protectedvirtual

By default the signaling is not employed, if it is needed, here where to set the signaling packet size.

Handle a packet coming from upper layers

Parameters
ppointer to the packet

Definition at line 156 of file uwmulti-stack-controller.cc.

◆ setThreshold()

void UwMultiStackController::setThreshold ( int  i,
int  j,
double  thres_ij 
)
inlineprotected

set the threshold value for the transition from layer i to layer j

Parameters
iid of the layer i
jid of the layer j
thres_ijthreshold to pass from i to j

Definition at line 217 of file uwmulti-stack-controller.h.

Member Data Documentation

◆ debug_

int UwMultiStackController::debug_
protected

Flag to activate debug verbosity.

Definition at line 143 of file uwmulti-stack-controller.h.

◆ id2order

std::map<int, int> UwMultiStackController::id2order
protected

Maps each layer id to its order in the threshold matrix.

(layer_id, order).

Definition at line 147 of file uwmulti-stack-controller.h.

◆ layer_not_exist

const int UwMultiStackController::layer_not_exist = -1
static

This constant is returned when a searched layer does not exist>

Definition at line 65 of file uwmulti-stack-controller.h.

◆ lower_id_active_

int UwMultiStackController::lower_id_active_
protected

<Current switch mode (either AUTOMATIC or MANUAL).

Id of the current lower layer active. It is used only in MANUAL MODE.

Definition at line 146 of file uwmulti-stack-controller.h.

◆ min_delay_

double UwMultiStackController::min_delay_
protected

Definition at line 144 of file uwmulti-stack-controller.h.

◆ order2id

std::map<int, int> UwMultiStackController::order2id
protected

Return the layer order given its order in the threshold matrix.

(layer_order, layer_id).

Definition at line 149 of file uwmulti-stack-controller.h.

◆ signaling_pktSize_

int UwMultiStackController::signaling_pktSize_
protected

Definition at line 150 of file uwmulti-stack-controller.h.

◆ switch_mode_

Mode UwMultiStackController::switch_mode_
protected

Definition at line 145 of file uwmulti-stack-controller.h.

◆ threshold_map

ThresMatrix UwMultiStackController::threshold_map
protected

Returns the switch layer theshold given a layer order.

Definition at line 148 of file uwmulti-stack-controller.h.


The documentation for this class was generated from the following files: