CarobNS::ControllerInfo Class Reference

Identifies a controller. More...

#include <ControllerInfo.hpp>

List of all members.

Public Member Functions

 ControllerInfo ()
 Empty contructor does nothing.
 ControllerInfo (const std::wstring &host, in_port_t port) throw (ConnectionException, UnexpectedException)
 Constructs a Controller info with the given name and port.
 ControllerInfo (const ControllerInfo &ci) throw (ConnectionException, UnexpectedException)
 Copy contructor.
 ~ControllerInfo ()
 Frees addrinfo.
DriverSocketconnect (AbstractControllerPool &pool) throw (ConnectionException, UnexpectedException)
 Tries to connect to this controller and returns the connected socket, or throw ConnectionException in case of failure.
ControllerInfooperator= (const ControllerInfo &ci)
 Copy operator.
bool operator< (const ControllerInfo &ci) const
 Less than operator used by ControllerPoolManager.
bool operator== (const ControllerInfo &ci) const
 Comparison operator, uses < operator.
const SocketAddressgetSocketAddress () const
 Returns the socket address associated to this controller.
 operator std::wstring () const
 Cast to wstring operator to ease printing (for debug/traces).

Friends

std::wostream & operator<< (std::wostream &ostr, const ControllerInfo &ci)
 Pretty printer for controller info.


Detailed Description

Identifies a controller.


This class holds the socket address to connect to and send/receive pings to/from, plus the original hostname (for debug)


Constructor & Destructor Documentation

CarobNS::ControllerInfo::ControllerInfo ( const std::wstring &  host,
in_port_t  port 
) throw (ConnectionException, UnexpectedException)

Constructs a Controller info with the given name and port.


This constructor is the one used at init time, by the user. It will determine the socket address to connect to and to send/receive pings to/from, which will be the first one returned by getaddrinfo()

Parameters:
host hostname as a string. Can be either qualified name or numeric
port host port
Exceptions:
ConnectionException if the given hostname cannot be resolved

CarobNS::ControllerInfo::ControllerInfo ( const ControllerInfo ci  )  throw (ConnectionException, UnexpectedException)

Copy contructor.

Calls = operator

Parameters:
ci original controller to copy from
Exceptions:
ConnectionException in case of memory allocation failure


Member Function Documentation

DriverSocket* CarobNS::ControllerInfo::connect ( AbstractControllerPool pool  )  throw (ConnectionException, UnexpectedException)

Tries to connect to this controller and returns the connected socket, or throw ConnectionException in case of failure.

Warning: Property of the created socket is transfered to caller, it is its job to delete it!

Parameters:
pool the controller pool that manages us, in order to register the socket

CarobNS::ControllerInfo::operator std::wstring (  )  const

Cast to wstring operator to ease printing (for debug/traces).

Returns:
sql query as a string

ControllerInfo& CarobNS::ControllerInfo::operator= ( const ControllerInfo ci  ) 

Copy operator.

Parameters:
ci controller to copy informations from
Exceptions:
ConnectionException in case of memory allocation failure


Friends And Related Function Documentation

std::wostream& operator<< ( std::wostream &  ostr,
const ControllerInfo ci 
) [friend]

Pretty printer for controller info.


Prints: <given/original hostname> (<resolved name/port>)

Parameters:
ostr the wide stream to print to
ci controller info to be pretty printed to ostr


The documentation for this class was generated from the following file:
Generated on Fri Mar 9 17:40:20 2007 for Carob by  doxygen 1.4.7