Report problems to ATLAS LXR Team (with time and IP address indicated)

The LXR Cross Referencer

source navigation ]
diff markup ]
identifier search ]
general search ]
 
 
Architecture: linux ]
Version: head ] [ nightly ] [ GaudiDev ]
  Links to LXR source navigation pages for stable releases [ 12.*.* ]   [ 13.*.* ]   [ 14.*.* ]   [ 15.*.* ] 

001 
002 // ============================================================================
003 /*  @file gaudiHistoID.h
004  *
005  *  Header file for class GaudiAlg::ID
006  *
007  *  $Id: GaudiHistoID.h,v 1.7 2007/09/19 08:17:54 marcocle Exp $
008  *
009  *  @author Chris Jones   Christopher.Rob.Jones@cern.ch
010  *  @author Vanya BELYAEV Ivan.Belyaev@itep.ru
011  *  @date   2004-01-23
012  */
013 // ============================================================================
014 
015 #ifndef GAUDIALG_GAUDIHISTOID_H
016 #define GAUDIALG_GAUDIHISTOID_H 1
017 // STD
018 #include <string>
019 
020 // ============================================================================
021 /** @namespace GaudiAlg
022  *
023  *  Definitions of few useful hash-maps, classes and typedefs
024  *  used for classes GaudiHistos and GaudiTuples.
025  *
026  *  @author Vanya BELYAEV Ivan.Belyaev@itep.ru
027  *  @date   2004-01-23
028  */
029 // ============================================================================
030 
031 namespace GaudiAlg
032 {
033   // ============================================================================
034   /** @class ID GaudiHistoID.h GaudiAlg/GaudiHistoID.h
035    *
036    *  ID class for Histogram and Ntuples. Internally handles both
037    *  numeric and string like IDs
038    *
039    *  @author Chris Jones  Christopher.Rob.Jones@cern.ch
040    *  @date   2005-08-12
041    */
042   class ID
043   {
044   public:
045     /// type for internal numeric ID
046     typedef int         NumericID;
047     /// type for internal literal ID
048     typedef std::string LiteralID;
049   public:
050     /// Implicit constructor from a numeric ID
051     ID( const NumericID    id = -1 ) : m_nID ( id ) , m_aID( "" ) { }
052     /// Implicit constructor from a literal ID
053     ID( const LiteralID&   id      ) : m_nID ( -1 ) , m_aID( id ) { }
054     /// Implicit constructor from a char *
055     ID( const char*        id      ) : m_nID ( -1 ) , m_aID( id ) { }
056     /// Destructor
057     ~ID( ) { }
058     /// Is this ID numeric
059     inline bool numeric   () const { return -1 != m_nID ;    }
060     /// Is this ID numeric
061     inline bool literal   () const { return !m_aID.empty() ; }
062     /// Is this ID undefined
063     inline bool undefined () const { return !numeric() && !literal(); }
064     /// Returns the ID as a LiteralID
065     inline const LiteralID& literalID() const { return m_aID; }
066     /// Returns the numerical ID
067     inline NumericID        numericID() const { return m_nID; }
068     /** Operator ++   (prefix)
069      *  @attention Only valid for numeric IDs. Has NO effect on literal IDs
070      */
071     inline ID& operator++() 
072     { 
073       if ( numeric() ) { ++m_nID; } ; 
074       return *this ; 
075     }
076     /** Operator ++(int)  (postfix)
077      *  @attention Only valid for numeric IDs. Has NO effect on literal IDs
078      */
079     inline ID operator++( int ) 
080     { 
081       const ID retID = *this;
082       this->operator++();
083       return retID;
084     }
085     /** Operator --   (prefix)
086      *  @attention Only valid for numeric IDs. Has NO effect on literal IDs
087      */
088     inline ID& operator--() 
089     { 
090       if ( numeric() ) { --m_nID; } ; 
091       return *this ; 
092     }
093     /** Operator --(int)  (postfix)
094      *  @attention Only valid for numeric IDs. Has NO effect on literal IDs
095      */
096     inline ID operator--( int ) 
097     { 
098       const ID retID = *this;
099       this->operator--();
100       return retID;
101     }
102     /// Return ID as string, for both numeric and literal IDs
103     LiteralID idAsString() const ;
104     /// cast operator to std::striqng
105     operator std::string () const { return idAsString () ; }
106     /** @brief Implement the operator ==
107      *  Implementation depends on type of ID
108      *  @return boolean indicating if the IDs are equal
109      */
110     inline bool operator==( const ID& id ) const
111     {
112       return ( numeric() && id.numeric()   ? id.numericID() == numericID() :
113                ( literal() && id.literal() ? id.literalID() == literalID() :
114                  id.idAsString() == idAsString() ) );
115     }
116     /// Implement the != operator, using the == operator
117     inline bool operator!=( const ID& id ) const
118     {
119       return ! this->operator==(id);
120     }
121     /** @brief Implement the operator <
122      *  Implementation depends on type of ID
123      *  @return boolean indicating the order of the IDs
124      */
125     inline bool operator<( const ID& id ) const
126     {
127       return ( numeric() && id.numeric()   ? this->numericID() < id.numericID() :
128                ( literal() && id.literal() ? this->literalID() < id.literalID() :
129                  this->idAsString() < id.idAsString() ) );
130     }
131   private:
132     /// Internal numeric ID
133     NumericID   m_nID ;
134     /// Internal alpha-numeric ID
135     LiteralID   m_aID ;
136   };
137 }
138 /// Operator overloading for ostream
139 inline std::ostream& operator << ( std::ostream& str , const GaudiAlg::ID& id )
140 {
141   if      ( id.numeric() ) { str << id.numericID(); }
142   else if ( id.literal() ) { str << id.literalID(); }
143   else                     { str << "UNDEFINED";    }
144   return str;
145 }
146 #endif // GAUDIALG_GAUDIHISTOID_H
147 

source navigation ] diff markup ] identifier search ] general search ]

Due to the LXR bug, the updates fail sometimes to remove references to deleted files. The Saturday's full rebuilds fix these problems
This page was automatically generated by the LXR engine. Valid HTML 4.01!