ChordFingerTable Class Reference

#include <ChordFingerTable.h>

List of all members.


Detailed Description

Chord's finger table module.

This modul contains the finger table of the Chord implementation.

Author:
Markus Mauch, Ingmar Baumgart
See also:
Chord


Public Member Functions

virtual int numInitStages () const
virtual void initialize (int stage)
virtual void handleMessage (cMessage *msg)
virtual void initializeTable (uint size, NodeHandle owner)
 Sets up the finger table.
virtual void setFinger (uint pos, NodeHandle node)
 Sets a particular finger to point to node.
virtual const NodeHandlegetFinger (uint pos)
 Returns the NodeHandle of a particular finger.
virtual uint getSize ()
 Returns the size of the finger table.

Protected Attributes

std::vector< NodeHandlefingerTable
 the finger table vector


Member Function Documentation

const NodeHandle & ChordFingerTable::getFinger ( uint  pos  )  [virtual]

Returns the NodeHandle of a particular finger.

Parameters:
pos number of the finger to get
Returns:
NodeHandle of the particular finger
00070 {
00071     if (pos >= fingerTable.size())
00072         error("Index out of bound (ChordFingerTable, getFinger())");
00073 
00074     return fingerTable[pos];
00075 }

uint ChordFingerTable::getSize (  )  [virtual]

Returns the size of the finger table.

Returns:
number of fingers
00056 {
00057     return fingerTable.size();
00058 }

void ChordFingerTable::handleMessage ( cMessage *  msg  )  [virtual]

00046 {
00047     error("this module doesn't handle messages, it runs only in initialize()");
00048 }

void ChordFingerTable::initialize ( int  stage  )  [virtual]

00036 {
00037     // because of IPAddressResolver, we need to wait until interfaces
00038     // are registered, address auto-assignment takes place etc.
00039     if(stage != MIN_STAGE_OVERLAY)
00040         return;
00041 
00042     WATCH_VECTOR(fingerTable);
00043 }

void ChordFingerTable::initializeTable ( uint  size,
NodeHandle  owner 
) [virtual]

Sets up the finger table.

Sets up the finger table and makes all fingers pointing to the node itself. Should be called on startup to initialize the finger table.

Parameters:
size number of fingers
owner set all fingers to the key of node handle owner
00051 {
00052     fingerTable.assign(size, owner);
00053 }

virtual int ChordFingerTable::numInitStages (  )  const [inline, virtual]

00046     {
00047         return MAX_STAGE_OVERLAY + 1;
00048     }

void ChordFingerTable::setFinger ( uint  pos,
NodeHandle  node 
) [virtual]

Sets a particular finger to point to node.

Parameters:
pos number of the finger to set
node set finger to this node
00061 {
00062     if (pos < fingerTable.size()) {
00063         fingerTable[pos] = node;
00064     } else {
00065         error("Index out of bound (ChordFingerTable, setFinger())");
00066     }
00067 }


Member Data Documentation

std::vector<NodeHandle> ChordFingerTable::fingerTable [protected]

the finger table vector


The documentation for this class was generated from the following files:
Generated on Fri May 11 14:52:39 2007 for ITM OverSim by  doxygen 1.4.7