1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
#ifndef CondCommon_Time_h
#define CondCommon_Time_h
#include <utility>
#include <string>
#include <limits>
// #include <boost/cstdint.hpp>
#include "CondFormats/Common/interface/hash64.h"
namespace cond {
// typedef uint64_t Time_t;
typedef unsigned long long uint64_t; // avoid typedef to long on 64 bit
typedef unsigned long long Time_t;
typedef std::pair<unsigned int, unsigned int> UnpackedTime;
typedef std::pair<Time_t, Time_t> ValidityInterval;
typedef enum { invalid = -1, runnumber = 0, timestamp, lumiid, hash, userid } TimeType;
const unsigned int TIMETYPE_LIST_MAX = 5;
extern const cond::TimeType timeTypeList[TIMETYPE_LIST_MAX];
extern const cond::TimeType timeTypeValues[];
std::string const& timeTypeNames(int);
const Time_t TIMELIMIT(std::numeric_limits<Time_t>::max());
const Time_t invalidTime(0);
template <TimeType type>
struct RealTimeType {};
struct TimeTypeSpecs {
// the enum
TimeType type;
// the name
std::string name;
// begin, end, and invalid
Time_t beginValue;
Time_t endValue;
Time_t invalidValue;
};
template <>
struct RealTimeType<runnumber> {
// 0, run number
typedef unsigned int type;
};
template <>
struct RealTimeType<timestamp> {
// sec, nanosec
typedef uint64_t type;
};
template <>
struct RealTimeType<lumiid> {
// run, lumi-seg
typedef uint64_t type;
};
template <>
struct RealTimeType<hash> {
typedef uint64_t type;
};
template <>
struct RealTimeType<userid> {
typedef uint64_t type;
};
template <TimeType type>
struct TimeTypeTraits {
static const TimeTypeSpecs& specs() {
static const TimeTypeSpecs local = {type,
timeTypeNames(type),
1,
std::numeric_limits<typename RealTimeType<type>::type>::max(),
cond::invalidTime};
return local;
}
};
extern const TimeTypeSpecs timeTypeSpecs[];
// find spec by name
const TimeTypeSpecs& findSpecs(std::string const& name);
} // namespace cond
#endif
|