IDNumber.h
Go to the documentation of this file.
1 #ifndef canvas_Persistency_Provenance_IDNumber_h
2 #define canvas_Persistency_Provenance_IDNumber_h
3 
5 #include <cstdint>
6 
7 namespace art {
8 
9  template <Level>
10  struct IDNumber;
11 
12  template <>
13  struct IDNumber<Level::Event> {
14  using type = std::uint32_t;
15  static constexpr type
17  {
18  return -1u;
19  }
20  static constexpr type
22  {
23  return invalid() - 1u;
24  }
25  static constexpr type
27  {
28  return max_valid();
29  }
30  static constexpr type
32  {
33  return flush_value() - 1u;
34  }
35  static constexpr type
37  {
38  return 1u;
39  }
40  static type
41  next(type const n)
42  {
43  return n + 1u;
44  }
45  };
46 
47  template <>
48  struct IDNumber<Level::SubRun> {
49  using type = std::uint32_t;
50  static constexpr type
52  {
53  return -1u;
54  }
55  static constexpr type
57  {
58  return invalid() - 1u;
59  }
60  static constexpr type
62  {
63  return max_valid();
64  }
65  static constexpr type
67  {
68  return flush_value() - 1u;
69  }
70  static constexpr type
72  {
73  return 0u;
74  }
75  };
76 
77  template <>
78  struct IDNumber<Level::Run> {
79  using type = std::uint32_t;
80  static constexpr type
82  {
83  return -1u;
84  }
85  static constexpr type
87  {
88  return invalid() - 1u;
89  }
90  static constexpr type
92  {
93  return max_valid();
94  }
95  static constexpr type
97  {
98  return flush_value() - 1u;
99  }
100  static constexpr type
102  {
103  return 1u;
104  }
105  };
106 
107  template <Level L>
108  using IDNumber_t = typename IDNumber<L>::type;
109 
110  template <Level L = Level::Event>
111  constexpr bool
113  {
114  return id != IDNumber<L>::invalid();
115  }
116 
120 }
121 
122 #endif /* canvas_Persistency_Provenance_IDNumber_h */
123 
124 // Local variables:
125 // mode: c++
126 // End:
static constexpr type invalid()
Definition: IDNumber.h:51
static constexpr type max_valid()
Definition: IDNumber.h:21
static constexpr type invalid()
Definition: IDNumber.h:16
Level
Definition: Level.h:12
constexpr bool is_valid(IDNumber_t< L > const id)
Definition: IDNumber.h:112
static constexpr type invalid()
Definition: IDNumber.h:81
Definition: Run.h:31
static constexpr type flush_value()
Definition: IDNumber.h:26
static constexpr type max_natural()
Definition: IDNumber.h:96
static constexpr type flush_value()
Definition: IDNumber.h:61
typename IDNumber< L >::type IDNumber_t
Definition: IDNumber.h:108
IDNumber_t< Level::SubRun > SubRunNumber_t
Definition: IDNumber.h:118
static constexpr type first()
Definition: IDNumber.h:101
static constexpr type max_natural()
Definition: IDNumber.h:31
static constexpr type first()
Definition: IDNumber.h:36
static constexpr type flush_value()
Definition: IDNumber.h:91
static constexpr type max_valid()
Definition: IDNumber.h:86
IDNumber_t< Level::Event > EventNumber_t
Definition: IDNumber.h:117
static constexpr type max_valid()
Definition: IDNumber.h:56
static type next(type const n)
Definition: IDNumber.h:41
Service to store calibration data products (CDP) in the SQLite3 metadatabase of a file...
Definition: FillParentInfo.h:8
static constexpr type first()
Definition: IDNumber.h:71
static constexpr type max_natural()
Definition: IDNumber.h:66
IDNumber_t< Level::Run > RunNumber_t
Definition: IDNumber.h:119