Go to the documentation of this file.00001 #ifndef CondCommon_Time_h
00002 #define CondCommon_Time_h
00003 #include<utility>
00004 #include <string>
00005 #include <limits>
00006
00007
00008 #include "CondFormats/Common/interface/hash64.h"
00009
00010
00011 namespace cond{
00012
00013
00014
00015 typedef unsigned long long uint64_t;
00016 typedef unsigned long long Time_t;
00017 typedef std::pair<unsigned int, unsigned int> UnpackedTime;
00018
00019 typedef std::pair<Time_t, Time_t> ValidityInterval;
00020
00021 typedef enum { runnumber=0, timestamp, lumiid, hash, userid } TimeType;
00022 const unsigned int TIMETYPE_LIST_MAX=5;
00023
00024 extern const cond::TimeType timeTypeList[TIMETYPE_LIST_MAX];
00025
00026 extern const cond::TimeType timeTypeValues[];
00027
00028 std::string const & timeTypeNames(int);
00029
00030 const Time_t TIMELIMIT(std::numeric_limits<Time_t>::max());
00031
00032 const Time_t invalidTime(0);
00033
00034 template<TimeType type>
00035 struct RealTimeType {
00036 };
00037
00038
00039 struct TimeTypeSpecs {
00040
00041 TimeType type;
00042
00043 std::string name;
00044
00045 Time_t beginValue;
00046 Time_t endValue;
00047 Time_t invalidValue;
00048
00049 };
00050
00051
00052 template<> struct RealTimeType<runnumber> {
00053
00054 typedef unsigned int type;
00055 };
00056
00057 template<> struct RealTimeType<timestamp> {
00058
00059 typedef uint64_t type;
00060 };
00061
00062
00063 template<> struct RealTimeType<lumiid> {
00064
00065 typedef uint64_t type;
00066 };
00067
00068 template<> struct RealTimeType<hash> {
00069 typedef uint64_t type;
00070 };
00071
00072 template<> struct RealTimeType<userid> {
00073 typedef uint64_t type;
00074 };
00075
00076
00077 template<TimeType type>
00078 struct TimeTypeTraits {
00079 static const TimeTypeSpecs & specs() {
00080 static const TimeTypeSpecs local = {
00081 type,
00082 timeTypeNames(type),
00083 1,
00084 std::numeric_limits<typename RealTimeType<type>::type>::max(),
00085 cond::invalidTime
00086 };
00087 return local;
00088 }
00089 };
00090
00091 extern const TimeTypeSpecs timeTypeSpecs[];
00092
00093
00094 const TimeTypeSpecs & findSpecs(std::string const & name);
00095
00096
00097 }
00098 #endif
00099