CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
14 #include <string>
15 #include <vector>
16 #include <iosfwd>
17 
21 //@@ not needed, but there might be trouble if we take it out
26 
27 // ----------------------------------------------------------------------
28 // contents
29 
30 namespace cms {
31  class Digest;
32 }
33 
34 namespace edm {
35  // forward declarations:
36  class ParameterSet;
37 
38  // ----------------------------------------------------------------------
39  // Entry
40 
41  class Entry {
42  public:
43  // Bool
44  Entry(std::string const& name, bool val, bool is_tracked);
45  bool getBool() const;
46 
47  // Int32
48  Entry(std::string const& name, int val, bool is_tracked);
49  int getInt32() const;
50 
51  // vInt32
52  Entry(std::string const& name, std::vector<int> const& val, bool is_tracked);
53  std::vector<int> getVInt32() const;
54 
55  // Uint32
56  Entry(std::string const& name, unsigned val, bool is_tracked);
57  unsigned getUInt32() const;
58 
59  // vUint32
60  Entry(std::string const& name, std::vector<unsigned> const& val, bool is_tracked);
61  std::vector<unsigned> getVUInt32() const;
62 
63  // Int64
64  Entry(std::string const& name, long long val, bool is_tracked);
65  long long getInt64() const;
66 
67  // vInt64
68  Entry(std::string const& name, std::vector<long long> const& val, bool is_tracked);
69  std::vector<long long> getVInt64() const;
70 
71  // Uint64
72  Entry(std::string const& name, unsigned long long val, bool is_tracked);
73  unsigned long long getUInt64() const;
74 
75  // vUint64
76  Entry(std::string const& name, std::vector<unsigned long long> const& val, bool is_tracked);
77  std::vector<unsigned long long> getVUInt64() const;
78 
79  // Double
80  Entry(std::string const& name, double val, bool is_tracked);
81  double getDouble() const;
82 
83  // vDouble
84  Entry(std::string const& name, std::vector<double> const& val, bool is_tracked);
85  std::vector<double> getVDouble() const;
86 
87  // String
88  Entry(std::string const& name, std::string const& val, bool is_tracked);
89  std::string getString() const;
90 
91  // vString
92  Entry(std::string const& name, std::vector<std::string> const& val, bool is_tracked);
93  std::vector<std::string> getVString() const;
94 
95  // FileInPath
96  Entry(std::string const& name, FileInPath const& val, bool is_tracked);
97  FileInPath getFileInPath() const;
98 
99  // InputTag
100  Entry(std::string const& name, InputTag const& tag, bool is_tracked);
101  InputTag getInputTag() const;
102 
103  // InputTag
104  Entry(std::string const& name, std::vector<InputTag> const& vtag, bool is_tracked);
105  std::vector<InputTag> getVInputTag() const;
106 
107  // ESInputTag
108  Entry(std::string const& name, ESInputTag const& tag, bool is_tracked);
109  ESInputTag getESInputTag() const;
110 
111  // VESInputTag
112  Entry(std::string const& name, std::vector<ESInputTag> const& vtag, bool is_tracked);
113  std::vector<ESInputTag> getVESInputTag() const;
114 
115  // EventID
116  Entry(std::string const& name, EventID const& tag, bool is_tracked);
117  EventID getEventID() const;
118 
119  // VEventID
120  Entry(std::string const& name, std::vector<EventID> const& vtag, bool is_tracked);
121  std::vector<EventID> getVEventID() const;
122 
123  // LuminosityBlockID
124  Entry(std::string const& name, LuminosityBlockID const& tag, bool is_tracked);
126 
127  // VLuminosityBlockID
128  Entry(std::string const& name, std::vector<LuminosityBlockID> const& vtag, bool is_tracked);
129  std::vector<LuminosityBlockID> getVLuminosityBlockID() const;
130 
131  // LuminosityBlockRange
132  Entry(std::string const& name, LuminosityBlockRange const& tag, bool is_tracked);
134 
135  // VLuminosityBlockRange
136  Entry(std::string const& name, std::vector<LuminosityBlockRange> const& vtag, bool is_tracked);
137  std::vector<LuminosityBlockRange> getVLuminosityBlockRange() const;
138 
139  // EventRange
140  Entry(std::string const& name, EventRange const& tag, bool is_tracked);
141  EventRange getEventRange() const;
142 
143  // VEventRange
144  Entry(std::string const& name, std::vector<EventRange> const& vtag, bool is_tracked);
145  std::vector<EventRange> getVEventRange() const;
146 
147  // ParameterSet
148  Entry(std::string const& name, ParameterSet const& val, bool is_tracked);
149  ParameterSet getPSet() const;
150 
151  // vPSet
152  Entry(std::string const& name, std::vector<ParameterSet> const& val, bool is_tracked);
153 
154  std::vector<ParameterSet> getVPSet() const;
155 
156  // coded string
157  Entry(std::string const& name, std::string const&);
158  Entry(std::string const& name, std::string const& type,
159  std::string const& value, bool is_tracked);
160  Entry(std::string const& name, std::string const& type,
161  std::vector<std::string> const& value, bool is_tracked);
162 
163  ~Entry();
164  // encode
165 
166  std::string toString() const;
167  void toString(std::string& result) const;
168  void toDigest(cms::Digest &digest) const;
169 
170  size_t sizeOfString() const {return rep.size() + 4;}
171 
172  // access
173  bool isTracked() const { return tracked == '+'; }
174 
175  char typeCode() const { return type; }
176 
177  friend std::ostream& operator<<(std::ostream& ost, Entry const& entry);
178 
179  private:
182  char type;
183  char tracked;
184 
185  // verify class invariant
186  void validate() const;
187 
188  // decode
189  bool fromString(std::string::const_iterator b, std::string::const_iterator e);
190 
191  // helpers to throw exceptions
192  void throwValueError(char const* expectedType) const;
193  void throwEntryError(char const* expectedType,std::string const& badRep) const;
194  void throwEncodeError(char const* type) const;
195 
196  }; // Entry
197 
198 
199  inline bool
200  operator==(Entry const& a, Entry const& b) {
201  return a.toString() == b.toString();
202  }
203 
204  inline bool
205  operator!=(Entry const& a, Entry const& b) {
206  return !(a == b);
207  }
208 } // namespace edm
209 
210 
211 #endif
std::vector< unsigned > getVUInt32() const
Definition: Entry.cc:708
type
Definition: HCALResponse.h:21
std::vector< double > getVDouble() const
Definition: Entry.cc:753
std::vector< unsigned long long > getVUInt64() const
Definition: Entry.cc:731
~Entry()
Definition: Entry.cc:81
std::string rep
Definition: Entry.h:181
std::vector< LuminosityBlockID > getVLuminosityBlockID() const
Definition: Entry.cc:879
ParameterSet getPSet() const
Definition: Entry.cc:934
int getInt32() const
Definition: Entry.cc:650
unsigned getUInt32() const
Definition: Entry.cc:697
char type
Definition: Entry.h:182
std::vector< InputTag > getVInputTag() const
Definition: Entry.cc:810
Entry(std::string const &name, bool val, bool is_tracked)
Definition: Entry.cc:257
bool operator!=(debugging_allocator< X > const &, debugging_allocator< Y > const &)
void throwValueError(char const *expectedType) const
Definition: Entry.cc:1062
LuminosityBlockRange getLuminosityBlockRange() const
Definition: Entry.cc:889
double getDouble() const
Definition: Entry.cc:742
std::vector< EventID > getVEventID() const
Definition: Entry.cc:856
size_t sizeOfString() const
Definition: Entry.h:170
void throwEntryError(char const *expectedType, std::string const &badRep) const
Definition: Entry.cc:1068
unsigned long long getUInt64() const
Definition: Entry.cc:720
long long getInt64() const
Definition: Entry.cc:673
bool isTracked() const
Definition: Entry.h:173
tuple result
Definition: query.py:137
std::vector< ParameterSet > getVPSet() const
Definition: Entry.cc:945
bool operator==(debugging_allocator< X > const &, debugging_allocator< Y > const &)
friend std::ostream & operator<<(std::ostream &ost, Entry const &entry)
Definition: Entry.cc:954
bool getBool() const
Definition: Entry.cc:638
InputTag getInputTag() const
Definition: Entry.cc:798
void throwEncodeError(char const *type) const
Definition: Entry.cc:1076
std::vector< long long > getVInt64() const
Definition: Entry.cc:684
std::vector< ESInputTag > getVESInputTag() const
Definition: Entry.cc:834
std::vector< EventRange > getVEventRange() const
Definition: Entry.cc:922
void validate() const
Definition: Entry.cc:88
std::string name_
Definition: Entry.h:180
FileInPath getFileInPath() const
Definition: Entry.cc:787
bool fromString(std::string::const_iterator b, std::string::const_iterator e)
Definition: Entry.cc:617
char tracked
Definition: Entry.h:183
std::vector< int > getVInt32() const
Definition: Entry.cc:661
double b
Definition: hdecay.h:120
LuminosityBlockID getLuminosityBlockID() const
Definition: Entry.cc:868
double a
Definition: hdecay.h:121
EventRange getEventRange() const
Definition: Entry.cc:911
std::vector< LuminosityBlockRange > getVLuminosityBlockRange() const
Definition: Entry.cc:900
char typeCode() const
Definition: Entry.h:175
ESInputTag getESInputTag() const
Definition: Entry.cc:822
void toDigest(cms::Digest &digest) const
Definition: Entry.cc:599
std::string toString() const
Definition: Entry.cc:608
std::vector< std::string > getVString() const
Definition: Entry.cc:775
std::string getString() const
Definition: Entry.cc:764
EventID getEventID() const
Definition: Entry.cc:845