BrooseHandle Class Reference

#include <BrooseHandle.h>

Inheritance diagram for BrooseHandle:
NodeHandle TransportAddress

List of all members.

Public Member Functions

 BrooseHandle ()
 BrooseHandle (OverlayKey initKey, IPvXAddress initIP, int initPort)
 BrooseHandle (const NodeHandle &node)
 BrooseHandle (const TransportAddress &node, const OverlayKey &destKey)
bool operator== (const BrooseHandle &rhs) const
bool operator!= (const BrooseHandle &rhs) const
BrooseHandleoperator= (const BrooseHandle &rhs)

Static Public Member Functions

static const BrooseHandleunspecifiedNode ()

Public Attributes

int failedResponses
simtime_t rtt
simtime_t lastSeen

Static Private Attributes

static const BrooseHandle_unspecifiedNode = NULL

Friends

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

Detailed Description

Definition at line 29 of file BrooseHandle.h.


Constructor & Destructor Documentation

BrooseHandle::BrooseHandle (  ) 

Definition at line 42 of file BrooseHandle.cc.

Referenced by unspecifiedNode().

00043 {
00044     //
00045     // Default-constructor.
00046     //
00047     port = -1;
00048     key = OverlayKey::UNSPECIFIED_KEY;
00049     failedResponses = 0;
00050     rtt = -1;
00051     lastSeen = -1;
00052 }

BrooseHandle::BrooseHandle ( OverlayKey  initKey,
IPvXAddress  initIP,
int  initPort 
)

Definition at line 54 of file BrooseHandle.cc.

00055 {
00056     //
00057     // Constructor. Initializes the node handle with the passed arguments.
00058     //
00059     ip = initIP;
00060     port = initPort;
00061     key = initKey;
00062     failedResponses = 0;
00063     rtt = -1;
00064     lastSeen = -1;
00065 }

BrooseHandle::BrooseHandle ( const NodeHandle node  ) 

Definition at line 67 of file BrooseHandle.cc.

00068 {
00069     //
00070     // Constructor. Initializes the node handle with the passed arguments.
00071     //
00072     ip = node.getAddress();
00073     port = node.getPort();
00074     key = node.getKey();
00075     failedResponses = 0;
00076     rtt = -1;
00077     lastSeen = -1;
00078 }

BrooseHandle::BrooseHandle ( const TransportAddress node,
const OverlayKey destKey 
)

Definition at line 81 of file BrooseHandle.cc.

00082 {
00083     //
00084     // Constructor. Initializes the node handle with the passed arguments.
00085     //
00086     ip = node.getAddress();
00087     port = node.getPort();
00088     key = destKey;
00089     rtt = -1;
00090     lastSeen = -1;
00091 }


Member Function Documentation

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

Definition at line 119 of file BrooseHandle.cc.

00120 {
00121     if(this->isUnspecified() || rhs.isUnspecified())
00122         opp_error("BrooseHandle: Trying to compare unspecified nodeHandle!");
00123 
00124     if ( this->key == rhs.getKey() &&
00125          this->ip == rhs.getAddress() && this->port == rhs.getPort())
00126         return false;
00127     return true;
00128 }

BrooseHandle & BrooseHandle::operator= ( const BrooseHandle rhs  ) 

Definition at line 93 of file BrooseHandle.cc.

00094 {
00095 
00096     this->key = rhs.getKey();
00097     this->ip = rhs.getAddress();
00098     this->port = rhs.getPort();
00099     this->failedResponses = rhs.failedResponses;
00100     this->rtt = rhs.rtt;
00101     this->lastSeen = rhs.lastSeen;
00102     return *this;
00103 }

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

Definition at line 105 of file BrooseHandle.cc.

00106 {
00107     if(this->isUnspecified() || rhs.isUnspecified())
00108         opp_error("BrooseHandle: Trying to compare unspecified nodeHandle!");
00109 
00110     if( this->key != rhs.getKey() )
00111         return false;
00112     if( this->ip != rhs.getAddress() )
00113         return false;
00114     if( this->port != rhs.getPort() )
00115         return false;
00116     return true;
00117 }

static const BrooseHandle& BrooseHandle::unspecifiedNode (  )  [inline, static]

Definition at line 45 of file BrooseHandle.h.

Referenced by BrooseBucket::get().

00046         {
00047             if (!_unspecifiedNode)
00048                 _unspecifiedNode = new BrooseHandle();
00049             return *_unspecifiedNode;
00050         }


Friends And Related Function Documentation

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

Definition at line 30 of file BrooseHandle.cc.

00031 {
00032     if (n.isUnspecified()) {
00033         os << "<unspec>";
00034     } else {
00035         os << n.getAddress() << ":" << n.getPort() << " " << n.getKey() << " last-seen: " << n.lastSeen
00036            << " failedResponses: " << n.failedResponses << " rtt: " << n.rtt;
00037     }
00038 
00039     return os;
00040 };


Member Data Documentation

const BrooseHandle * BrooseHandle::_unspecifiedNode = NULL [static, private]

Definition at line 43 of file BrooseHandle.h.

Referenced by unspecifiedNode().

Definition at line 32 of file BrooseHandle.h.

Referenced by BrooseHandle(), operator<<(), and operator=().

Definition at line 34 of file BrooseHandle.h.

Referenced by BrooseHandle(), operator<<(), operator=(), and BrooseBucket::output().

simtime_t BrooseHandle::rtt

Definition at line 33 of file BrooseHandle.h.

Referenced by BrooseHandle(), operator<<(), operator=(), and BrooseBucket::output().


The documentation for this class was generated from the following files:
Generated on Wed May 26 16:21:16 2010 for OverSim by  doxygen 1.6.3