NodeID Class Reference

Represents a unique identifier for each Fountain node in the system. More...

#include <NodeID.h>

Collaboration diagram for NodeID:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 NodeID (const std::string &ID)
 Constructor.
 NodeID (const std::string &hostname, int listenPort)
 Constructor for hostname and listen ports.
 NodeID (const NodeID &rhs)
 copy constructor
const NodeIDoperator= (const NodeID &rhs)
 Assignment operator.
 operator std::string () const
 Implicit conversion operator to std::string.
 operator const char * () const
 Implicit conversion operator to std::string.
const std::stringgetID () const
 Explicit conversion to a string object.
const std::stringgetHostname () const
 Get the hostname portion of this object.
int getListenPort () const
 Get the listen port portion of this object.
bool operator== (const NodeID &rhs) const
 equality operator
bool operator!= (const NodeID &rhs) const
 inequality operator
bool operator< (const NodeID &rhs) const
 less than operator

Private Attributes

std::string ID_
std::string hostname_
int listenPort_

Friends

std::ostreamoperator<< (std::ostream &output, const NodeID &_node)
 ostream operator

Detailed Description

Represents a unique identifier for each Fountain node in the system.

handles Fountain node identifcation in the form of hostname_listenport where hostname is the hostname truncated to the first period and listenport is the listening socket number that the Fountain node is using to accept new connections.

Definition at line 28 of file NodeID.h.


Constructor & Destructor Documentation

NodeID::NodeID const std::string ID  ) 
 

Constructor.

Exceptions:
FountainException if the ID parameter could not be parsed
Parameters:
ID The identifier string of a FountainNode

Definition at line 53 of file NodeID.cpp.

References ENFORCE, std::basic_string< _CharT, _Traits, _Alloc >::find_first_of(), hostname_, ID_, listenPort_, std::basic_string< _CharT, _Traits, _Alloc >::size(), and std::basic_string< _CharT, _Traits, _Alloc >::substr().

Here is the call graph for this function:

NodeID::NodeID const std::string hostname,
int  listenPort
 

Constructor for hostname and listen ports.

Parameters:
[in] hostname The hostname portion of the NodeID
[in] listenPort The port portion of the NodeID

Definition at line 28 of file NodeID.cpp.

References std::basic_string< _CharT, _Traits, _Alloc >::append(), std::basic_string< _CharT, _Traits, _Alloc >::c_str(), hostname, hostname_, ID_, listenPort_, and logger.

Here is the call graph for this function:


Member Function Documentation

const std::string& NodeID::getHostname  )  const [inline]
 

Get the hostname portion of this object.

Return values:
std::string the hostname portion of the NodeID

Definition at line 89 of file NodeID.h.

Referenced by FountainWireProt::Connect(), FountainNode::FountainNode(), TreeNode::getHostname(), FountainNodes::Statistics::parseNodeInfoElement(), and FountainServer::processNodeQueryResponse().

int NodeID::getListenPort  )  const [inline]
 

Get the listen port portion of this object.

Return values:
int The listening port of the NodeID

Definition at line 95 of file NodeID.h.

Referenced by FountainWireProt::Connect(), FountainNode::FountainNode(), and TreeNode::getListenPort().

bool NodeID::operator!= const NodeID rhs  )  const [inline]
 

inequality operator

Parameters:
[in] rhs The NodeID object to compare with
Return values:
false if the two NodeID objects are lexicographically equal, true otherwise

Definition at line 109 of file NodeID.h.

References ID_.

bool NodeID::operator< const NodeID rhs  )  const [inline]
 

less than operator

Parameters:
[in] rhs The NodeID object to compare with
Return values:
bool true if the this NodeID is lexicographically less than the rhs NodeID, false otherwise

Definition at line 116 of file NodeID.h.

References ID_.

bool NodeID::operator== const NodeID rhs  )  const [inline]
 

equality operator

Parameters:
[in] rhs The NodeID object to compare with
Return values:
true if the two NodeID objects are lexicographically equal, false otherwise

Definition at line 102 of file NodeID.h.

References ID_.


Member Data Documentation

std::string NodeID::hostname_ [private]
 

The hostname

Definition at line 38 of file NodeID.h.

Referenced by NodeID(), and operator=().

std::string NodeID::ID_ [private]
 

The ID in the form of hostname_port

Definition at line 33 of file NodeID.h.

Referenced by NodeID(), operator std::string(), operator!=(), operator<(), operator<<(), operator=(), and operator==().

int NodeID::listenPort_ [private]
 

The listen port

Definition at line 43 of file NodeID.h.

Referenced by NodeID(), and operator=().


The documentation for this class was generated from the following files:
Generated on Sat Oct 21 22:53:58 2006 for Fountain by  doxygen 1.4.6