OverSim
|
This class is for managing all neighbor nodes. More...
#include <GiaNeighbors.h>
Public Member Functions | |
virtual int | numInitStages () const |
Sets init stage. | |
virtual void | initialize (int stage) |
Initializes this class and set some WATCH(variable) for OMNeT++. | |
virtual void | handleMessages (cMessage *msg) |
This module doesn't handle OMNeT++ messages. | |
virtual unsigned int | getSize () const |
virtual bool | contains (const GiaNode &node) const |
virtual bool | contains (const OverlayKey &key) const |
virtual void | add (const GiaNode &node, unsigned int degree) |
Adds a new neighbor to our neighbor list. | |
virtual void | remove (const GiaNode &node) |
Removes neighbor from our neighbor list. | |
virtual const GiaNode & | get (unsigned int position) |
Get neighbor at position. | |
virtual const GiaNode & | get (const OverlayKey &key) |
Get node from neighborlist. | |
GiaNeighborInfo * | get (const GiaNode &node) |
void | updateTimestamp (const GiaNode &node) |
Update timestamp. | |
void | removeTimedoutNodes () |
Removes timedout nodes. | |
void | setNeighborKeyList (const GiaNode &node, const GiaKeyList &keyList) |
Sets the keyList of neighbor at position pos. | |
GiaKeyList * | getNeighborKeyList (const GiaNode &node) |
double | getCapacity (const GiaNode &node) const |
void | setConnectionDegree (const GiaNode &node, unsigned int degree) |
unsigned int | getConnectionDegree (const GiaNode &node) const |
void | setReceivedTokens (const GiaNode &node, unsigned int tokens) |
void | increaseReceivedTokens (const GiaNode &node) |
void | decreaseReceivedTokens (const GiaNode &node) |
unsigned int | getReceivedTokens (const GiaNode &node) const |
void | setSentTokens (const GiaNode &node, unsigned int tokens) |
void | increaseSentTokens (const GiaNode &node) |
unsigned int | getSentTokens (const GiaNode &node) const |
const GiaNode & | getDropCandidate (double capacity, unsigned int degree) const |
Protected Types | |
typedef std::map< GiaNode, GiaNeighborInfo >::iterator | NeighborsIterator |
typedef std::map< GiaNode, GiaNeighborInfo > ::const_iterator | NeighborsConstIterator |
Protected Attributes | |
std::map< GiaNode, GiaNeighborInfo > | neighbors |
contains all current neighbors | |
GiaNode | thisNode |
simtime_t | timeout |
this node |
This class is for managing all neighbor nodes.
Definition at line 59 of file GiaNeighbors.h.
|
protected |
Definition at line 172 of file GiaNeighbors.h.
|
protected |
Definition at line 171 of file GiaNeighbors.h.
|
virtual |
Adds a new neighbor to our neighbor list.
node | New neighbor to add |
degree | The new neighbor's connection degree |
Definition at line 77 of file GiaNeighbors.cc.
Referenced by Gia::addNeighbor().
|
virtual |
node | GiaNode to check |
Definition at line 68 of file GiaNeighbors.cc.
Referenced by Gia::acceptNode(), Gia::forwardMessage(), Gia::handleTimerEvent(), and Gia::updateNeighborList().
|
virtual |
key | to check |
Definition at line 55 of file GiaNeighbors.cc.
void GiaNeighbors::decreaseReceivedTokens | ( | const GiaNode & | node | ) |
Definition at line 235 of file GiaNeighbors.cc.
Referenced by Gia::forwardMessage().
|
virtual |
Get neighbor at position.
position |
Definition at line 103 of file GiaNeighbors.cc.
Referenced by GiaMessageBookkeeping::addMessage(), Gia::calculateLevelOfSatisfaction(), GiaTokenFactory::createPriorityQueue(), Gia::forwardMessage(), Gia::forwardSearchResponseMessage(), GiaMessageBookkeeping::getNextHop(), Gia::handleTimerEvent(), Gia::processSearchMessage(), Gia::sendMessage_JOIN_ACK(), and Gia::sendMessage_JOIN_RSP().
|
virtual |
Get node from neighborlist.
key | the node's key |
Definition at line 126 of file GiaNeighbors.cc.
GiaNeighborInfo * GiaNeighbors::get | ( | const GiaNode & | node | ) |
Definition at line 115 of file GiaNeighbors.cc.
double GiaNeighbors::getCapacity | ( | const GiaNode & | node | ) | const |
Definition at line 181 of file GiaNeighbors.cc.
unsigned int GiaNeighbors::getConnectionDegree | ( | const GiaNode & | node | ) | const |
Definition at line 198 of file GiaNeighbors.cc.
const GiaNode & GiaNeighbors::getDropCandidate | ( | double | capacity, |
unsigned int | degree | ||
) | const |
Definition at line 280 of file GiaNeighbors.cc.
Referenced by Gia::acceptNode().
GiaKeyList * GiaNeighbors::getNeighborKeyList | ( | const GiaNode & | node | ) |
Definition at line 172 of file GiaNeighbors.cc.
Referenced by Gia::processSearchMessage().
unsigned int GiaNeighbors::getReceivedTokens | ( | const GiaNode & | node | ) | const |
Definition at line 243 of file GiaNeighbors.cc.
unsigned int GiaNeighbors::getSentTokens | ( | const GiaNode & | node | ) | const |
Definition at line 271 of file GiaNeighbors.cc.
|
virtual |
Definition at line 50 of file GiaNeighbors.cc.
Referenced by Gia::acceptNode(), GiaMessageBookkeeping::addMessage(), Gia::addNeighbor(), Gia::calculateLevelOfSatisfaction(), GiaTokenFactory::createPriorityQueue(), get(), GiaMessageBookkeeping::getNextHop(), GiaTokenFactory::grantToken(), Gia::handleTimerEvent(), Gia::handleUDPMessage(), Gia::processSearchMessage(), Gia::removeNeighbor(), Gia::sendMessage_JOIN_ACK(), Gia::sendMessage_JOIN_RSP(), and Gia::updateTooltip().
|
virtual |
This module doesn't handle OMNeT++ messages.
msg | OMNeT++ message |
Definition at line 45 of file GiaNeighbors.cc.
void GiaNeighbors::increaseReceivedTokens | ( | const GiaNode & | node | ) |
Definition at line 227 of file GiaNeighbors.cc.
Referenced by Gia::handleUDPMessage().
void GiaNeighbors::increaseSentTokens | ( | const GiaNode & | node | ) |
Definition at line 263 of file GiaNeighbors.cc.
|
virtual |
Initializes this class and set some WATCH(variable) for OMNeT++.
stage | Level of initialization (OMNeT++) |
Definition at line 33 of file GiaNeighbors.cc.
|
inlinevirtual |
|
virtual |
Removes neighbor from our neighbor list.
node | Node to remove to |
Definition at line 98 of file GiaNeighbors.cc.
Referenced by Gia::acceptNode(), and Gia::removeNeighbor().
void GiaNeighbors::removeTimedoutNodes | ( | ) |
Removes timedout nodes.
Definition at line 147 of file GiaNeighbors.cc.
Referenced by Gia::handleTimerEvent().
void GiaNeighbors::setConnectionDegree | ( | const GiaNode & | node, |
unsigned int | degree | ||
) |
Definition at line 207 of file GiaNeighbors.cc.
Referenced by Gia::handleUDPMessage(), and Gia::updateNeighborList().
void GiaNeighbors::setNeighborKeyList | ( | const GiaNode & | node, |
const GiaKeyList & | keyList | ||
) |
Sets the keyList of neighbor at position pos.
node | the node the keylist belongs to |
keyList | KeyList to set |
Definition at line 163 of file GiaNeighbors.cc.
Referenced by Gia::handleUDPMessage().
void GiaNeighbors::setReceivedTokens | ( | const GiaNode & | node, |
unsigned int | tokens | ||
) |
Definition at line 216 of file GiaNeighbors.cc.
void GiaNeighbors::setSentTokens | ( | const GiaNode & | node, |
unsigned int | tokens | ||
) |
Definition at line 253 of file GiaNeighbors.cc.
void GiaNeighbors::updateTimestamp | ( | const GiaNode & | node | ) |
Update timestamp.
Definition at line 139 of file GiaNeighbors.cc.
Referenced by Gia::updateNeighborList().
|
protected |
contains all current neighbors
Definition at line 170 of file GiaNeighbors.h.
Referenced by add(), contains(), decreaseReceivedTokens(), get(), getCapacity(), getConnectionDegree(), getDropCandidate(), getNeighborKeyList(), getReceivedTokens(), getSentTokens(), getSize(), increaseReceivedTokens(), increaseSentTokens(), initialize(), remove(), removeTimedoutNodes(), setConnectionDegree(), setNeighborKeyList(), setReceivedTokens(), setSentTokens(), and updateTimestamp().
|
protected |
Definition at line 173 of file GiaNeighbors.h.
|
protected |
this node
Definition at line 174 of file GiaNeighbors.h.
Referenced by initialize(), and removeTimedoutNodes().