CMS 3D CMS Logo

Entry.h
Go to the documentation of this file.
1 #ifndef FWCore_ParameterSet_Entry_h
2 #define FWCore_ParameterSet_Entry_h
3 
4 // ----------------------------------------------------------------------
5 // interface to Entry and related types
6 //
7 //
8 // The functions here are expected to go away. The exception
9 // processing is not ideal and is not a good model to follow.
10 //
11 // ----------------------------------------------------------------------
12 
13 #include <string>
14 #include <vector>
15 #include <iosfwd>
16 
20 //@@ not needed, but there might be trouble if we take it out
25 
26 // ----------------------------------------------------------------------
27 // contents
28 
29 namespace cms {
30  class Digest;
31 }
32 
33 namespace edm {
34  // forward declarations:
35  class ParameterSet;
36 
37  // ----------------------------------------------------------------------
38  // Entry
39 
40  class Entry {
41  public:
42  // Bool
43  Entry(std::string const& name, bool val, bool is_tracked);
44  bool getBool() const;
45 
46  // Int32
47  Entry(std::string const& name, int val, bool is_tracked);
48  int getInt32() const;
49 
50  // vInt32
51  Entry(std::string const& name, std::vector<int> const& val, bool is_tracked);
52  std::vector<int> getVInt32() const;
53 
54  // Uint32
55  Entry(std::string const& name, unsigned val, bool is_tracked);
56  unsigned getUInt32() const;
57 
58  // vUint32
59  Entry(std::string const& name, std::vector<unsigned> const& val, bool is_tracked);
60  std::vector<unsigned> getVUInt32() const;
61 
62  // Int64
63  Entry(std::string const& name, long long val, bool is_tracked);
64  long long getInt64() const;
65 
66  // vInt64
67  Entry(std::string const& name, std::vector<long long> const& val, bool is_tracked);
68  std::vector<long long> getVInt64() const;
69 
70  // Uint64
71  Entry(std::string const& name, unsigned long long val, bool is_tracked);
72  unsigned long long getUInt64() const;
73 
74  // vUint64
75  Entry(std::string const& name, std::vector<unsigned long long> const& val, bool is_tracked);
76  std::vector<unsigned long long> getVUInt64() const;
77 
78  // Double
79  Entry(std::string const& name, double val, bool is_tracked);
80  double getDouble() const;
81 
82  // vDouble
83  Entry(std::string const& name, std::vector<double> const& val, bool is_tracked);
84  std::vector<double> getVDouble() const;
85 
86  // String
87  Entry(std::string const& name, std::string const& val, bool is_tracked);
88  std::string getString() const;
89 
90  // vString
91  Entry(std::string const& name, std::vector<std::string> const& val, bool is_tracked);
92  std::vector<std::string> getVString() const;
93 
94  // FileInPath
95  Entry(std::string const& name, FileInPath const& val, bool is_tracked);
96  FileInPath getFileInPath() const;
97 
98  // InputTag
99  Entry(std::string const& name, InputTag const& tag, bool is_tracked);
100  InputTag getInputTag() const;
101 
102  // InputTag
103  Entry(std::string const& name, std::vector<InputTag> const& vtag, bool is_tracked);
104  std::vector<InputTag> getVInputTag() const;
105 
106  // ESInputTag
107  Entry(std::string const& name, ESInputTag const& tag, bool is_tracked);
108  ESInputTag getESInputTag() const;
109 
110  // VESInputTag
111  Entry(std::string const& name, std::vector<ESInputTag> const& vtag, bool is_tracked);
112  std::vector<ESInputTag> getVESInputTag() const;
113 
114  // EventID
115  Entry(std::string const& name, EventID const& tag, bool is_tracked);
116  EventID getEventID() const;
117 
118  // VEventID
119  Entry(std::string const& name, std::vector<EventID> const& vtag, bool is_tracked);
120  std::vector<EventID> getVEventID() const;
121 
122  // LuminosityBlockID
123  Entry(std::string const& name, LuminosityBlockID const& tag, bool is_tracked);
124  LuminosityBlockID getLuminosityBlockID() const;
125 
126  // VLuminosityBlockID
127  Entry(std::string const& name, std::vector<LuminosityBlockID> const& vtag, bool is_tracked);
128  std::vector<LuminosityBlockID> getVLuminosityBlockID() const;
129 
130  // LuminosityBlockRange
131  Entry(std::string const& name, LuminosityBlockRange const& tag, bool is_tracked);
132  LuminosityBlockRange getLuminosityBlockRange() const;
133 
134  // VLuminosityBlockRange
135  Entry(std::string const& name, std::vector<LuminosityBlockRange> const& vtag, bool is_tracked);
136  std::vector<LuminosityBlockRange> getVLuminosityBlockRange() const;
137 
138  // EventRange
139  Entry(std::string const& name, EventRange const& tag, bool is_tracked);
140  EventRange getEventRange() const;
141 
142  // VEventRange
143  Entry(std::string const& name, std::vector<EventRange> const& vtag, bool is_tracked);
144  std::vector<EventRange> getVEventRange() const;
145 
146  // ParameterSet
147  Entry(std::string const& name, ParameterSet const& val, bool is_tracked);
148  ParameterSet getPSet() const;
149 
150  // vPSet
151  Entry(std::string const& name, std::vector<ParameterSet> const& val, bool is_tracked);
152 
153  std::vector<ParameterSet> getVPSet() const;
154 
155  // coded string
156  Entry(std::string const& name, std::string const&);
157  Entry(std::string const& name, std::string const& type, std::string const& value, bool is_tracked);
158  Entry(std::string const& name, std::string const& type, std::vector<std::string> const& value, bool is_tracked);
159 
160  ~Entry() = default;
161  Entry(Entry const&) = default;
162  Entry(Entry&&) = default;
163  Entry& operator=(Entry const&) = default;
164  Entry& operator=(Entry&&) = default;
165  // encode
166 
167  std::string toString() const;
168  void toString(std::string& result) const;
169  void toDigest(cms::Digest& digest) const;
170 
171  size_t sizeOfString() const { return rep.size() + 4; }
172 
173  // access
174  bool isTracked() const { return tracked == '+'; }
175 
176  char typeCode() const { return type; }
177 
178  friend std::ostream& operator<<(std::ostream& ost, Entry const& entry);
179 
180  private:
183  char type;
184  char tracked;
185 
186  // verify class invariant
187  void validate() const;
188 
189  // decode
190  bool fromString(std::string::const_iterator b, std::string::const_iterator e);
191 
192  // helpers to throw exceptions
193  void throwValueError(char const* expectedType) const;
194  void throwEntryError(char const* expectedType, std::string const& badRep) const;
195  void throwEncodeError(char const* type) const;
196 
197  }; // Entry
198 
199  inline bool operator==(Entry const& a, Entry const& b) { return a.toString() == b.toString(); }
200 
201  inline bool operator!=(Entry const& a, Entry const& b) { return !(a == b); }
202 } // namespace edm
203 
204 #endif
type
Definition: HCALResponse.h:21
std::string rep
Definition: Entry.h:182
char type
Definition: Entry.h:183
size_t sizeOfString() const
Definition: Entry.h:171
bool isTracked() const
Definition: Entry.h:174
bool operator==(MD5Result const &a, MD5Result const &b)
Definition: Digest.cc:141
Definition: value.py:1
rep
Definition: cuy.py:1190
std::string toString(const std::pair< T, T > &aT)
Definition: CaloEllipse.h:72
Namespace of DDCMS conversion namespace.
std::string name_
Definition: Entry.h:181
def getFileInPath(rfile)
char tracked
Definition: Entry.h:184
double b
Definition: hdecay.h:120
bool operator!=(MD5Result const &a, MD5Result const &b)
Definition: Digest.h:37
HLT enums.
double a
Definition: hdecay.h:121
std::ostream & operator<<(std::ostream &os, MD5Result const &r)
Definition: Digest.h:39
char typeCode() const
Definition: Entry.h:176
pat::CandKinResolution::Parametrization fromString(const std::string &name)
Convert a name into a parametrization code.
std::string toString() const
Definition: Entry.cc:634