#include <GiaNode.h>
Public Member Functions | |
GiaNode () | |
GiaNode (const NodeHandle &nHandle, double capacity=0, int degree=0) | |
void | setNodeHandle (const NodeHandle &nHandle) |
Set NodeHandle. | |
const NodeHandle & | getNodeHandle () 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) |
GiaNode::GiaNode | ( | ) |
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 }
double GiaNode::getCapacity | ( | ) | const |
uint GiaNode::getConnectionDegree | ( | ) | const |
const NodeHandle & GiaNode::getNodeHandle | ( | ) | const |
uint GiaNode::getReceivedTokens | ( | ) | const |
Get number of received tokens.
00089 { 00090 return receivedTokens; 00091 }
uint GiaNode::getSentTokens | ( | ) | const |
bool GiaNode::isUnspecified | ( | ) | const [inline] |
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.
capacity | Capacity to set |
00064 { 00065 capacity = cap; 00066 }
void GiaNode::setConnectionDegree | ( | uint | degree | ) |
Set number of neighbors.
degree | Number of neighbors |
00074 { 00075 connectionDegree = degree; 00076 }
void GiaNode::setNodeHandle | ( | const NodeHandle & | nHandle | ) |
void GiaNode::setReceivedTokens | ( | uint | tokenNr | ) |
Set number of received tokens.
tokenNr | Number of tokens |
00084 { 00085 receivedTokens = tokenNr; 00086 }
void GiaNode::setSentTokens | ( | uint | tokenNr | ) |
Set number of sent tokens.
tokenNr | Number of tokens |
00094 { 00095 sentTokens = tokenNr; 00096 }
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 }
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] |