NodeCore Class Reference

#include <node-core.h>

Collaboration diagram for NodeCore:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 NodeCore ()
virtual ~NodeCore ()
virtual void battery (double battery)
double battery ()
virtual int crLayCommand (ClMessage *m)
virtual int synchronousCrLayCommand (ClMessage *m)
virtual int command (int argc, const char *const *argv)
virtual PositiongetPosition ()

Private Member Functions

void sendClSAP (int i, int j, ClMessage *m)
void sendSynchronousClSAP (int i, int j, ClMessage *m)
int addClSAP (ClSAP *clsap, int level)
int getNLayer ()
int getNClSAP (int layer)
int getPluginID (int i, int j)
int getLayer (int pluginId)
int getIdInLayer (int pluginId)
void handle (Event *e)

Private Attributes

ClSAP *** crossLayerSAPlist_
int nLayer_
int * clsapPerLayer_
int * pluginLayer_
int * pluginIdInLayer_
int pluginNum_
Positionposition_
double battery_

Detailed Description

The NODECORE class is a TclObject and Handler used to store all the common information about the node. One of the most important is the cross-layer bus that connect all Modules and all PlugIn between each others. It also maintain the spatial position of the node.

See also:
NodeCore, PlugIn, Module, SAP, ClSAP, Position

Definition at line 174 of file node-core.h.


Constructor & Destructor Documentation

NodeCore::NodeCore (  ) 

NodeCore constructor

Definition at line 163 of file node-core.cc.

References battery_.

NodeCore::~NodeCore (  )  [virtual]

NodeCore destructor

Definition at line 168 of file node-core.cc.

References clsapPerLayer_, crossLayerSAPlist_, and nLayer_.


Member Function Documentation

void NodeCore::battery ( double  battery  )  [virtual]

Set the value of the battery

Parameters:
battery value to be setted requested

Definition at line 179 of file node-core.cc.

References battery_.

double NodeCore::battery (  )  [inline]

Get the current value of the battery

Returns:
battery value

Definition at line 197 of file node-core.h.

References battery_.

int NodeCore::crLayCommand ( ClMessage m  )  [virtual]

Asynchronous cross-layer message command demiltiplexer. It has to sent a copy of the messages to the destination(s) indicated.

Parameters:
m instace of ClMessage to be dispatched
Returns:
TCL_OK or TCL_ERROR whether the command has been dispatched succesfully or no

Definition at line 373 of file node-core.cc.

References CLBROADCASTADDR, ClMessage::copy(), ClMessage::getDest(), ClMessage::getDestType(), getIdInLayer(), getLayer(), getNClSAP(), getNLayer(), getPluginID(), ClMessage::getSource(), nLayer_, pluginNum_, sendClSAP(), and UNICAST.

Referenced by handle(), ClSAP::handle(), and ClSAP::sendClLayer().

Here is the call graph for this function:

int NodeCore::synchronousCrLayCommand ( ClMessage m  )  [virtual]

Synchronous cross-layer message command demiltiplexer. It has to sent a copy of the messages to the destination(s) indicated.

Parameters:
m instace of ClMessage to be dispatched
Returns:
zero on success, nonzero on error

Definition at line 450 of file node-core.cc.

References CLBROADCASTADDR, ClMessage::getDest(), ClMessage::getDestType(), getIdInLayer(), getLayer(), getNClSAP(), getNLayer(), getPluginID(), ClMessage::getSource(), nLayer_, pluginNum_, sendSynchronousClSAP(), and UNICAST.

Referenced by ClSAP::sendSynchronousClLayer().

Here is the call graph for this function:

int NodeCore::command ( int  argc,
const char *const *  argv 
) [virtual]

TCL command interpreter. It implements the following OTcl methods:

Moreover it inherits all the OTcl method of TclObject and Handler

Parameters:
argc number of arguments in argv
argv array of strings which are the comand parameters (Note that argv[0] is the name of the object)
Returns:
TCL_OK or TCL_ERROR whether the command has been dispatched succesfully or no

Definition at line 277 of file node-core.cc.

References addClSAP(), and position_.

Here is the call graph for this function:

Position * NodeCore::getPosition (  )  [virtual]

Return the pointer to instance of the Position installed

Returns:
the pointer to instance of the Position installed

Definition at line 523 of file node-core.cc.

References position_.

Referenced by ClSAP::getPosition(), and ChSAP::getPosition().

void NodeCore::sendClSAP ( int  i,
int  j,
ClMessage m 
) [private]

Send an asyncronous cross-layer message (i.e., it does not require a direct answer from the target) to the indicated ClSAP

Parameters:
i define the level in which the message has to be sent
j define the index inside the level in which the message has to be sent
m an instance of ClMessage to be sent
See also:
ClSAP, ClMessage, ClTracer

Definition at line 319 of file node-core.cc.

References crossLayerSAPlist_, and ClSAP::sendModule().

Referenced by crLayCommand().

Here is the call graph for this function:

void NodeCore::sendSynchronousClSAP ( int  i,
int  j,
ClMessage m 
) [private]

Send an asyncronous cross-layer message (i.e., it always require a direct answer from the target) to the indicated ClSAP

Parameters:
i define the level in which the message has to be sent
j define the index inside the level in which the message has to be sent
m an instance of ClMessage to be sent
See also:
ClSAP, ClMessage, ClTracer

Definition at line 325 of file node-core.cc.

References crossLayerSAPlist_, and ClSAP::sendSynchronousModule().

Referenced by synchronousCrLayCommand().

Here is the call graph for this function:

int NodeCore::addClSAP ( ClSAP clsap,
int  level 
) [private]

Method used internally to add a ClSAP in the indicated level

Parameters:
clsap pointer to instance of the clsap to be added
level define the level in which the clsap has to be added
Returns:
TCL_ERROR when it is not able to add the ClSAP, otherwise TCL_OK
See also:
ClSAP, ClMessage, ClTracer

Definition at line 186 of file node-core.cc.

References clsapPerLayer_, crossLayerSAPlist_, ClSAP::getPluginId(), nLayer_, pluginIdInLayer_, pluginLayer_, and pluginNum_.

Referenced by command().

Here is the call graph for this function:

int NodeCore::getNLayer (  )  [private]

Return the number of the layer in use

Returns:
the number of the layer in use
See also:
ClSAP, ClMessage, ClTracer

Definition at line 331 of file node-core.cc.

References nLayer_.

Referenced by crLayCommand(), and synchronousCrLayCommand().

int NodeCore::getNClSAP ( int  layer  )  [private]

Return the number of the ClSAP installed in the layer indicated

Parameters:
layer layer in which tests the number of ClSAP installed
Returns:
the number of the ClSAP installed in the layer indicated
See also:
ClSAP, ClMessage, ClTracer

Definition at line 337 of file node-core.cc.

References clsapPerLayer_.

Referenced by crLayCommand(), and synchronousCrLayCommand().

int NodeCore::getPluginID ( int  i,
int  j 
) [private]

Return the PlugIn id attached to the j-ClSAP at the i-level

Parameters:
i layer in which PlugIn is installed
j index within the layer in which PlugIn is installed
Returns:
the id of the PlugIn indicated
See also:
ClSAP

Definition at line 343 of file node-core.cc.

References crossLayerSAPlist_, and ClSAP::getPluginId().

Referenced by crLayCommand(), and synchronousCrLayCommand().

Here is the call graph for this function:

int NodeCore::getLayer ( int  pluginId  )  [private]

Return the layer in which the PlugIn indicated is installed

Parameters:
pluginId id of the PlugIn
Returns:
the layer in which the PlugIn indicated is installed
See also:
PlugIn

Definition at line 349 of file node-core.cc.

References pluginLayer_, and pluginNum_.

Referenced by crLayCommand(), and synchronousCrLayCommand().

int NodeCore::getIdInLayer ( int  pluginId  )  [private]

Return the index within the layer in which the PlugIn indicated is installed

Parameters:
pluginId id of the PlugIn
Returns:
the index within the layer in which the PlugIn indicated is installed
See also:
PlugIn

Definition at line 360 of file node-core.cc.

References pluginIdInLayer_, and pluginNum_.

Referenced by crLayCommand(), and synchronousCrLayCommand().


Member Data Documentation

ClSAP*** NodeCore::crossLayerSAPlist_ [private]

Pointer to the array of pointers of the ClSAP installed in all levels

Definition at line 248 of file node-core.h.

Referenced by addClSAP(), getPluginID(), sendClSAP(), sendSynchronousClSAP(), and ~NodeCore().

int NodeCore::nLayer_ [private]

Number of layer in use (must be greater than 0)

Definition at line 250 of file node-core.h.

Referenced by addClSAP(), crLayCommand(), getNLayer(), synchronousCrLayCommand(), and ~NodeCore().

int* NodeCore::clsapPerLayer_ [private]

Array in which are defined the number of ClSAP for each layer

Definition at line 252 of file node-core.h.

Referenced by addClSAP(), getNClSAP(), and ~NodeCore().

int* NodeCore::pluginLayer_ [private]

Array in which are indicated the layer in which the Plugin indicated is installed

Definition at line 337 of file node-core.h.

Referenced by addClSAP(), and getLayer().

int* NodeCore::pluginIdInLayer_ [private]

Array in which are indicated the index in the layer of the Plugin indicated

Definition at line 339 of file node-core.h.

Referenced by addClSAP(), and getIdInLayer().

int NodeCore::pluginNum_ [private]

Total number of PlugIn installed

Definition at line 341 of file node-core.h.

Referenced by addClSAP(), crLayCommand(), getIdInLayer(), getLayer(), and synchronousCrLayCommand().

Position* NodeCore::position_ [private]

Pointer to the instance of the Position class of the node

Definition at line 343 of file node-core.h.

Referenced by command(), and getPosition().

double NodeCore::battery_ [private]

Value of the battery

Definition at line 345 of file node-core.h.

Referenced by battery(), and NodeCore().


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