GiaNode Class Reference

#include <GiaNode.h>

List of all members.


Detailed Description

This class represents a node in gia overlay network.


Public Member Functions

 GiaNode ()
 GiaNode (const NodeHandle &nHandle, double capacity=0, int degree=0)
void setNodeHandle (const NodeHandle &nHandle)
 Set NodeHandle.
const NodeHandlegetNodeHandle () const
 Get NodeHandle.
void setCapacity (double capacity)
 Set capacity (function of bandwidth, cpu power and HDD-fitness.
double getCapacity () const
 Get capacity.
void setConnectionDegree (uint degree)
 Set number of neighbors.
uint getConnectionDegree () const
 Get connection degree.
void setReceivedTokens (uint tokenNr)
 Set number of received tokens.
uint getReceivedTokens () const
 Get number of received tokens.
void setSentTokens (uint tokenNr)
 Set number of sent tokens.
uint getSentTokens () const
 Get number of sent tokens.
bool isUnspecified () const
bool operator== (const GiaNode &rhs) const
bool operator!= (const GiaNode &rhs) const

Static Public Attributes

static const GiaNode UNSPECIFIED_NODE

Protected Attributes

NodeHandle nodeHandle
double capacity
 NodeHandle of this node.
uint connectionDegree
 capacity of this node
uint receivedTokens
 connection degree (number of current neighbors) of this node
uint sentTokens
 received tokens from another neighbor
bool specified
 sent tokens to another neighbor

Friends

std::ostream & operator<< (std::ostream &os, const GiaNode &n)


Constructor & Destructor Documentation

GiaNode::GiaNode (  ) 

00037 {
00038     specified = false;
00039     //GiaNode(NodeHandle(), 0, 0);
00040 }

GiaNode::GiaNode ( const NodeHandle nHandle,
double  capacity = 0,
int  degree = 0 
)

00048 {
00049     nodeHandle = nHandle;
00050     capacity = cap;
00051     connectionDegree = degree;
00052     receivedTokens = 3;
00053     sentTokens = 3;
00054 
00055     specified = true;
00056 }


Member Function Documentation

double GiaNode::getCapacity (  )  const

Get capacity.

Returns:
GiaNode
00069 {
00070     return capacity;
00071 }

uint GiaNode::getConnectionDegree (  )  const

Get connection degree.

Returns:
number of neighbors
00079 {
00080     return connectionDegree;
00081 }

const NodeHandle & GiaNode::getNodeHandle (  )  const

Get NodeHandle.

Returns:
NodeHandle
00059 {
00060     return nodeHandle;
00061 }

uint GiaNode::getReceivedTokens (  )  const

Get number of received tokens.

Returns:
Number of received tokens
00089 {
00090     return receivedTokens;
00091 }

uint GiaNode::getSentTokens (  )  const

Get number of sent tokens.

Returns:
Number of sent tokens
00099 {
00100     return sentTokens;
00101 }

bool GiaNode::isUnspecified (  )  const [inline]

00110     {
00111         return !specified;
00112     };

bool GiaNode::operator!= ( const GiaNode rhs  )  const

00124 {
00125     if(this->getNodeHandle() == rhs.getNodeHandle())
00126         return false;
00127     return true;
00128 }

bool GiaNode::operator== ( const GiaNode rhs  )  const

00117 {
00118     if(this->getNodeHandle() != rhs.getNodeHandle())
00119         return false;
00120     return true;
00121 }

void GiaNode::setCapacity ( double  capacity  ) 

Set capacity (function of bandwidth, cpu power and HDD-fitness.

Parameters:
capacity Capacity to set
00064 {
00065     capacity = cap;
00066 }

void GiaNode::setConnectionDegree ( uint  degree  ) 

Set number of neighbors.

Parameters:
degree Number of neighbors
00074 {
00075     connectionDegree = degree;
00076 }

void GiaNode::setNodeHandle ( const NodeHandle nHandle  ) 

Set NodeHandle.

Parameters:
nHandle NodeHandle to set
00032 {
00033     nodeHandle = nHandle;
00034 }

void GiaNode::setReceivedTokens ( uint  tokenNr  ) 

Set number of received tokens.

Parameters:
tokenNr Number of tokens
00084 {
00085     receivedTokens = tokenNr;
00086 }

void GiaNode::setSentTokens ( uint  tokenNr  ) 

Set number of sent tokens.

Parameters:
tokenNr Number of tokens
00094 {
00095     sentTokens = tokenNr;
00096 }


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const GiaNode n 
) [friend]

00104 {
00105     if(n.nodeHandle.ip.isUnspecified() == true && n.nodeHandle.key.isUnspecified() && n.nodeHandle.port == -1) {
00106         os << "<unspec>";
00107     } else {
00108         os << n.nodeHandle.ip << ":" << n.nodeHandle.port << " "
00109         << n.nodeHandle.key.toString() << " with capacity: "
00110         << n.capacity << " , degree: " << n.connectionDegree
00111         << " , sentTokens: " << n.sentTokens << " , receivedTokens: " << n.receivedTokens;
00112     }
00113     return os;
00114 }


Member Data Documentation

double GiaNode::capacity [protected]

NodeHandle of this node.

uint GiaNode::connectionDegree [protected]

capacity of this node

NodeHandle GiaNode::nodeHandle [protected]

uint GiaNode::receivedTokens [protected]

connection degree (number of current neighbors) of this node

uint GiaNode::sentTokens [protected]

received tokens from another neighbor

bool GiaNode::specified [protected]

sent tokens to another neighbor

const GiaNode GiaNode::UNSPECIFIED_NODE [static]


The documentation for this class was generated from the following files:
Generated on Wed Apr 4 13:37:06 2007 for ITM OverSim by  doxygen 1.4.7