CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Types.h
Go to the documentation of this file.
1 #ifndef CondCore_CondDB_Types_h
2 #define CondCore_CondDB_Types_h
3 //
4 // Package: CondDB
5 //
6 //
7 /*
8  Description: various foundation types for Conditions
9 */
10 //
11 // Author: Giacomo Govi
12 // Created: June 2013
13 //
14 
15 #include <boost/date_time/posix_time/posix_time.hpp>
16 #include <boost/functional/hash.hpp>
17 //
19 
20 namespace cond {
21 
22  // to be removed after the transition to new DB
23  typedef enum { UNKNOWN_DB=0, COND_DB, ORA_DB } BackendType;
25  // for the validation of migrated data
26  typedef enum { ERROR=0, MIGRATED, VALIDATED } MigrationStatus;
27  static const std::vector<std::string> validationStatusText = { "Error",
28  "Migrated",
29  "Validated" };
30 
31  typedef enum {
32  SYNCH_ANY = 0,
42 
44 
46 
47  typedef std::string Hash;
48  static constexpr unsigned int HASH_SIZE = 40;
49 
50  // Basic element of the IOV sequence.
51  struct Iov_t {
52  virtual ~Iov_t(){}
53  virtual void clear();
54  bool isValid() const;
55  bool isValidFor( Time_t target ) const;
59  };
60 
61  struct Tag_t {
62  virtual void clear();
68  };
69 
70  struct TagInfo_t {
71  // FIX ME: to be simplyfied, currently keeping the same interface as CondCore/DBCommon/interface/TagInfo.h
77  size_t size;
78  };
79 
80  // temporarely, to minimize changes in the clients code
81  typedef TagInfo_t TagInfo;
82 
83  struct TagMetadata_t {
86  boost::posix_time::ptime insertionTime;
87  boost::posix_time::ptime modificationTime;
88  };
89 
90  // temporarely replacement for cond::LogDBEntry
91  struct LogDBEntry_t {
92  unsigned long long logId;
98  unsigned int payloadIdx;
99  unsigned long long lastSince;
104  };
105 
106  struct GTMetadata_t {
110  boost::posix_time::ptime insertionTime;
111  boost::posix_time::ptime snapshotTime;
112  };
113 
114  class GTEntry_t {
115  public:
117  m_data(){
118  }
119  GTEntry_t( const std::tuple<std::string,std::string,std::string>& gtEntryData ):
120  m_data( gtEntryData ){
121  }
122  GTEntry_t( const GTEntry_t& rhs ):
123  m_data( rhs.m_data ){
124  }
125 
126  GTEntry_t& operator=( const GTEntry_t& rhs ){
127  m_data = rhs.m_data;
128  return *this;
129  }
130 
131  const std::string& recordName() const {
132  return std::get<0>(m_data);
133  }
134  const std::string& recordLabel() const {
135  return std::get<1>(m_data);
136  }
137  const std::string& tagName() const {
138  return std::get<2>(m_data);
139  }
140  std::size_t hashvalue()const{
141  // taken from TagMetadata existing implementation.
142  // Is it correct ordering by tag? Tags are not unique in a GT, while record+label are...
143  boost::hash<std::string> hasher;
144  std::size_t result=hasher(tagName());
145  return result;
146  }
147  bool operator<(const GTEntry_t& toCompare ) const {
148  return this->hashvalue()<toCompare.hashvalue();
149  }
150 
151  private:
152  std::tuple<std::string,std::string,std::string> m_data;
153  };
154 
155 
156 }
157 
158 #endif
159 
virtual void clear()
Definition: Types.cc:10
type
Definition: HCALResponse.h:21
MigrationStatus
Definition: Types.h:26
static const std::vector< std::string > validationStatusText
Definition: Types.h:27
virtual ~Iov_t()
Definition: Types.h:52
SynchronizationType synchronizationType
Definition: Types.h:84
unsigned long long logId
Definition: Types.h:92
std::string synchronizationTypeNames(SynchronizationType type)
Definition: Types.cc:46
std::string provenance
Definition: Types.h:94
std::string payloadToken
Definition: Types.h:101
Time_t since
Definition: Types.h:56
std::string release
Definition: Types.h:109
boost::posix_time::ptime snapshotTime
Definition: Types.h:111
size_t size
Definition: Types.h:77
std::pair< Time_t, Time_t > ValidityInterval
Definition: Time.h:19
std::string execmessage
Definition: Types.h:103
std::string tag
Definition: Types.h:63
#define constexpr
TimeType
Definition: Time.h:21
std::string name
Definition: Types.h:73
cond::ValidityInterval lastInterval
Definition: Types.h:75
GTEntry_t(const std::tuple< std::string, std::string, std::string > &gtEntryData)
Definition: Types.h:119
unsigned long long Time_t
Definition: Time.h:16
SynchronizationType synchronizationTypeFromName(const std::string &name)
Definition: Types.cc:50
tuple result
Definition: query.py:137
std::string payloadClass
Definition: Types.h:100
Time_t validity
Definition: Types.h:107
Hash payloadId
Definition: Types.h:58
std::string Hash
Definition: Types.h:47
bool isValidFor(Time_t target) const
Definition: Types.cc:20
std::string description
Definition: Types.h:108
std::string description
Definition: Types.h:85
const std::string & recordLabel() const
Definition: Types.h:134
BackendType
Definition: Types.h:23
Time_t endOfValidity
Definition: Types.h:66
std::string destinationDB
Definition: Types.h:93
std::tuple< std::string, std::string, std::string > m_data
Definition: Types.h:152
std::string exectime
Definition: Types.h:102
GTEntry_t & operator=(const GTEntry_t &rhs)
Definition: Types.h:126
boost::posix_time::ptime modificationTime
Definition: Types.h:87
static constexpr unsigned int HASH_SIZE
Definition: Types.h:48
std::string lastPayloadToken
Definition: Types.h:76
TimeType timeType
Definition: Types.h:65
virtual void clear()
Definition: Types.cc:24
unsigned long long lastSince
Definition: Types.h:99
const std::string & recordName() const
Definition: Types.h:131
static constexpr BackendType DEFAULT_DB
Definition: Types.h:24
unsigned int payloadIdx
Definition: Types.h:98
std::string payloadType
Definition: Types.h:64
Time_t lastValidatedTime
Definition: Types.h:67
const std::string & tagName() const
Definition: Types.h:137
SynchronizationType
Definition: Types.h:31
TagInfo_t TagInfo
Definition: Types.h:81
std::string usertext
Definition: Types.h:95
bool operator<(const GTEntry_t &toCompare) const
Definition: Types.h:147
boost::posix_time::ptime insertionTime
Definition: Types.h:86
GTEntry_t(const GTEntry_t &rhs)
Definition: Types.h:122
boost::posix_time::ptime insertionTime
Definition: Types.h:110
std::size_t hashvalue() const
Definition: Types.h:140
std::string token
Definition: Types.h:74
bool isValid() const
Definition: Types.cc:16
std::string iovtimetype
Definition: Types.h:97
Time_t till
Definition: Types.h:57
std::string iovtag
Definition: Types.h:96