#include <Identifier.h>
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. | |
Identifier & | operator &= (value_type value) |
Identifier & | operator &= (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 |
Identifier & | operator= (value_type value) |
Assignment operator. | |
Identifier & | operator= (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 |
Identifier & | operator|= (value_type value) |
Bitwise operations. | |
Identifier & | operator|= (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 |
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.
-----------------------------------------------
|
---------------------------------------------------------------- Define public typedefs ---------------------------------------------------------------- |
|
---------------------------------------------------------------- Define public typedefs ---------------------------------------------------------------- |
|
|
|
|
|
|
|
|
|
00094 { 00095 max_value = 0xFFFFFFFF 00096 } max_value_type;
|
|
00094 { 00095 max_value = 0xFFFFFFFF 00096 } max_value_type;
|
|
Default constructor. ---------------------------------------------------------------- Constructors ---------------------------------------------------------------- 00111 : m_id(max_value) 00112 {}
|
|
Constructor from value_type.
00122 : m_id(value) 00123 { 00124 }
|
|
Copy constructor.
|
|
Default constructor. ---------------------------------------------------------------- Constructors ---------------------------------------------------------------- |
|
Constructor from value_type.
|
|
Copy constructor.
|
|
Reset to invalid state.
|
|
Reset to invalid state.
00153 { 00154 m_id = max_value; 00155 }
|
|
|
|
00164 {
00165 return (m_id);
00166 }
|
|
Provide a string form of the identifier - hexadecimal. ---------------------------------------------------------------- Utilities ---------------------------------------------------------------- |
|
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 }
|
|
Check if id is in a valid state. ---------------------------------------------------------------- Error management ---------------------------------------------------------------- |
|
Check if id is in a valid state. ---------------------------------------------------------------- Error management ---------------------------------------------------------------- 00199 { 00200 return (!(max_value == m_id)); 00201 }
|
|
|
|
|
|
---------------------------------------------------------------- Accessors ---------------------------------------------------------------- Get the value |
|
---------------------------------------------------------------- Accessors ---------------------------------------------------------------- Get the value 00159 {
00160 return (m_id);
00161 }
|
|
|
|
|
|
|
|
|
|
Assignment operator. ---------------------------------------------------------------- Modifications ---------------------------------------------------------------- |
|
Assignment operator. ---------------------------------------------------------------- Modifications ---------------------------------------------------------------- 00132 { 00133 m_id = value; 00134 return (*this); 00135 }
|
|
---------------------------------------------------------------- Comparison operators ---------------------------------------------------------------- |
|
---------------------------------------------------------------- Comparison operators ----------------------------------------------------------------
|
|
|
|
|
|
Bitwise operations.
|
|
Bitwise operations.
|
|
build from a string form - hexadecimal
|
|
build from a string form - hexadecimal
00011 { 00012 sscanf (id.c_str(), "0x%x", &m_id); 00013 }
|
|
Print out in hex form.
|
|
Print out in hex form.
00031 { 00032 const Identifier& me = *this; 00033 std::cout << me.getString(); 00034 }
|
|
|