ClMessage Class Reference

#include <clmessage.h>

Inheritance diagram for ClMessage:

Inheritance graph
[legend]
List of all members.

Public Member Functions

 ClMessage (int verbosity, ClMessage_t type)
 ClMessage (ClMessage *m)
 ClMessage (int verbosity, ClMessage_t type, DestinationType dtype, int value)
virtual ~ClMessage ()
DestinationType getDestType ()
int getDest ()
int getSource ()
void setSource (int src)
void setDest (int dst)
virtual ClMessagecopy ()
int verbosity ()
ClMessage_t type ()
ClDirection direction ()
void direction (ClDirection dir)
unsigned int uid ()
 ClMessage (int verbosity, ClMessage_t type, DestinationType dtype, int source, int value)

Static Public Member Functions

static ClMessage_t addClMessage ()

Protected Attributes

ClMessage_t type_
DestinationType destType_
int source_
int dest_
int verbosity_
ClDirection direction_
unsigned int uid_

Static Protected Attributes

static ClMessage_t nType_ = 0

Detailed Description

This is the father class of all cross layer messages (i.e., by extending it it is possible to define an ad hoc messages with any type of parameter in order to allow cross any type of cross layer communication). There are 2 message type:

See also:
ClTracer, ClMessageTracer, ClSAP, NodeCore, PlugIn, Module

Definition at line 128 of file clmessage.h.


Constructor & Destructor Documentation

ClMessage::ClMessage ( int  verbosity,
ClMessage_t  type 
)

Broadcast ClMessage constructor.

This is the parent constructor that should be called by a class inheriting from ClMessage and implementing a broadcast message.

Parameters:
verbosity define the level of verbosity of the cross-layer message
type define the type of the cross-layer message (this parameter is given by the simulator during the initialization phase, i.e., it is the value returned by the addClMessage method)

Definition at line 52 of file clmessage.cc.

References uid_.

ClMessage::ClMessage ( ClMessage m  ) 

Copy-by-reference constructor.

Warning:
this constructor must be redefined for each child in order to obtain a specular copy of the clmessage (including possible new attributes)
Parameters:
m a cross-layer message thas has to initialize the new one

Definition at line 84 of file clmessage.cc.

References dest_, destType_, source_, type_, uid_, and verbosity_.

ClMessage::ClMessage ( int  verbosity,
ClMessage_t  type,
DestinationType  dtype,
int  value 
)

Standard ClMessage constructor.

This constructor allows settings all the relevant parameters of ClMessage, and therefore can be used to create all types of messages (unicast, broadcast, layercast).

Parameters:
verbosity define the level of verbosity of the cross-layer message
type define the type of the cross-layer message (this parameter is given by the simulator during the initialization phase, i.e., it is the value returned by the addClMessage method)
dtype define the type of the destination (UNICAST or BROADCAST)
value its intepretation is function of the dtype paramter:
  • dtype=UNICAST: the id of the destination recipient
  • dtype=BROADCAST: the number of the layer to which the message has to be sent, or CLBROADCASTADDR if the message is directed to all the modules of the whole architecture

Definition at line 73 of file clmessage.cc.

References uid_.

ClMessage::~ClMessage (  )  [virtual]

ClMessage destructor

Definition at line 94 of file clmessage.cc.

ClMessage::ClMessage ( int  verbosity,
ClMessage_t  type,
DestinationType  dtype,
int  source,
int  value 
)

Deprecated:
This method is deprecated since the source ID is now filled in automatically. use ClMessage(int verbosity, ClMessage_t type, DestinationType dtype, int value) instead.
Parameters:
verbosity 
type 
dtype 
source 
value 
Returns:

Definition at line 62 of file clmessage.cc.

References PRINT_WARNING_DEPRECATED_FUNCTION, and uid_.


Member Function Documentation

DestinationType ClMessage::getDestType (  ) 

Return the destination type of the cross layer message (i.e., UNICAST or BROADCAST)

Returns:
the destination type of the cross layer message

Definition at line 99 of file clmessage.cc.

References destType_.

Referenced by NodeCore::crLayCommand(), VerboseClCmnTracer::format(), ClCommonTracer::format(), Module::sendAsyncClMsgDown(), Module::sendAsyncClMsgUp(), Module::sendSyncClMsgDown(), Module::sendSyncClMsgUp(), and NodeCore::synchronousCrLayCommand().

int ClMessage::getDest (  ) 

Return the destination of the cross layer message. According to its destination-type it is the id of the destination module/plugin in case of UNICAST messase, while it is the layer id or the broadcast address in case of BROADCAST message

Returns:
the destination of the cross layer message

Definition at line 105 of file clmessage.cc.

References dest_.

Referenced by NodeCore::crLayCommand(), VerboseClCmnTracer::format(), ClCommonTracer::format(), Module::sendAsyncClMsgDown(), Module::sendAsyncClMsgUp(), Module::sendSyncClMsgDown(), Module::sendSyncClMsgUp(), and NodeCore::synchronousCrLayCommand().

int ClMessage::getSource (  ) 

Return the source id of the cross layer message

Returns:
the source id of the cross layer message

Definition at line 140 of file clmessage.cc.

References source_.

Referenced by NodeCore::crLayCommand(), VerboseClCmnTracer::format(), ClCommonTracer::format(), MrclRouting::recvSyncClMsg(), IPModule::recvSyncClMsg(), and NodeCore::synchronousCrLayCommand().

void ClMessage::setSource ( int  src  ) 

Set the source id of the cross layer message

Parameters:
src the source id of the cross layer message

Definition at line 145 of file clmessage.cc.

References source_.

Referenced by RouteReachable::RouteReachable(), PlugIn::sendAsyncClMsg(), Module::sendAsyncClMsgDown(), Module::sendAsyncClMsgUp(), PlugIn::sendSyncClMsg(), Module::sendSyncClMsgDown(), and Module::sendSyncClMsgUp().

void ClMessage::setDest ( int  dst  ) 

Set the destination id of the cross layer message

Parameters:
src the destination id of the cross layer message

Definition at line 151 of file clmessage.cc.

References dest_.

Referenced by MLLModule::fillNetAddrTable(), MrclRouting::getConfiguration(), Module::sendDown(), Module::sendSynchronousDown(), Module::sendSynchronousUp(), and Module::sendUp().

ClMessage * ClMessage::copy (  )  [virtual]

Return a copy of the message

Warning:
this method must be always implemented by child-classes in order to get the copy of all new added attributes

Reimplemented in ClMsgDiscovery, ClMsgPositionGetDist, IPClMsgReqAddr, IPClMsgSendAddr, ClMsgPhyOnOffSwitch, ClMsgPhyOnOffSwitchStatus, ClMsgPhy2MacEndTx, ClMsgPhy2MacStartRx, ClMsgPhy2MacCCA, ClMsgMac2PhyGetTxDuration, and MacClMsgGetAddr.

Definition at line 111 of file clmessage.cc.

Referenced by NodeCore::crLayCommand(), Module::sendAsyncClMsgDown(), and Module::sendAsyncClMsgUp().

int ClMessage::verbosity (  ) 

Return the verbosity of the cross layer message

Returns:
the verbosity of the cross layer message

Definition at line 120 of file clmessage.cc.

References verbosity_.

Referenced by ClSAP::handle(), ClSAP::sendClLayer(), SAP::sendDown(), ClSAP::sendModule(), ClSAP::sendSynchronousClLayer(), SAP::sendSynchronousDown(), ClSAP::sendSynchronousModule(), SAP::sendSynchronousUp(), and SAP::sendUp().

ClMessage_t ClMessage::type (  ) 

Return the type of the cross layer message (i.e., its own unique id returned from addClMessage method during the initialization phase)

Returns:
the type of the cross layer message

Definition at line 125 of file clmessage.cc.

References type_.

Referenced by MLLModule::crLayCommand(), CbrModule::crLayCommand(), MMacModule::crLaySynchronousCommand(), MLLModule::recvAsyncClMsg(), MrclRouting::recvSyncClMsg(), PlugIn::recvSyncClMsg(), MPhy::recvSyncClMsg(), PositionDB::recvSyncClMsg(), MMac::recvSyncClMsg(), MMacModule::recvSyncClMsg(), and IPModule::recvSyncClMsg().

ClDirection ClMessage::direction (  ) 

Return the direction of the cross layer message, in detail:

Returns:
the verbosity of the cross layer message

Definition at line 130 of file clmessage.cc.

References direction_.

Referenced by VerboseClCmnTracer::format(), ClCommonTracer::format(), ClSAP::handle(), ClSAP::sendClLayer(), SAP::sendDown(), ClSAP::sendModule(), ClSAP::sendSynchronousClLayer(), SAP::sendSynchronousDown(), ClSAP::sendSynchronousModule(), SAP::sendSynchronousUp(), SAP::sendUp(), ConnectorTrace::trace(), and ConnectorTrace::traceSync().

void ClMessage::direction ( ClDirection  dir  ) 

Set the direction of the cross layer message

Parameters:
dir the direction requested (i.e., TOMODULE or TONODECORE)

Definition at line 135 of file clmessage.cc.

References direction_.

unsigned int ClMessage::uid (  ) 

Return the unique id of the cross layer message (each message generated has an integer id unique in the simulation)

Returns:
the type of the cross layer message

Definition at line 157 of file clmessage.cc.

References uid_.

Referenced by VerboseClCmnTracer::format(), and ClCommonTracer::format().

ClMessage_t ClMessage::addClMessage (  )  [static]

Static method to add a new type of cross layer message during the initialization phase

Returns:
the type of the message (i.e., a unique id to identify it during the simulation)

Definition at line 41 of file clmessage.cc.

References nType_.


Member Data Documentation

ClMessage_t ClMessage::nType_ = 0 [static, protected]

Static variable used to generate the id of all the cross layer message used in the simulation

Definition at line 290 of file clmessage.h.

Referenced by addClMessage().

ClMessage_t ClMessage::type_ [protected]

Define the type of the message (i.e., unique id returned from the addClMessage during the initialization phase)

Definition at line 294 of file clmessage.h.

Referenced by ClMessage(), and type().

DestinationType ClMessage::destType_ [protected]

Define the destination type of the message (i.e., UNICAST or BROADCAST) to correctly codify the dest_ address

Definition at line 298 of file clmessage.h.

Referenced by ClMessage(), and getDestType().

int ClMessage::source_ [protected]

Define the source id)

Definition at line 301 of file clmessage.h.

Referenced by ClMessage(), getSource(), and setSource().

int ClMessage::dest_ [protected]

Define the destination id (it has to be codified according to destType_ attribute)

Definition at line 304 of file clmessage.h.

Referenced by ClMessage(), getDest(), and setDest().

int ClMessage::verbosity_ [protected]

Define the verbosity of the message (i.e., the depht of tracing requested for this message)

Definition at line 307 of file clmessage.h.

Referenced by ClMessage(), and verbosity().

ClDirection ClMessage::direction_ [protected]

Define the direction of the message (i.e., TOMODULE or TONODECORE)

Definition at line 310 of file clmessage.h.

Referenced by direction().

unsigned int ClMessage::uid_ [protected]

Define the unique id of the message

Definition at line 313 of file clmessage.h.

Referenced by ClMessage(), and uid().


The documentation for this class was generated from the following files:
Generated on Wed Nov 26 15:48:29 2008 for NS-MIRACLE library by  doxygen 1.5.2