libassa  3.5.1
Public Types | Public Member Functions | Protected Member Functions | Private Attributes | List of all members
ASSA::Address Class Referenceabstract

#include <Address.h>

Inheritance diagram for ASSA::Address:
ASSA::INETAddress ASSA::UNIXAddress

Public Types

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

Public Member Functions

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

Protected Member Functions

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

Private Attributes

unsigned char m_state
 

Detailed Description

Definition at line 51 of file Address.h.

Member Typedef Documentation

Definition at line 58 of file Address.h.

Member Enumeration Documentation

State bits.

Enumerator
goodbit 

good state

badbit 

bad state

Definition at line 54 of file Address.h.

54  {
55  goodbit=0,
56  badbit=1
57  };
bad state
Definition: Address.h:56
good state
Definition: Address.h:55

Constructor & Destructor Documentation

ASSA::Address::Address ( )
inline

Constructor.

Definition at line 65 of file Address.h.

References trace.

65 : m_state (Address::goodbit) { trace("Address::Address"); }
#define trace(s)
trace() is used to trace function call chain in C++ program.
Definition: Logger.h:429
good state
Definition: Address.h:55
unsigned char m_state
Definition: Address.h:61
virtual ASSA::Address::~Address ( )
inlinevirtual

Destructor.

Definition at line 68 of file Address.h.

68 {}

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 80 of file Address.h.

References badbit.

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

80 { return m_state & Address::badbit; }
bad state
Definition: Address.h:56
unsigned char m_state
Definition: Address.h:61
virtual void ASSA::Address::dump ( )
inlinevirtual

Dump object state to the log file.

Reimplemented in ASSA::INETAddress.

Definition at line 101 of file Address.h.

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

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

102  {
103  trace("Address");
104  DL((TRACE,"state - %s\n", good () ? "good" : "bad"));
105  }
bool good() const
Valid address is constructed.
Definition: Address.h:73
#define trace(s)
trace() is used to trace function call chain in C++ program.
Definition: Logger.h:429
Function call trace.
Definition: LogMask.h:26
#define DL(X)
A macro for writing debug message to the Logger.
Definition: Logger.h:273
virtual SA* ASSA::Address::getAddress ( ) const
pure virtual
virtual const int ASSA::Address::getLength ( ) const
pure virtual
bool ASSA::Address::good ( ) const
inline

Valid address is constructed.

Returns
true if valid address, false otherwise

Definition at line 73 of file Address.h.

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

73 { return m_state == 0; }
unsigned char m_state
Definition: Address.h:61
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 86 of file Address.h.

References good().

86 { return (void*) good (); }
bool good() const
Valid address is constructed.
Definition: Address.h:73
bool ASSA::Address::operator! ( ) const
inline

Alias to bad ().

Returns
true if invaid address; false otherwise.

Definition at line 91 of file Address.h.

References bad().

91 { return bad (); }
bool bad() const
Indicates whether there was error during address construction process i.e.
Definition: Address.h:80
void ASSA::Address::setstate ( addrstate  flag_)
inlineprotected

Set state of the Address object.

Parameters
flag_new state

Definition at line 111 of file Address.h.

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

111 { m_state |= flag_; }
unsigned char m_state
Definition: Address.h:61

Member Data Documentation

unsigned char ASSA::Address::m_state
private

Definition at line 61 of file Address.h.


The documentation for this class was generated from the following file: