ASSA::Address Class Reference

#include <Address.h>

Inheritance diagram for ASSA::Address:

ASSA::INETAddress ASSA::UNIXAddress List of all members.

Public Types

typedef int addrstate
enum  addr_state_t { goodbit = 0, badbit = 1 }
 State bits. More...

Public Member Functions

 Address ()
 Constructor.
virtual ~Address ()
 Destructor.
bool good () const
 Valid address is constructed.
bool bad () const
 Indicates whether there was error during address construction process i.e.
 operator void * () const
 Conversion to void * (or bool) for testing where bool is required (in conditional statements).
bool operator! () const
 Alias to bad ().
virtual const int getLength () const =0
 Return length of the underlying address structure.
virtual SAgetAddress () const =0
 Retrieve pointer to the address structure.
virtual void dump ()
 Dump object state to the log file.

Protected Member Functions

void setstate (addrstate flag_)
 Set state of the Address object.

Private Attributes

unsigned char m_state

Detailed Description

Definition at line 39 of file Address.h.


Member Typedef Documentation

typedef int ASSA::Address::addrstate
 

Definition at line 46 of file Address.h.


Member Enumeration Documentation

enum ASSA::Address::addr_state_t
 

State bits.

Enumerator:
goodbit  good state
badbit  bad state

Definition at line 42 of file Address.h.

00042                       { 
00043         goodbit=0,              
00044         badbit=1                
00045     };


Constructor & Destructor Documentation

ASSA::Address::Address  )  [inline]
 

Constructor.

Definition at line 53 of file Address.h.

References trace.

00053 : m_state (Address::goodbit) { trace("Address::Address");   }

virtual ASSA::Address::~Address  )  [inline, virtual]
 

Destructor.

Definition at line 56 of file Address.h.

00056 {}


Member Function Documentation

bool ASSA::Address::bad  )  const [inline]
 

Indicates whether there was error during address construction process i.e.

host or port lookup failure or invalid format used.

Returns:
true if invalid address, false otherwise

Definition at line 68 of file Address.h.

References badbit, and m_state.

Referenced by ASSA::Connector< SERVICE_HANDLER, PEER_CONNECTOR >::connect(), and operator!().

00068 { return m_state & Address::badbit; }

virtual void ASSA::Address::dump  )  [inline, virtual]
 

Dump object state to the log file.

Reimplemented in ASSA::INETAddress.

Definition at line 89 of file Address.h.

References DL, good(), ASSA::TRACE, and trace.

Referenced by ASSA::INETAddress::dump().

00090         {   
00091             trace("Address");
00092             DL((TRACE,"state   - %s\n", good () ? "good" : "bad"));
00093         }

virtual SA* ASSA::Address::getAddress  )  const [pure virtual]
 

Retrieve pointer to the address structure.

Implemented in ASSA::INETAddress, and ASSA::UNIXAddress.

Referenced by ASSA::UDPSocket::bind(), ASSA::IPv4Socket::bind(), ASSA::IPv4Socket::connect(), ASSA::ConUDPSocket::connect(), ASSA::Acceptor< SERVICE_HANDLER, PEER_ACCEPTOR >::open(), ASSA::UnConUDPSocket::recvfrom(), and ASSA::UnConUDPSocket::sendto().

virtual const int ASSA::Address::getLength  )  const [pure virtual]
 

Return length of the underlying address structure.

Implemented in ASSA::INETAddress, and ASSA::UNIXAddress.

Referenced by ASSA::UDPSocket::bind(), ASSA::IPv4Socket::bind(), ASSA::IPv4Socket::connect(), ASSA::ConUDPSocket::connect(), ASSA::UnConUDPSocket::recvfrom(), and ASSA::UnConUDPSocket::sendto().

bool ASSA::Address::good  )  const [inline]
 

Valid address is constructed.

Returns:
true if valid address, false otherwise

Definition at line 61 of file Address.h.

References m_state.

Referenced by dump(), and operator void *().

00061 { return m_state == 0; }

ASSA::Address::operator void *  )  const [inline]
 

Conversion to void * (or bool) for testing where bool is required (in conditional statements).

Returns:
true if valid address; false otherwise

Definition at line 74 of file Address.h.

References good().

00074 { return (void*) good (); }

bool ASSA::Address::operator!  )  const [inline]
 

Alias to bad ().

Returns:
true if invaid address; false otherwise.

Definition at line 79 of file Address.h.

References bad().

00079 { return bad (); }

void ASSA::Address::setstate addrstate  flag_  )  [inline, protected]
 

Set state of the Address object.

Parameters:
flag_ new state

Definition at line 99 of file Address.h.

References m_state.

Referenced by ASSA::INETAddress::createHostPort(), ASSA::INETAddress::getHostName(), ASSA::INETAddress::getServiceByName(), and ASSA::UNIXAddress::UNIXAddress().

00099 { m_state |= flag_; }


Member Data Documentation

unsigned char ASSA::Address::m_state [private]
 

Definition at line 49 of file Address.h.

Referenced by bad(), good(), and setstate().


The documentation for this class was generated from the following file:
Generated on Mon Dec 19 16:37:16 2005 for libassa by  doxygen 1.4.5