#include <NodeHandle.h>
It covers the complete node information, like IP-Address, port, NodeKey and some additional flags for Simulation behaviour. The information can be sparse, so parts can be omited by setting the property to an unspecified value.
Public Types | |
typedef hash_set < NodeHandle, hashFcn > | Set |
a hash_set of NodeHandles | |
Public Member Functions | |
NodeHandle () | |
Constructs an unspecified NodeHandle. | |
virtual | ~NodeHandle () |
Standard destructor. | |
NodeHandle (const NodeHandle &handle) | |
Copy constructor. | |
NodeHandle (const OverlayKey &key, const IPvXAddress &ip, int port) | |
Complete constructor. | |
bool | operator== (const NodeHandle &rhs) const |
compares this NodeHandle to another given NodeHandle | |
bool | operator!= (const NodeHandle &rhs) const |
compares this NodeHandle to another given NodeHandle | |
bool | operator< (const NodeHandle &rhs) const |
compares this to a given NodeHandle | |
bool | operator> (const NodeHandle &rhs) const |
compares this to a given NodeHandle | |
bool | operator<= (const NodeHandle &rhs) const |
compares this to a given NodeHandle | |
bool | operator>= (const NodeHandle &rhs) const |
compares this to a given NodeHandle | |
NodeHandle & | operator= (const NodeHandle &rhs) |
assigns key, ip and port of rhs to this->key, this->ip and this->port | |
void | setKey (const OverlayKey &key) |
saves given key to NodeHandle::key | |
const OverlayKey & | getKey () const |
returns key of this NodeHandle | |
bool | isUnspecified () const |
indicates if this NodeHandle is specified | |
virtual void | netPack (cCommBuffer *b) |
serializes the object into a buffer | |
virtual void | netUnpack (cCommBuffer *b) |
deserializes the object from a buffer | |
Public Attributes | |
OverlayKey | key |
the OverlayKey of this NodeHandle | |
Static Public Attributes | |
static const NodeHandle | UNSPECIFIED_NODE |
the unspecified NodeHandle | |
Private Member Functions | |
void | assertUnspecified (const NodeHandle &handle) const |
throws an opp_error if this or handle is unspecified | |
Friends | |
std::ostream & | operator<< (std::ostream &os, const NodeHandle &n) |
standard output stream for NodeHandle, gives out ip, port and key |
typedef hash_set<NodeHandle, hashFcn> NodeHandle::Set |
NodeHandle::NodeHandle | ( | ) |
Constructs an unspecified NodeHandle.
00044 { 00045 port = -1; 00046 key = OverlayKey::UNSPECIFIED_KEY; 00047 }
NodeHandle::NodeHandle | ( | const NodeHandle & | handle | ) |
NodeHandle::NodeHandle | ( | const OverlayKey & | key, | |
const IPvXAddress & | ip, | |||
int | port | |||
) |
bool NodeHandle::operator== | ( | const NodeHandle & | rhs | ) | const |
compares this NodeHandle to another given NodeHandle
rhs | the NodeHandle this is compared to |
00085 { 00086 assertUnspecified( rhs ); 00087 return ( this->key == rhs.key && 00088 this->ip == rhs.ip && this->port == rhs.port ); 00089 }
bool NodeHandle::operator!= | ( | const NodeHandle & | rhs | ) | const |
compares this NodeHandle to another given NodeHandle
rhs | the NodeHandle this is compared to |
00093 { 00094 assertUnspecified( rhs ); 00095 return !( this->key == rhs.key && 00096 this->ip == rhs.ip && this->port == rhs.port ); 00097 }
bool NodeHandle::operator< | ( | const NodeHandle & | rhs | ) | const |
compares this to a given NodeHandle
rhs | the NodeHandle this is compared to |
00101 { 00102 assertUnspecified(rhs); 00103 return this->key < rhs.key; 00104 }
bool NodeHandle::operator> | ( | const NodeHandle & | rhs | ) | const |
compares this to a given NodeHandle
rhs | the NodeHandle this is compared to |
00108 { 00109 assertUnspecified(rhs); 00110 return this->key > rhs.key; 00111 }
bool NodeHandle::operator<= | ( | const NodeHandle & | rhs | ) | const |
compares this to a given NodeHandle
rhs | the NodeHandle this is compared to |
00115 { 00116 assertUnspecified(rhs); 00117 return this->key <= rhs.key; 00118 }
bool NodeHandle::operator>= | ( | const NodeHandle & | rhs | ) | const |
compares this to a given NodeHandle
rhs | the NodeHandle this is compared to |
00122 { 00123 assertUnspecified(rhs); 00124 return this->key >= rhs.key; 00125 }
NodeHandle & NodeHandle::operator= | ( | const NodeHandle & | rhs | ) |
assigns key, ip and port of rhs to this->key, this->ip and this->port
rhs | the NodeHandle with the defined key, ip and port |
Reimplemented in GiaNode.
00075 { 00076 this->key = rhs.key; 00077 this->ip = rhs.ip; 00078 this->port = rhs.port; 00079 00080 return *this; 00081 }
void NodeHandle::setKey | ( | const OverlayKey & | key | ) |
const OverlayKey & NodeHandle::getKey | ( | ) | const |
bool NodeHandle::isUnspecified | ( | ) | const |
indicates if this NodeHandle is specified
Reimplemented from TransportAddress.
00069 { 00070 return (ip.isUnspecified() || key.isUnspecified()); 00071 }
void NodeHandle::assertUnspecified | ( | const NodeHandle & | handle | ) | const [inline, private] |
throws an opp_error if this or handle is unspecified
handle | the NodeHandle to check |
00142 { 00143 if ( this->isUnspecified() || handle.isUnspecified() ) 00144 opp_error("NodeHandle: Trying to compare unspecified NodeHandle!"); 00145 }
void NodeHandle::netPack | ( | cCommBuffer * | b | ) | [virtual] |
serializes the object into a buffer
b | the buffer |
Reimplemented from TransportAddress.
00189 { 00190 //cMessage::netPack(b); 00191 doPacking(b,this->ip); 00192 doPacking(b,this->key); 00193 doPacking(b,this->port); 00194 }
void NodeHandle::netUnpack | ( | cCommBuffer * | b | ) | [virtual] |
deserializes the object from a buffer
b | the buffer |
Reimplemented from TransportAddress.
00197 { 00198 //cMessage::netUnpack(b); 00199 doUnpacking(b,this->ip); 00200 doUnpacking(b,this->key); 00201 doUnpacking(b,this->port); 00202 }
std::ostream& operator<< | ( | std::ostream & | os, | |
const NodeHandle & | n | |||
) | [friend] |
standard output stream for NodeHandle, gives out ip, port and key
os | the ostream | |
n | the NodeHandle |
00031 { 00032 if (n.isUnspecified()) { 00033 os << "<unspec>"; 00034 } else { 00035 os << n.ip << ":" << n.port << " " << n.key; 00036 } 00037 00038 return os; 00039 };
the OverlayKey of this NodeHandle
const NodeHandle NodeHandle::UNSPECIFIED_NODE [static] |
the unspecified NodeHandle
Reimplemented from TransportAddress.
Reimplemented in BrooseHandle, and GiaNode.