/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/DetectorDescription/Identifier/Identifier-00-02-17/Identifier/Identifier.h

Go to the documentation of this file.
00001 #ifndef __Identifier_h___
00002 #define __Identifier_h___
00003 
00004 #include <vector>
00005 #include <string>
00006 
00020 class Identifier {
00021 public:
00022 
00026   typedef Identifier   id_type;
00027   typedef unsigned int value_type;
00028   typedef unsigned int size_type;
00029 
00033 
00035   Identifier ();
00036 
00038   explicit Identifier (value_type value);
00039 
00041   Identifier (const Identifier& other);
00042 
00046 
00048   Identifier& operator = (value_type value);
00049 
00051   Identifier& operator |= (value_type value);
00052   Identifier& operator &= (value_type value);
00053 
00055   void set (const std::string& id);
00056 
00058   void clear ();
00059 
00064   operator value_type         (void) const;
00065   value_type  get_value() const;
00066 
00070   bool operator ==    (const Identifier& other) const;
00071   bool operator !=    (const Identifier& other) const;
00072   bool operator <     (const Identifier& other) const;
00073   bool operator >     (const Identifier& other) const;
00074 
00078 
00080   bool is_valid () const;
00081   
00085 
00087   std::string  getString() const;
00088 
00090   void show () const;
00091 
00092 private:
00093 
00094   typedef enum {
00095     max_value = 0xFFFFFFFF
00096   } max_value_type;
00097 
00098   //----------------------------------------------------------------
00099   // The compact identifier data.
00100   //----------------------------------------------------------------
00101   value_type m_id;
00102 };
00103 
00104 //-----------------------------------------------
00105 //<<<<<< INLINE MEMBER FUNCTIONS                   >>>>>>
00106 
00107 
00108 // Constructors
00109 //-----------------------------------------------
00110 inline Identifier::Identifier ()
00111     : m_id(max_value)
00112 {}
00113 
00114 //-----------------------------------------------
00115 inline Identifier::Identifier (const Identifier& other)
00116     : m_id(other.get_value())
00117 {
00118 }
00119 
00120 //-----------------------------------------------
00121 inline Identifier::Identifier (value_type value)
00122     : m_id(value)
00123 {
00124 }
00125 
00126 
00127 // Modifications
00128 //-----------------------------------------------
00129 
00130 inline Identifier&
00131 Identifier::operator = (value_type value)
00132 {
00133     m_id = value;
00134     return (*this);
00135 }
00136 
00137 inline Identifier&                                   
00138 Identifier::operator |= (unsigned int value)
00139 {
00140     m_id |= value;
00141     return (*this);
00142 }
00143 
00144 inline Identifier& 
00145 Identifier::operator &= (unsigned int value)
00146 {
00147     m_id &= value;
00148     return (*this);
00149 }
00150 
00151 inline void 
00152 Identifier::clear () 
00153 {
00154     m_id = max_value;
00155 }
00156 
00157 // Accessors
00158 inline Identifier::operator Identifier::value_type (void) const
00159 {
00160     return (m_id);
00161 }
00162                                              
00163 inline Identifier::value_type Identifier::get_value() const
00164 {
00165     return (m_id);
00166 }
00167 
00168 // Comparison operators
00169 //----------------------------------------------------------------
00170 inline bool 
00171 Identifier::operator == (const Identifier& other) const
00172 {
00173     return (m_id == other.get_value());
00174 }
00175 
00176 //----------------------------------------------------------------
00177 inline bool 
00178 Identifier::operator != (const Identifier& other) const
00179 {
00180     return (m_id != other.get_value());
00181 }
00182 
00183 //-----------------------------------------------
00184 inline bool 
00185 Identifier::operator < (const Identifier& other) const
00186 {
00187     return (m_id < other.get_value());
00188 }
00189 
00190 //-----------------------------------------------
00191 inline bool 
00192 Identifier::operator > (const Identifier& other) const
00193 {
00194     return (m_id > other.get_value());
00195 }
00196 
00197 inline bool 
00198 Identifier::is_valid () const
00199 {
00200     return (!(max_value == m_id));
00201 }
00202 
00203 //others -----------------
00204 std::ostream& operator<<(std::ostream & os, const Identifier& Id);
00205 
00206 #endif
00207 

Generated on Tue Nov 29 22:58:00 2016 for BOSS_7.0.2 by  doxygen 1.4.7