CMS 3D CMS Logo

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  struct UserLogInfo{
25  };
26 
27 
28 
29  typedef enum {
30  SYNCH_ANY = 0,
40 
41  std::string synchronizationTypeNames( SynchronizationType type );
42 
43  SynchronizationType synchronizationTypeFromName( const std::string& name );
44 
45  typedef std::string Hash;
46  static constexpr unsigned int HASH_SIZE = 40;
47 
48  // Basic element of the IOV sequence.
49  struct Iov_t {
50  Iov_t(): since(time::MAX_VAL),till(time::MIN_VAL),payloadId(""){}
51  virtual ~Iov_t() = default;
52  virtual void clear();
53  bool isValid() const;
54  bool isValidFor( Time_t target ) const;
57  Hash payloadId;
58  };
59 
60  struct Tag_t {
61  virtual ~Tag_t() = default;
62  virtual void clear();
66  SynchronizationType synchronizationType;
69  };
70 
71  struct TagInfo_t {
72  // FIX ME: to be simplyfied, currently keeping the same interface as CondCore/DBCommon/interface/TagInfo.h
73  TagInfo_t(): name(""),token(""),lastInterval(0,0), lastPayloadToken(""),size(0){}
78  size_t size;
79  };
80 
81  // temporarely, to minimize changes in the clients code
82  typedef TagInfo_t TagInfo;
83 
84  struct TagMetadata_t {
85  SynchronizationType synchronizationType;
87  boost::posix_time::ptime insertionTime;
88  boost::posix_time::ptime modificationTime;
89  };
90 
91  // temporarely replacement for cond::LogDBEntry
92  struct LogDBEntry_t {
93  unsigned long long logId;
99  unsigned int payloadIdx;
100  unsigned long long lastSince;
105  };
106 
107  struct GTMetadata_t {
111  boost::posix_time::ptime insertionTime;
112  boost::posix_time::ptime snapshotTime;
113  };
114 
115  class GTEntry_t {
116  public:
118  m_data(){
119  }
120  GTEntry_t( const std::tuple<std::string,std::string,std::string>& gtEntryData ):
121  m_data( gtEntryData ){
122  }
123  GTEntry_t( const GTEntry_t& rhs ):
124  m_data( rhs.m_data ){
125  }
126 
127  GTEntry_t& operator=( const GTEntry_t& rhs ){
128  m_data = rhs.m_data;
129  return *this;
130  }
131 
132  const std::string& recordName() const {
133  return std::get<0>(m_data);
134  }
135  const std::string& recordLabel() const {
136  return std::get<1>(m_data);
137  }
138  const std::string& tagName() const {
139  return std::get<2>(m_data);
140  }
141  std::size_t hashvalue()const{
142  // Derived from CondDB v1 TagMetadata implementation.
143  // Unique Keys constructed with Record and Labels - allowing for multiple references of the same Tag in a GT
144  boost::hash<std::string> hasher;
146  if( !recordLabel().empty() ) key = key +"_"+recordLabel();
147  std::size_t result=hasher(key);
148  return result;
149  }
150  bool operator<(const GTEntry_t& toCompare ) const {
151  return this->hashvalue()<toCompare.hashvalue();
152  }
153 
154  private:
155  std::tuple<std::string,std::string,std::string> m_data;
156  };
157 
158  struct RunInfo_t {
159  RunInfo_t( const std::tuple<long long unsigned int, boost::posix_time::ptime,boost::posix_time::ptime>& data ):
160  run( std::get<0>(data) ),
161  start( std::get<1>(data) ),
162  end( std::get<2>(data) ){
163  }
165  boost::posix_time::ptime start;
166  boost::posix_time::ptime end;
167  };
168 
169 }
170 
171 #endif
172 
size
Write out results.
Definition: start.py:1
type
Definition: HCALResponse.h:21
SynchronizationType synchronizationType
Definition: Types.h:85
boost::posix_time::ptime end
Definition: Types.h:166
unsigned long long logId
Definition: Types.h:93
std::string synchronizationTypeNames(SynchronizationType type)
Definition: Types.cc:46
std::string provenance
Definition: Types.h:95
std::string provenance
Definition: Types.h:23
std::string payloadToken
Definition: Types.h:102
Time_t since
Definition: Types.h:55
const Time_t MIN_VAL(0)
std::string release
Definition: Types.h:110
boost::posix_time::ptime snapshotTime
Definition: Types.h:112
size_t size
Definition: Types.h:78
std::pair< Time_t, Time_t > ValidityInterval
Definition: Time.h:19
std::string execmessage
Definition: Types.h:104
std::string tag
Definition: Types.h:63
SynchronizationType synchronizationType
Definition: Types.h:66
TimeType
Definition: Time.h:21
std::string name
Definition: Types.h:74
RunInfo_t(const std::tuple< long long unsigned int, boost::posix_time::ptime, boost::posix_time::ptime > &data)
Definition: Types.h:159
cond::ValidityInterval lastInterval
Definition: Types.h:76
GTEntry_t(const std::tuple< std::string, std::string, std::string > &gtEntryData)
Definition: Types.h:120
unsigned long long Time_t
Definition: Time.h:16
SynchronizationType synchronizationTypeFromName(const std::string &name)
Definition: Types.cc:50
void clear(CLHEP::HepGenMatrix &m)
Helper function: Reset all elements of a matrix to 0.
Definition: matutil.cc:167
std::string payloadClass
Definition: Types.h:101
Time_t validity
Definition: Types.h:108
Hash payloadId
Definition: Types.h:57
std::string Hash
Definition: Types.h:45
#define end
Definition: vmac.h:39
std::string description
Definition: Types.h:109
boost::posix_time::ptime start
Definition: Types.h:165
std::string description
Definition: Types.h:86
const std::string & recordLabel() const
Definition: Types.h:135
Time_t endOfValidity
Definition: Types.h:67
std::string destinationDB
Definition: Types.h:94
std::tuple< std::string, std::string, std::string > m_data
Definition: Types.h:155
std::string exectime
Definition: Types.h:103
GTEntry_t & operator=(const GTEntry_t &rhs)
Definition: Types.h:127
boost::posix_time::ptime modificationTime
Definition: Types.h:88
static constexpr unsigned int HASH_SIZE
Definition: Types.h:46
std::string lastPayloadToken
Definition: Types.h:77
TimeType timeType
Definition: Types.h:65
unsigned long long lastSince
Definition: Types.h:100
std::string usertext
Definition: Types.h:24
Definition: plugin.cc:24
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
const std::string & recordName() const
Definition: Types.h:132
unsigned int payloadIdx
Definition: Types.h:99
std::string payloadType
Definition: Types.h:64
Time_t lastValidatedTime
Definition: Types.h:68
const std::string & tagName() const
Definition: Types.h:138
SynchronizationType
Definition: Types.h:29
Time_t run
Definition: Types.h:164
TagInfo_t TagInfo
Definition: Types.h:82
std::string usertext
Definition: Types.h:96
bool operator<(const GTEntry_t &toCompare) const
Definition: Types.h:150
boost::posix_time::ptime insertionTime
Definition: Types.h:87
Iov_t()
Definition: Types.h:50
GTEntry_t(const GTEntry_t &rhs)
Definition: Types.h:123
boost::posix_time::ptime insertionTime
Definition: Types.h:111
std::size_t hashvalue() const
Definition: Types.h:141
const Time_t MAX_VAL(std::numeric_limits< Time_t >::max())
std::string token
Definition: Types.h:75
T get(const Candidate &c)
Definition: component.h:55
#define constexpr
std::string iovtimetype
Definition: Types.h:98
Time_t till
Definition: Types.h:56
std::string iovtag
Definition: Types.h:97