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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
|
#ifndef FWCore_ParameterSet_Entry_h
#define FWCore_ParameterSet_Entry_h
// ----------------------------------------------------------------------
// interface to Entry and related types
//
//
// The functions here are expected to go away. The exception
// processing is not ideal and is not a good model to follow.
//
// ----------------------------------------------------------------------
#include <string>
#include <vector>
#include <iosfwd>
#include "FWCore/Utilities/interface/FileInPath.h"
#include "FWCore/Utilities/interface/InputTag.h"
#include "FWCore/Utilities/interface/ESInputTag.h"
//@@ not needed, but there might be trouble if we take it out
#include "DataFormats/Provenance/interface/EventRange.h"
#include "DataFormats/Provenance/interface/LuminosityBlockID.h"
#include "DataFormats/Provenance/interface/LuminosityBlockRange.h"
#include "DataFormats/Provenance/interface/EventID.h"
// ----------------------------------------------------------------------
// contents
namespace cms {
class Digest;
}
namespace edm {
// forward declarations:
class ParameterSet;
// ----------------------------------------------------------------------
// Entry
class Entry {
public:
// Bool
Entry(std::string const& name, bool val, bool is_tracked);
bool getBool() const;
// Int32
Entry(std::string const& name, int val, bool is_tracked);
int getInt32() const;
// vInt32
Entry(std::string const& name, std::vector<int> const& val, bool is_tracked);
std::vector<int> getVInt32() const;
// Uint32
Entry(std::string const& name, unsigned val, bool is_tracked);
unsigned getUInt32() const;
// vUint32
Entry(std::string const& name, std::vector<unsigned> const& val, bool is_tracked);
std::vector<unsigned> getVUInt32() const;
// Int64
Entry(std::string const& name, long long val, bool is_tracked);
long long getInt64() const;
// vInt64
Entry(std::string const& name, std::vector<long long> const& val, bool is_tracked);
std::vector<long long> getVInt64() const;
// Uint64
Entry(std::string const& name, unsigned long long val, bool is_tracked);
unsigned long long getUInt64() const;
// vUint64
Entry(std::string const& name, std::vector<unsigned long long> const& val, bool is_tracked);
std::vector<unsigned long long> getVUInt64() const;
// Double
Entry(std::string const& name, double val, bool is_tracked);
double getDouble() const;
// vDouble
Entry(std::string const& name, std::vector<double> const& val, bool is_tracked);
std::vector<double> getVDouble() const;
// String
Entry(std::string const& name, std::string const& val, bool is_tracked);
std::string getString() const;
// vString
Entry(std::string const& name, std::vector<std::string> const& val, bool is_tracked);
std::vector<std::string> getVString() const;
// FileInPath
Entry(std::string const& name, FileInPath const& val, bool is_tracked);
FileInPath getFileInPath() const;
// InputTag
Entry(std::string const& name, InputTag const& tag, bool is_tracked);
InputTag getInputTag() const;
// InputTag
Entry(std::string const& name, std::vector<InputTag> const& vtag, bool is_tracked);
std::vector<InputTag> getVInputTag() const;
// ESInputTag
Entry(std::string const& name, ESInputTag const& tag, bool is_tracked);
ESInputTag getESInputTag() const;
// VESInputTag
Entry(std::string const& name, std::vector<ESInputTag> const& vtag, bool is_tracked);
std::vector<ESInputTag> getVESInputTag() const;
// EventID
Entry(std::string const& name, EventID const& tag, bool is_tracked);
EventID getEventID() const;
// VEventID
Entry(std::string const& name, std::vector<EventID> const& vtag, bool is_tracked);
std::vector<EventID> getVEventID() const;
// LuminosityBlockID
Entry(std::string const& name, LuminosityBlockID const& tag, bool is_tracked);
LuminosityBlockID getLuminosityBlockID() const;
// VLuminosityBlockID
Entry(std::string const& name, std::vector<LuminosityBlockID> const& vtag, bool is_tracked);
std::vector<LuminosityBlockID> getVLuminosityBlockID() const;
// LuminosityBlockRange
Entry(std::string const& name, LuminosityBlockRange const& tag, bool is_tracked);
LuminosityBlockRange getLuminosityBlockRange() const;
// VLuminosityBlockRange
Entry(std::string const& name, std::vector<LuminosityBlockRange> const& vtag, bool is_tracked);
std::vector<LuminosityBlockRange> getVLuminosityBlockRange() const;
// EventRange
Entry(std::string const& name, EventRange const& tag, bool is_tracked);
EventRange getEventRange() const;
// VEventRange
Entry(std::string const& name, std::vector<EventRange> const& vtag, bool is_tracked);
std::vector<EventRange> getVEventRange() const;
// ParameterSet
Entry(std::string const& name, ParameterSet const& val, bool is_tracked);
ParameterSet getPSet() const;
// vPSet
Entry(std::string const& name, std::vector<ParameterSet> const& val, bool is_tracked);
std::vector<ParameterSet> getVPSet() const;
// coded string
Entry(std::string name, std::string_view);
Entry(std::string name, std::string_view type, std::string_view value, bool is_tracked);
Entry(std::string name, std::string_view type, std::vector<std::string> const& value, bool is_tracked);
~Entry() = default;
Entry(Entry const&) = default;
Entry(Entry&&) = default;
Entry& operator=(Entry const&) = default;
Entry& operator=(Entry&&) = default;
// encode
std::string toString() const;
void toString(std::string& result) const;
void toDigest(cms::Digest& digest) const;
size_t sizeOfString() const { return rep_.size() + 4; }
// access
bool isTracked() const { return tracked_ == '+'; }
char typeCode() const { return type_; }
friend std::ostream& operator<<(std::ostream& ost, Entry const& entry);
//empty string view denotes failure to find bounds
static std::string_view bounds(std::string_view, std::size_t iEndHint);
private:
std::string name_;
std::string rep_;
char type_;
char tracked_;
// verify class invariant
void validate() const;
// decode
bool fromString(std::string_view::const_iterator b, std::string_view::const_iterator e);
// helpers to throw exceptions
void throwValueError(char const* expectedType) const;
void throwEntryError(char const* expectedType, std::string const& badRep) const;
void throwEncodeError(char const* type) const;
}; // Entry
inline bool operator==(Entry const& a, Entry const& b) { return a.toString() == b.toString(); }
inline bool operator!=(Entry const& a, Entry const& b) { return !(a == b); }
} // namespace edm
#endif
|