CMS 3D CMS Logo

AtomicId.h
Go to the documentation of this file.
1 #ifndef PhysicsTools_MVAComputer_AtomicId_h
2 #define PhysicsTools_MVAComputer_AtomicId_h
3 // -*- C++ -*-
4 //
5 // Package: MVAComputer
6 // Class : AtomicID
7 //
8 
9 //
10 // Author: Christophe Saout <christophe.saout@cern.ch>
11 // Created: Sat Apr 24 15:18 CEST 2007
12 //
13 
14 #include <ostream>
15 #include <string>
16 
17 namespace PhysicsTools {
18 
31  class AtomicId {
32  public:
33  inline AtomicId() throw() : string(nullptr) {}
34  inline AtomicId(const AtomicId &orig) throw() : string(orig.string) {}
36  inline AtomicId(const char *arg) throw() : string(lookup(arg)) {}
38  inline AtomicId(const std::string &arg) throw() : string(lookup(arg.c_str())) {}
39  inline ~AtomicId() throw() {}
40 
41  inline AtomicId &operator=(const AtomicId &orig) throw() {
42  string = orig.string;
43  return *this;
44  }
45 
47  inline operator const char *() const throw() { return string; }
48 
50  inline operator bool() const throw() { return string != nullptr; }
51 
53  inline operator std::string() const throw() { return std::string(string); }
54 
55  inline bool operator==(const AtomicId &second) const throw() { return string == second.string; }
56  inline bool operator!=(const AtomicId &second) const throw() { return string != second.string; }
57  inline bool operator<(const AtomicId &second) const throw() { return string < second.string; }
58  inline bool operator<=(const AtomicId &second) const throw() { return string <= second.string; }
59  inline bool operator>(const AtomicId &second) const throw() { return string > second.string; }
60  inline bool operator>=(const AtomicId &second) const throw() { return string >= second.string; }
61 
62  private:
63  static AtomicId build(const char *arg) throw() {
64  AtomicId q;
65  q.string = arg;
66  return q;
67  }
68  static const char *lookup(const char *arg) throw();
69 
70  const char *string;
71  };
72 
74  inline std::ostream &operator<<(std::ostream &os, const PhysicsTools::AtomicId &id) { return os << (const char *)id; }
75 
76 } // namespace PhysicsTools
77 
78 #endif // PhysicsTools_MVAComputer_AtomicId_h
PhysicsTools::AtomicId::operator==
bool operator==(const AtomicId &second) const
Definition: AtomicId.h:55
PhysicsTools::AtomicId
Cheap generic unique keyword identifier class.
Definition: AtomicId.h:31
PhysicsTools::AtomicId::AtomicId
AtomicId()
Definition: AtomicId.h:33
electrons_cff.bool
bool
Definition: electrons_cff.py:393
PhysicsTools::AtomicId::AtomicId
AtomicId(const char *arg)
constructs an AtomicId from a C string
Definition: AtomicId.h:36
PhysicsTools::AtomicId::AtomicId
AtomicId(const std::string &arg)
constructs an AtomicId from a STL string
Definition: AtomicId.h:38
edm::second
U second(std::pair< T, U > const &p)
Definition: ParameterSet.cc:222
PhysicsTools::AtomicId::operator!=
bool operator!=(const AtomicId &second) const
Definition: AtomicId.h:56
PhysicsTools::AtomicId::~AtomicId
~AtomicId()
Definition: AtomicId.h:39
PhysicsTools::AtomicId::build
static AtomicId build(const char *arg)
Definition: AtomicId.h:63
PhysicsTools::AtomicId::operator=
AtomicId & operator=(const AtomicId &orig)
Definition: AtomicId.h:41
PhysicsTools::AtomicId::operator<=
bool operator<=(const AtomicId &second) const
Definition: AtomicId.h:58
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
PhysicsTools::AtomicId::operator<
bool operator<(const AtomicId &second) const
Definition: AtomicId.h:57
PhysicsTools
Definition: Histogram.h:13
PhysicsTools::AtomicId::operator>
bool operator>(const AtomicId &second) const
Definition: AtomicId.h:59
PhysicsTools::AtomicId::string
const char * string
Definition: AtomicId.h:70
submitPVResolutionJobs.q
q
Definition: submitPVResolutionJobs.py:84
PhysicsTools::AtomicId::operator>=
bool operator>=(const AtomicId &second) const
Definition: AtomicId.h:60
PhysicsTools::AtomicId::AtomicId
AtomicId(const AtomicId &orig)
Definition: AtomicId.h:34
PhysicsTools::operator<<
std::ostream & operator<<(std::ostream &os, const PhysicsTools::AtomicId &id)
STL streaming operator.
Definition: AtomicId.h:74
PhysicsTools::AtomicId::lookup
static const char * lookup(const char *arg)
Definition: AtomicId.cc:59
ALCARECOPromptCalibProdSiPixelAli0T_cff.throw
throw
Definition: ALCARECOPromptCalibProdSiPixelAli0T_cff.py:9
funct::arg
A arg
Definition: Factorize.h:31