ariba::Name Class Reference

#include <source/ariba/Name.h>

Collaboration diagram for ariba::Name:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 Name ()
 Name (const char *name, int len=-1, bool copy=false)
 Name (string name)
 Name (const Name &name)
virtual ~Name ()
const uint8_t * bytes () const
const size_t length () const
Nameoperator= (const Name &name)
bool operator== (const Name &name) const
bool operator!= (const Name &name) const
bool isUnspecified () const
string toString () const
NodeID toNodeId () const
SpoVNetID toSpoVNetId () const

Static Public Member Functions

static Name random ()

Static Public Attributes

static const Name UNSPECIFIED

Private Member Functions

void init (const char *name, int len, bool copy, bool hreadable)

Private Attributes

bool _hreadable
bool _copy
int _length
uint8_t * _bytes

Friends

std::ostream & operator<< (std::ostream &, const ::ariba::Name &)


Detailed Description

This class is a wrapper for canonical names. Currently only human readable names are supported.

Author:
Sebastian Mies <mies@tm.uka.de>

Definition at line 63 of file Name.h.


Constructor & Destructor Documentation

ariba::Name::Name (  ) 

Constructs a new, yet unspecified name.

Definition at line 81 of file Name.cpp.

Referenced by random().

ariba::Name::Name ( const char *  name,
int  len = -1,
bool  copy = false 
)

Constructs a new name. If no length is specified, a human-readable name is assumed.

Parameters:
name The name
len The optional name length, if binary data is used as name
copy A flag, whether the name's memory needs to be copied

Definition at line 85 of file Name.cpp.

References init().

ariba::Name::Name ( string  name  ) 

Constructs a new name out of a human readable string.

Parameters:
name A human readable name

Definition at line 90 of file Name.cpp.

References init().

ariba::Name::Name ( const Name name  ) 

The copy constructor.

Definition at line 95 of file Name.cpp.

References _hreadable, bytes(), init(), and length().

ariba::Name::~Name (  )  [virtual]

Destroys the name and releases underlying memory if this name is a copy.

Definition at line 100 of file Name.cpp.

References _bytes, _copy, and _length.


Member Function Documentation

const uint8_t * ariba::Name::bytes (  )  const

Returns the binary bytes of the name

Returns:
The binary data

Definition at line 112 of file Name.cpp.

References _bytes.

Referenced by Name(), operator=(), operator==(), toNodeId(), toSpoVNetId(), and toString().

const size_t ariba::Name::length (  )  const

Returns the length of the name in bytes.

Returns:
The length of the name

Definition at line 116 of file Name.cpp.

References _length.

Referenced by Name(), operator=(), operator==(), toNodeId(), toSpoVNetId(), and toString().

Name & ariba::Name::operator= ( const Name name  ) 

The common assign operator

Definition at line 108 of file Name.cpp.

References _hreadable, bytes(), init(), and length().

bool ariba::Name::operator== ( const Name name  )  const

The common implementation of the "equal" operator.

Definition at line 120 of file Name.cpp.

References _bytes, bytes(), and length().

bool ariba::Name::operator!= ( const Name name  )  const

The common implementation of the "unequal" operator.

Definition at line 132 of file Name.cpp.

bool ariba::Name::isUnspecified (  )  const

Returns true, if the name is yet unspecified

Definition at line 136 of file Name.cpp.

References UNSPECIFIED.

Name ariba::Name::random (  )  [static]

Returns a random name.

Definition at line 140 of file Name.cpp.

References Name().

Referenced by ariba::Node::generateNodeId().

string ariba::Name::toString (  )  const

Returns a human-readable representation of this name

Definition at line 152 of file Name.cpp.

References _hreadable, bytes(), and length().

Referenced by ariba::AribaModule::getBootstrapHints(), operator<<(), and ariba::SpoVNetProperties::toString().

NodeID ariba::Name::toNodeId (  )  const

Definition at line 163 of file Name.cpp.

References bytes(), length(), and ariba::utility::NodeID::UNSPECIFIED.

Referenced by ariba::Node::generateNodeId().

SpoVNetID ariba::Name::toSpoVNetId (  )  const

void ariba::Name::init ( const char *  name,
int  len,
bool  copy,
bool  hreadable 
) [private]

Definition at line 49 of file Name.cpp.

References _bytes, _copy, _hreadable, and _length.

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


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  ,
const ::ariba::Name  
) [friend]


Member Data Documentation

bool ariba::Name::_hreadable [private]

Definition at line 151 of file Name.h.

Referenced by init(), Name(), operator=(), and toString().

bool ariba::Name::_copy [private]

Definition at line 152 of file Name.h.

Referenced by init(), and ~Name().

int ariba::Name::_length [private]

Definition at line 153 of file Name.h.

Referenced by init(), length(), and ~Name().

uint8_t* ariba::Name::_bytes [private]

Definition at line 154 of file Name.h.

Referenced by bytes(), init(), operator==(), and ~Name().


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

Generated on Wed May 27 18:23:56 2009 for Ariba by  doxygen 1.5.6