Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

Identifier Class Reference

#include <Identifier.h>

List of all members.

Public Types

typedef Identifier id_type
typedef Identifier id_type
typedef unsigned int size_type
typedef unsigned int size_type
typedef unsigned int value_type
typedef unsigned int value_type

Public Member Functions

void clear ()
 Reset to invalid state.
void clear ()
 Reset to invalid state.
value_type get_value () const
value_type get_value () const
std::string getString () const
 Provide a string form of the identifier - hexadecimal.
std::string getString () const
 Provide a string form of the identifier - hexadecimal.
 Identifier (const Identifier &other)
 Copy constructor.
 Identifier (value_type value)
 Constructor from value_type.
 Identifier ()
 Default constructor.
 Identifier (const Identifier &other)
 Copy constructor.
 Identifier (value_type value)
 Constructor from value_type.
 Identifier ()
 Default constructor.
bool is_valid () const
 Check if id is in a valid state.
bool is_valid () const
 Check if id is in a valid state.
Identifieroperator &= (value_type value)
Identifieroperator &= (value_type value)
 operator value_type (void) const
 operator value_type (void) const
bool operator!= (const Identifier &other) const
bool operator!= (const Identifier &other) const
bool operator< (const Identifier &other) const
bool operator< (const Identifier &other) const
Identifieroperator= (value_type value)
 Assignment operator.
Identifieroperator= (value_type value)
 Assignment operator.
bool operator== (const Identifier &other) const
bool operator== (const Identifier &other) const
bool operator> (const Identifier &other) const
bool operator> (const Identifier &other) const
Identifieroperator|= (value_type value)
 Bitwise operations.
Identifieroperator|= (value_type value)
 Bitwise operations.
void set (const std::string &id)
 build from a string form - hexadecimal
void set (const std::string &id)
 build from a string form - hexadecimal
void show () const
 Print out in hex form.
void show () const
 Print out in hex form.

Private Types

enum  max_value_type { max_value = 0xFFFFFFFF }
enum  max_value_type { max_value = 0xFFFFFFFF }

Private Attributes

value_type m_id


Detailed Description

-----------------------------------------------

Identifier is a simple type-safe 32 bit unsigned integer. An Identifier relies on other classes to encode and decode its information.

The default constructor created an Identifier an invalid state which can be check with the "is_valid" method to allow some error checking.

-----------------------------------------------


Member Typedef Documentation

typedef Identifier Identifier::id_type
 

---------------------------------------------------------------- Define public typedefs ----------------------------------------------------------------

typedef Identifier Identifier::id_type
 

---------------------------------------------------------------- Define public typedefs ----------------------------------------------------------------

typedef unsigned int Identifier::size_type
 

typedef unsigned int Identifier::size_type
 

typedef unsigned int Identifier::value_type
 

typedef unsigned int Identifier::value_type
 


Member Enumeration Documentation

enum Identifier::max_value_type [private]
 

Enumeration values:
max_value 
00094                {
00095     max_value = 0xFFFFFFFF
00096   } max_value_type;

enum Identifier::max_value_type [private]
 

Enumeration values:
max_value 
00094                {
00095     max_value = 0xFFFFFFFF
00096   } max_value_type;


Constructor & Destructor Documentation

Identifier::Identifier  )  [inline]
 

Default constructor.

---------------------------------------------------------------- Constructors ----------------------------------------------------------------

00111     : m_id(max_value)
00112 {}

Identifier::Identifier value_type  value  )  [inline, explicit]
 

Constructor from value_type.

00122     : m_id(value)
00123 {
00124 }

Identifier::Identifier const Identifier other  )  [inline]
 

Copy constructor.

00116     : m_id(other.get_value())
00117 {
00118 }

Identifier::Identifier  ) 
 

Default constructor.

---------------------------------------------------------------- Constructors ----------------------------------------------------------------

Identifier::Identifier value_type  value  )  [explicit]
 

Constructor from value_type.

Identifier::Identifier const Identifier other  ) 
 

Copy constructor.


Member Function Documentation

void Identifier::clear  ) 
 

Reset to invalid state.

void Identifier::clear  )  [inline]
 

Reset to invalid state.

00153 {
00154     m_id = max_value;
00155 }

value_type Identifier::get_value  )  const
 

Identifier::value_type Identifier::get_value  )  const [inline]
 

00164 {
00165     return (m_id);
00166 }

std::string Identifier::getString  )  const
 

Provide a string form of the identifier - hexadecimal.

---------------------------------------------------------------- Utilities ----------------------------------------------------------------

std::string Identifier::getString  )  const
 

Provide a string form of the identifier - hexadecimal.

---------------------------------------------------------------- Utilities ----------------------------------------------------------------

00018 {
00019    std::string result;
00020    char temp[20];
00021    
00022    sprintf (temp, "0x%x", (unsigned int)m_id);
00023    result += temp;
00024    result.insert(2,10-result.length(),'0');
00025    
00026    return (result);
00027 }

bool Identifier::is_valid  )  const
 

Check if id is in a valid state.

---------------------------------------------------------------- Error management ----------------------------------------------------------------

bool Identifier::is_valid  )  const [inline]
 

Check if id is in a valid state.

---------------------------------------------------------------- Error management ----------------------------------------------------------------

00199 {
00200     return (!(max_value == m_id));
00201 }

Identifier& Identifier::operator &= value_type  value  ) 
 

Identifier& Identifier::operator &= value_type  value  ) 
 

Identifier::operator value_type void   )  const
 

---------------------------------------------------------------- Accessors ---------------------------------------------------------------- Get the value

Identifier::operator Identifier::value_type void   )  const [inline]
 

---------------------------------------------------------------- Accessors ---------------------------------------------------------------- Get the value

00159 {
00160     return (m_id);
00161 }

bool Identifier::operator!= const Identifier other  )  const
 

bool Identifier::operator!= const Identifier other  )  const [inline]
 

00179 {
00180     return (m_id != other.get_value());
00181 }

bool Identifier::operator< const Identifier other  )  const
 

bool Identifier::operator< const Identifier other  )  const [inline]
 

00186 {
00187     return (m_id < other.get_value());
00188 }

Identifier& Identifier::operator= value_type  value  ) 
 

Assignment operator.

---------------------------------------------------------------- Modifications ----------------------------------------------------------------

Identifier & Identifier::operator= value_type  value  )  [inline]
 

Assignment operator.

---------------------------------------------------------------- Modifications ----------------------------------------------------------------

00132 {
00133     m_id = value;
00134     return (*this);
00135 }

bool Identifier::operator== const Identifier other  )  const
 

---------------------------------------------------------------- Comparison operators ----------------------------------------------------------------

bool Identifier::operator== const Identifier other  )  const [inline]
 

---------------------------------------------------------------- Comparison operators ----------------------------------------------------------------

00172 {
00173     return (m_id == other.get_value());
00174 }

bool Identifier::operator> const Identifier other  )  const
 

bool Identifier::operator> const Identifier other  )  const [inline]
 

00193 {
00194     return (m_id > other.get_value());
00195 }

Identifier& Identifier::operator|= value_type  value  ) 
 

Bitwise operations.

Identifier& Identifier::operator|= value_type  value  ) 
 

Bitwise operations.

void Identifier::set const std::string &  id  ) 
 

build from a string form - hexadecimal

void Identifier::set const std::string &  id  ) 
 

build from a string form - hexadecimal

00011 {
00012   sscanf (id.c_str(), "0x%x", &m_id);
00013 }

void Identifier::show  )  const
 

Print out in hex form.

void Identifier::show  )  const
 

Print out in hex form.

00031 {
00032     const Identifier& me = *this;
00033     std::cout << me.getString();
00034 }


Member Data Documentation

value_type Identifier::m_id [private]
 


The documentation for this class was generated from the following files:
Generated on Wed Feb 2 16:17:56 2011 for BOSS6.5.5 by  doxygen 1.3.9.1