ATLAS Offline Software
Token.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef PERSISTENTDATAMODEL_TOKEN_H
6 #define PERSISTENTDATAMODEL_TOKEN_H
7 
14 
15 #include <string>
16 #include <utility>
17 
21 class Token {
22 public:
23  // typedef std::pair<long long int, long long int> OID_t;
24  struct OID_t : public std::pair<long long int, long long int> {
25  OID_t() {}
26  OID_t(long long int i1, long long int i2) : std::pair<long long int, long long int> (i1,i2) {}
27  };
28 
29 private:
31  Token(const Token& copy);
33  Token& operator=(const Token& copy);
34 
35 public:
37  Token();
39  explicit Token(const Token* source);
41  virtual ~Token();
43  bool operator<(const Token& refToken) const { return less(refToken); }
45  bool operator>(const Token& refToken) const {
46  if (less(refToken)) return false;
47  return !equal(refToken);
48  }
50  bool operator==(const Token& refToken) const { return equal(refToken); }
52  bool operator!=(const Token& refToken) const { return !equal(refToken); }
54  virtual bool less(const Token& pTok) const;
56  virtual bool equal(const Token& pTok) const;
58  int release();
60  int addRef() { return ++m_refCount; }
62  const Guid& dbID() const { return m_dbID; }
64  Token& setDb(const Guid& db) { m_dbID = db; return *this; }
65  Token& setDb(const std::string& db) { m_dbID.fromString(db); return *this; }
67  const std::string& contID() const { return m_cntID; }
69  Token& setCont(const std::string& cnt) { m_cntID = cnt; return *this; }
71  const Guid& classID() const { return m_classID; }
73  Token& setClassID(const Guid& cl_id) { m_classID = cl_id; return *this; }
75  int technology() const { return m_technology; }
77  Token& setTechnology(int t) { m_technology = t; return *this; }
79  const OID_t& oid() const { return m_oid; }
81  OID_t& oid() { return m_oid; }
83  Token& setOid(const OID_t& oid) { m_oid = oid; return *this; }
85  int type() const { return m_type; }
87  Token& setType(int t) { m_type = t; return *this; }
89  const std::string& auxString() const { return m_auxString; }
91  Token& setAuxString(const std::string& auxString) { m_auxString = auxString; return *this; }
92 
94  virtual const std::string toString() const;
96  virtual const std::string key() const;
98  Token& fromString(const std::string& from);
100  const Token& set(Token* pToken) const;
102  const Token& setData(Token* pToken) const;
103 
105  static int numInstances();
106 
107 private:
111  unsigned int m_technology;
115  std::string m_cntID;
121  int m_type;
123  std::string m_auxString;
124 };
125 
126 #endif
Token::m_type
int m_type
Token type.
Definition: Token.h:121
Token::OID_t::OID_t
OID_t(long long int i1, long long int i2)
Definition: Token.h:26
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
Token::contID
const std::string & contID() const
Access container identifier.
Definition: Token.h:67
CaloCondBlobAlgs_fillNoiseFromASCII.db
db
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:43
Token::auxString
const std::string & auxString() const
Access auxiliary string.
Definition: Token.h:89
Token::m_dbID
Guid m_dbID
Database identifier.
Definition: Token.h:113
Token::dbID
const Guid & dbID() const
Access database identifier.
Definition: Token.h:62
Token::operator>
bool operator>(const Token &refToken) const
Operator > to allow ordering.
Definition: Token.h:45
Token::m_technology
unsigned int m_technology
Technology identifier.
Definition: Token.h:111
Token::less
virtual bool less(const Token &pTok) const
Fast token comparison: operator less.
Definition: Token.cxx:94
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
Token::classID
const Guid & classID() const
Access database identifier.
Definition: Token.h:71
Token::OID_t::OID_t
OID_t()
Definition: Token.h:25
Token
This class provides a token that identifies in a unique way objects on the persistent storage.
Definition: Token.h:21
Token::m_classID
Guid m_classID
Object global identifier.
Definition: Token.h:117
Token::m_cntID
std::string m_cntID
Container identifier.
Definition: Token.h:115
Token::operator<
bool operator<(const Token &refToken) const
Operator < to allow ordering.
Definition: Token.h:43
Token::OID_t
Definition: Token.h:24
Token::addRef
int addRef()
Increase reference count.
Definition: Token.h:60
Token::fromString
Token & fromString(const std::string &from)
Build from the string representation of a token.
Definition: Token.cxx:133
Token::setClassID
Token & setClassID(const Guid &cl_id)
Access database identifier.
Definition: Token.h:73
Token::setDb
Token & setDb(const std::string &db)
Definition: Token.h:65
Token::technology
int technology() const
Access technology type.
Definition: Token.h:75
Token::setType
Token & setType(int t)
Set token type.
Definition: Token.h:87
Token::operator=
Token & operator=(const Token &copy)
No assignment allowed: put prototype to disable bit-wise assignment.
Definition: Token.cxx:69
Token::equal
virtual bool equal(const Token &pTok) const
Fast token comparison: operator equals.
Definition: Token.cxx:77
Token::oid
OID_t & oid()
Access object identifier.
Definition: Token.h:81
Token::setDb
Token & setDb(const Guid &db)
Set database name.
Definition: Token.h:64
Token::release
int release()
Release token: Decrease reference count and eventually delete.
Definition: Token.cxx:60
Token::m_oid
OID_t m_oid
Persistent object identifier.
Definition: Token.h:119
Token::type
int type() const
Access token type.
Definition: Token.h:85
Token::setTechnology
Token & setTechnology(int t)
Set technology type.
Definition: Token.h:77
Token::operator!=
bool operator!=(const Token &refToken) const
Equality operator.
Definition: Token.h:52
Token::toString
virtual const std::string toString() const
Retrieve the string representation of the token.
Definition: Token.cxx:114
Token::setOid
Token & setOid(const OID_t &oid)
Set object identifier.
Definition: Token.h:83
Guid
This class provides a encapsulation of a GUID/UUID/CLSID/IID data structure (128 bit number).
Definition: Guid.h:20
Token::~Token
virtual ~Token()
Standard destructor: release all allocated resources.
Definition: Token.cxx:55
Token::m_auxString
std::string m_auxString
Auxiliary string.
Definition: Token.h:123
trigbs_pickEvents.cnt
cnt
Definition: trigbs_pickEvents.py:71
Token::Token
Token()
Standard Constructor.
Definition: Token.cxx:22
Token::oid
const OID_t & oid() const
Access object identifier.
Definition: Token.h:79
Token::setAuxString
Token & setAuxString(const std::string &auxString)
Set auxiliary string.
Definition: Token.h:91
Guid::fromString
const Guid & fromString(const std::string &s)
Automatic conversion from string representation.
Definition: Guid.cxx:65
Token::setCont
Token & setCont(const std::string &cnt)
Set container name.
Definition: Token.h:69
copySelective.source
string source
Definition: copySelective.py:32
calibdata.copy
bool copy
Definition: calibdata.py:27
Guid.h
This file contains the class definition for the Guid class (migrated from POOL).
Token::numInstances
static int numInstances()
expose Token instance counter for debugging
Definition: Token.cxx:19
Token::m_refCount
int m_refCount
Reference count.
Definition: Token.h:109
Token::setData
const Token & setData(Token *pToken) const
Set all the data part of the token.
Definition: Token.cxx:194
Token::set
const Token & set(Token *pToken) const
Set token information.
Definition: Token.cxx:185
Token::operator==
bool operator==(const Token &refToken) const
Equality operator.
Definition: Token.h:50
Token::key
virtual const std::string key() const
Retrieve token key.
Definition: Token.cxx:172