BOSS 7.1.2
BESIII Offline Software System
Loading...
Searching...
No Matches
Identifier Class Reference

#include <Identifier.h>

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.
 

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

◆ id_type


Define public typedefs

Definition at line 26 of file Identifier.h.

◆ size_type

unsigned int Identifier::size_type

Definition at line 28 of file Identifier.h.

◆ value_type

unsigned int Identifier::value_type

Definition at line 27 of file Identifier.h.

Constructor & Destructor Documentation

◆ Identifier() [1/3]

Identifier::Identifier ( )
inline

Default constructor.


Constructors

Definition at line 110 of file Identifier.h.

111 : m_id(max_value)
112{}

◆ Identifier() [2/3]

Identifier::Identifier ( value_type value)
inlineexplicit

Constructor from value_type.

Definition at line 121 of file Identifier.h.

122 : m_id(value)
123{
124}

◆ Identifier() [3/3]

Identifier::Identifier ( const Identifier & other)
inline

Copy constructor.

Definition at line 115 of file Identifier.h.

116 : m_id(other.get_value())
117{
118}
Index other(Index i, Index j)

Member Function Documentation

◆ clear()

void Identifier::clear ( )
inline

◆ get_value()

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

Definition at line 163 of file Identifier.h.

164{
165 return (m_id);
166}

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

◆ getString()

std::string Identifier::getString ( ) const

Provide a string form of the identifier - hexadecimal.


Utilities

Definition at line 17 of file Identifier.cxx.

18{
19 std::string result;
20 char temp[20];
21
22 sprintf (temp, "0x%x", (unsigned int)m_id);
23 result += temp;
24 result.insert(2,10-result.length(),'0');
25
26 return (result);
27}
sprintf(cut,"kal_costheta0_em>-0.93&&kal_costheta0_em<0.93&&kal_pxy0_em>=0.05+%d*0.1&&kal_pxy0_em<0.15+%d*0.1&&NGch>=2", j, j)

Referenced by operator<<(), and show().

◆ is_valid()

bool Identifier::is_valid ( ) const
inline

Check if id is in a valid state.


Error management

Definition at line 198 of file Identifier.h.

199{
200 return (!(max_value == m_id));
201}

Referenced by EmcRec::execute().

◆ operator value_type()

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

Accessors

Get the value

Definition at line 158 of file Identifier.h.

159{
160 return (m_id);
161}

◆ operator!=()

bool Identifier::operator!= ( const Identifier & other) const
inline

Definition at line 178 of file Identifier.h.

179{
180 return (m_id != other.get_value());
181}

◆ operator&=()

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

Definition at line 145 of file Identifier.h.

146{
147 m_id &= value;
148 return (*this);
149}

◆ operator<()

bool Identifier::operator< ( const Identifier & other) const
inline

Definition at line 184 of file Identifier.h.

186{
187 return (m_id < other.get_value());
188}

◆ operator=()

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

Assignment operator.


Modifications

Definition at line 131 of file Identifier.h.

132{
133 m_id = value;
134 return (*this);
135}

◆ operator==()

bool Identifier::operator== ( const Identifier & other) const
inline

Comparison operators

Definition at line 171 of file Identifier.h.

172{
173 return (m_id == other.get_value());
174}

◆ operator>()

bool Identifier::operator> ( const Identifier & other) const
inline

Definition at line 192 of file Identifier.h.

193{
194 return (m_id > other.get_value());
195}

◆ operator|=()

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

Bitwise operations.

Definition at line 138 of file Identifier.h.

139{
140 m_id |= value;
141 return (*this);
142}

◆ set()

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

build from a string form - hexadecimal

Definition at line 10 of file Identifier.cxx.

11{
12 sscanf (id.c_str(), "0x%x", &m_id);
13}
char * c_str(Index i)

◆ show()

void Identifier::show ( ) const

Print out in hex form.

Definition at line 30 of file Identifier.cxx.

31{
32 const Identifier& me = *this;
33 std::cout << me.getString();
34}
const double me
Definition PipiJpsi.cxx:48
std::string getString() const
Provide a string form of the identifier - hexadecimal.

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