Identifier Class Reference

#include <Identifier.h>

List of all members.

Public Types

typedef Identifier id_type
typedef unsigned int value_type
typedef unsigned int size_type

Public Member Functions

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

Private Types

 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.

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

Definition at line 20 of file Identifier.h.


Member Typedef Documentation

typedef Identifier Identifier::id_type

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

Definition at line 26 of file Identifier.h.

typedef unsigned int Identifier::size_type

Definition at line 28 of file Identifier.h.

typedef unsigned int Identifier::value_type

Definition at line 27 of file Identifier.h.


Member Enumeration Documentation

enum Identifier::max_value_type [private]

Enumerator:
max_value 

Definition at line 94 of file Identifier.h.

00094                {
00095     max_value = 0xFFFFFFFF
00096   } max_value_type;


Constructor & Destructor Documentation

Identifier::Identifier (  )  [inline]

Default constructor.

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

Definition at line 110 of file Identifier.h.

00111     : m_id(max_value)
00112 {}

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

Constructor from value_type.

Definition at line 121 of file Identifier.h.

00122     : m_id(value)
00123 {
00124 }

Identifier::Identifier ( const Identifier other  )  [inline]

Copy constructor.

Definition at line 115 of file Identifier.h.

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


Member Function Documentation

void Identifier::clear (  )  [inline]

Reset to invalid state.

Definition at line 152 of file Identifier.h.

References m_id, and max_value.

Referenced by RecEmcTofHit::Clear(), RecEmcShower::Clear(), RecEmcCluster::Clear(), RecEmcDigit::RecEmcDigit(), and RecEmcHit::RecEmcHit().

00153 {
00154     m_id = max_value;
00155 }

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

Definition at line 163 of file Identifier.h.

References m_id.

Referenced by MdcTrack::storeTrack(), and TofRawDataProvider::tofDataMapOnlineMode().

00164 {
00165     return (m_id);
00166 }

std::string Identifier::getString (  )  const

Provide a string form of the identifier - hexadecimal.

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

Definition at line 17 of file Identifier.cxx.

References m_id, deljobs::string, and subSeperate::temp.

Referenced by operator<<().

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 [inline]

Check if id is in a valid state.

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

Definition at line 198 of file Identifier.h.

References m_id, and max_value.

Referenced by EmcRec::execute().

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

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

Definition at line 145 of file Identifier.h.

References m_id.

00146 {
00147     m_id &= value;
00148     return (*this);
00149 }

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

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

Definition at line 158 of file Identifier.h.

References m_id.

00159 {
00160     return (m_id);
00161 }

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

Definition at line 178 of file Identifier.h.

References m_id, and EvtCyclic3::other().

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

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

Definition at line 185 of file Identifier.h.

References m_id, and EvtCyclic3::other().

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

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

Assignment operator.

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

Definition at line 131 of file Identifier.h.

References m_id.

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

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

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

Definition at line 171 of file Identifier.h.

References m_id, and EvtCyclic3::other().

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

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

Definition at line 192 of file Identifier.h.

References m_id, and EvtCyclic3::other().

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

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

Bitwise operations.

Definition at line 138 of file Identifier.h.

References m_id.

00139 {
00140     m_id |= value;
00141     return (*this);
00142 }

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

build from a string form - hexadecimal

Definition at line 10 of file Identifier.cxx.

References EvtCyclic3::c_str(), and m_id.

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

void Identifier::show (  )  const

Print out in hex form.

Definition at line 30 of file Identifier.cxx.

References me.

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


Member Data Documentation

value_type Identifier::m_id [private]

Definition at line 101 of file Identifier.h.

Referenced by clear(), get_value(), getString(), is_valid(), operator &=(), operator value_type(), operator!=(), operator<(), operator=(), operator==(), operator>(), operator|=(), and set().


Generated on Tue Nov 29 23:19:43 2016 for BOSS_7.0.2 by  doxygen 1.4.7