File indexing completed on 2024-04-06 12:12:51
0001 #ifndef FWCore_ParameterSet_Entry_h
0002 #define FWCore_ParameterSet_Entry_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #include <string>
0014 #include <vector>
0015 #include <iosfwd>
0016
0017 #include "FWCore/Utilities/interface/FileInPath.h"
0018 #include "FWCore/Utilities/interface/InputTag.h"
0019 #include "FWCore/Utilities/interface/ESInputTag.h"
0020
0021 #include "DataFormats/Provenance/interface/EventRange.h"
0022 #include "DataFormats/Provenance/interface/LuminosityBlockID.h"
0023 #include "DataFormats/Provenance/interface/LuminosityBlockRange.h"
0024 #include "DataFormats/Provenance/interface/EventID.h"
0025
0026
0027
0028
0029 namespace cms {
0030 class Digest;
0031 }
0032
0033 namespace edm {
0034
0035 class ParameterSet;
0036
0037
0038
0039
0040 class Entry {
0041 public:
0042
0043 Entry(std::string const& name, bool val, bool is_tracked);
0044 bool getBool() const;
0045
0046
0047 Entry(std::string const& name, int val, bool is_tracked);
0048 int getInt32() const;
0049
0050
0051 Entry(std::string const& name, std::vector<int> const& val, bool is_tracked);
0052 std::vector<int> getVInt32() const;
0053
0054
0055 Entry(std::string const& name, unsigned val, bool is_tracked);
0056 unsigned getUInt32() const;
0057
0058
0059 Entry(std::string const& name, std::vector<unsigned> const& val, bool is_tracked);
0060 std::vector<unsigned> getVUInt32() const;
0061
0062
0063 Entry(std::string const& name, long long val, bool is_tracked);
0064 long long getInt64() const;
0065
0066
0067 Entry(std::string const& name, std::vector<long long> const& val, bool is_tracked);
0068 std::vector<long long> getVInt64() const;
0069
0070
0071 Entry(std::string const& name, unsigned long long val, bool is_tracked);
0072 unsigned long long getUInt64() const;
0073
0074
0075 Entry(std::string const& name, std::vector<unsigned long long> const& val, bool is_tracked);
0076 std::vector<unsigned long long> getVUInt64() const;
0077
0078
0079 Entry(std::string const& name, double val, bool is_tracked);
0080 double getDouble() const;
0081
0082
0083 Entry(std::string const& name, std::vector<double> const& val, bool is_tracked);
0084 std::vector<double> getVDouble() const;
0085
0086
0087 Entry(std::string const& name, std::string const& val, bool is_tracked);
0088 std::string getString() const;
0089
0090
0091 Entry(std::string const& name, std::vector<std::string> const& val, bool is_tracked);
0092 std::vector<std::string> getVString() const;
0093
0094
0095 Entry(std::string const& name, FileInPath const& val, bool is_tracked);
0096 FileInPath getFileInPath() const;
0097
0098
0099 Entry(std::string const& name, InputTag const& tag, bool is_tracked);
0100 InputTag getInputTag() const;
0101
0102
0103 Entry(std::string const& name, std::vector<InputTag> const& vtag, bool is_tracked);
0104 std::vector<InputTag> getVInputTag() const;
0105
0106
0107 Entry(std::string const& name, ESInputTag const& tag, bool is_tracked);
0108 ESInputTag getESInputTag() const;
0109
0110
0111 Entry(std::string const& name, std::vector<ESInputTag> const& vtag, bool is_tracked);
0112 std::vector<ESInputTag> getVESInputTag() const;
0113
0114
0115 Entry(std::string const& name, EventID const& tag, bool is_tracked);
0116 EventID getEventID() const;
0117
0118
0119 Entry(std::string const& name, std::vector<EventID> const& vtag, bool is_tracked);
0120 std::vector<EventID> getVEventID() const;
0121
0122
0123 Entry(std::string const& name, LuminosityBlockID const& tag, bool is_tracked);
0124 LuminosityBlockID getLuminosityBlockID() const;
0125
0126
0127 Entry(std::string const& name, std::vector<LuminosityBlockID> const& vtag, bool is_tracked);
0128 std::vector<LuminosityBlockID> getVLuminosityBlockID() const;
0129
0130
0131 Entry(std::string const& name, LuminosityBlockRange const& tag, bool is_tracked);
0132 LuminosityBlockRange getLuminosityBlockRange() const;
0133
0134
0135 Entry(std::string const& name, std::vector<LuminosityBlockRange> const& vtag, bool is_tracked);
0136 std::vector<LuminosityBlockRange> getVLuminosityBlockRange() const;
0137
0138
0139 Entry(std::string const& name, EventRange const& tag, bool is_tracked);
0140 EventRange getEventRange() const;
0141
0142
0143 Entry(std::string const& name, std::vector<EventRange> const& vtag, bool is_tracked);
0144 std::vector<EventRange> getVEventRange() const;
0145
0146
0147 Entry(std::string const& name, ParameterSet const& val, bool is_tracked);
0148 ParameterSet getPSet() const;
0149
0150
0151 Entry(std::string const& name, std::vector<ParameterSet> const& val, bool is_tracked);
0152
0153 std::vector<ParameterSet> getVPSet() const;
0154
0155
0156 Entry(std::string name, std::string_view);
0157 Entry(std::string name, std::string_view type, std::string_view value, bool is_tracked);
0158 Entry(std::string name, std::string_view type, std::vector<std::string> const& value, bool is_tracked);
0159
0160 ~Entry() = default;
0161 Entry(Entry const&) = default;
0162 Entry(Entry&&) = default;
0163 Entry& operator=(Entry const&) = default;
0164 Entry& operator=(Entry&&) = default;
0165
0166
0167 std::string toString() const;
0168 void toString(std::string& result) const;
0169 void toDigest(cms::Digest& digest) const;
0170
0171 size_t sizeOfString() const { return rep_.size() + 4; }
0172
0173
0174 bool isTracked() const { return tracked_ == '+'; }
0175
0176 char typeCode() const { return type_; }
0177
0178 friend std::ostream& operator<<(std::ostream& ost, Entry const& entry);
0179
0180
0181 static std::string_view bounds(std::string_view, std::size_t iEndHint);
0182
0183 private:
0184 std::string name_;
0185 std::string rep_;
0186 char type_;
0187 char tracked_;
0188
0189
0190 void validate() const;
0191
0192
0193 bool fromString(std::string_view::const_iterator b, std::string_view::const_iterator e);
0194
0195
0196 void throwValueError(char const* expectedType) const;
0197 void throwEntryError(char const* expectedType, std::string const& badRep) const;
0198 void throwEncodeError(char const* type) const;
0199
0200 };
0201
0202 inline bool operator==(Entry const& a, Entry const& b) { return a.toString() == b.toString(); }
0203
0204 inline bool operator!=(Entry const& a, Entry const& b) { return !(a == b); }
0205 }
0206
0207 #endif