Public Member Functions | Friends

I3IPAddress Struct Reference

A simple wrapper around an IPvXAddress and a port. More...

#include <I3IPAddress.h>

Inheritance diagram for I3IPAddress:
TransportAddress

List of all members.

Public Member Functions

 I3IPAddress ()
 Constructor.
 I3IPAddress (IPvXAddress add, int port)
 Constructor.
bool operator< (const I3IPAddress &a) const
 "Less than" operator
bool operator== (const I3IPAddress &a) const
 "Equals" operator (takes port in account)
bool operator> (const I3IPAddress &a) const
 "Greater than" operator (takes port in account)
int length () const

Friends

std::ostream & operator<< (std::ostream &os, const I3IPAddress &ip)
 String stream output operation.

Detailed Description

A simple wrapper around an IPvXAddress and a port.

Definition at line 32 of file I3IPAddress.h.


Constructor & Destructor Documentation

I3IPAddress::I3IPAddress (  ) 

Constructor.

Definition at line 26 of file I3IPAddress.cc.

{
    port = 0;
}

I3IPAddress::I3IPAddress ( IPvXAddress  add,
int  port 
)

Constructor.

Definition at line 31 of file I3IPAddress.cc.

{
    ip = add;
    port = p;
}


Member Function Documentation

int I3IPAddress::length (  )  const

Definition at line 52 of file I3IPAddress.cc.

Referenced by I3SubIdentifier::length().

                              {
    //return sizeof(address) + sizeof(port);
    return (ip.isIPv6() ? 128 : 32) + 16; // 16 = port length
}

bool I3IPAddress::operator< ( const I3IPAddress a  )  const

"Less than" operator

Parameters:
a Address to be compared

Definition at line 37 of file I3IPAddress.cc.

{
    return ip < a.ip || (ip == a.ip && port < a.port);
}

bool I3IPAddress::operator== ( const I3IPAddress a  )  const

"Equals" operator (takes port in account)

Parameters:
a Address to be compared

Definition at line 42 of file I3IPAddress.cc.

{
    return ip == a.ip && port == a.port;
}

bool I3IPAddress::operator> ( const I3IPAddress a  )  const

"Greater than" operator (takes port in account)

Parameters:
a Address to be compared

Definition at line 47 of file I3IPAddress.cc.

{
    return a < *this;
}


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const I3IPAddress ip 
) [friend]

String stream output operation.

Parameters:
os String stream
ip Address to be output
Returns:
os parameter

Definition at line 57 of file I3IPAddress.cc.

                                                              {
    os << ip.ip << ':' << ip.port;
    return os;
}


The documentation for this struct was generated from the following files: