CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/FWCore/ParameterSet/interface/Entry.h

Go to the documentation of this file.
00001 #ifndef FWCore_ParameterSet_Entry_h
00002 #define FWCore_ParameterSet_Entry_h
00003 
00004 // ----------------------------------------------------------------------
00005 // interface to Entry and related types
00006 //
00007 //
00008 // The functions here are expected to go away.  The exception
00009 // processing is not ideal and is not a good model to follow.
00010 //
00011 // ----------------------------------------------------------------------
00012 
00013 
00014 #include <string>
00015 #include <vector>
00016 #include <iosfwd>
00017 
00018 #include "FWCore/ParameterSet/interface/FileInPath.h"
00019 #include "FWCore/Utilities/interface/InputTag.h"
00020 #include "FWCore/Utilities/interface/ESInputTag.h"
00021 //@@ not needed, but there might be trouble if we take it out
00022 #include "DataFormats/Provenance/interface/EventRange.h"
00023 #include "DataFormats/Provenance/interface/LuminosityBlockID.h"
00024 #include "DataFormats/Provenance/interface/LuminosityBlockRange.h"
00025 #include "DataFormats/Provenance/interface/EventID.h"
00026 
00027 // ----------------------------------------------------------------------
00028 // contents
00029 
00030 namespace edm {
00031   // forward declarations:
00032   class ParameterSet;
00033 
00034   // ----------------------------------------------------------------------
00035   // Entry
00036 
00037   class Entry {
00038   public:
00039     // Bool
00040     Entry(std::string const& name, bool val, bool is_tracked);
00041     bool  getBool() const;
00042 
00043     // Int32
00044     Entry(std::string const& name, int val, bool is_tracked);
00045     int  getInt32() const;
00046 
00047     // vInt32
00048     Entry(std::string const& name, std::vector<int> const& val, bool is_tracked);
00049     std::vector<int> getVInt32() const;
00050 
00051     // Uint32
00052     Entry(std::string const& name, unsigned val, bool is_tracked);
00053     unsigned  getUInt32() const;
00054 
00055     // vUint32
00056     Entry(std::string const& name, std::vector<unsigned> const& val, bool is_tracked);
00057     std::vector<unsigned> getVUInt32() const;
00058 
00059     // Int64
00060     Entry(std::string const& name, long long val, bool is_tracked);
00061     long long  getInt64() const;
00062 
00063     // vInt64
00064     Entry(std::string const& name, std::vector<long long> const& val, bool is_tracked);
00065     std::vector<long long> getVInt64() const;
00066 
00067     // Uint64
00068     Entry(std::string const& name, unsigned long long val, bool is_tracked);
00069     unsigned long long  getUInt64() const;
00070 
00071     // vUint64
00072     Entry(std::string const& name, std::vector<unsigned long long> const& val, bool is_tracked);
00073     std::vector<unsigned long long> getVUInt64() const;
00074 
00075     // Double
00076     Entry(std::string const& name, double val, bool is_tracked);
00077     double getDouble() const;
00078 
00079     // vDouble
00080     Entry(std::string const& name, std::vector<double> const& val, bool is_tracked);
00081     std::vector<double> getVDouble() const;
00082 
00083     // String
00084     Entry(std::string const& name, std::string const& val, bool is_tracked);
00085     std::string getString() const;
00086 
00087     // vString
00088     Entry(std::string const& name, std::vector<std::string> const& val, bool is_tracked);
00089     std::vector<std::string> getVString() const;
00090 
00091     // FileInPath
00092     Entry(std::string const& name, FileInPath const& val, bool is_tracked);
00093     FileInPath getFileInPath() const;
00094 
00095     // InputTag
00096     Entry(std::string const& name, InputTag const& tag, bool is_tracked);
00097     InputTag getInputTag() const;
00098 
00099     // InputTag
00100     Entry(std::string const& name, std::vector<InputTag> const& vtag, bool is_tracked);
00101     std::vector<InputTag> getVInputTag() const;
00102 
00103     // ESInputTag
00104     Entry(std::string const& name, ESInputTag const& tag, bool is_tracked);
00105     ESInputTag getESInputTag() const;
00106 
00107     // VESInputTag
00108     Entry(std::string const& name, std::vector<ESInputTag> const& vtag, bool is_tracked);
00109     std::vector<ESInputTag> getVESInputTag() const;
00110 
00111     // EventID
00112     Entry(std::string const& name, EventID const& tag, bool is_tracked);
00113     EventID getEventID() const;
00114 
00115     // VEventID
00116     Entry(std::string const& name, std::vector<EventID> const& vtag, bool is_tracked);
00117     std::vector<EventID> getVEventID() const;
00118 
00119     // LuminosityBlockID
00120     Entry(std::string const& name, LuminosityBlockID const& tag, bool is_tracked);
00121     LuminosityBlockID getLuminosityBlockID() const;
00122 
00123     // VLuminosityBlockID
00124     Entry(std::string const& name, std::vector<LuminosityBlockID> const& vtag, bool is_tracked);
00125     std::vector<LuminosityBlockID> getVLuminosityBlockID() const;
00126 
00127     // LuminosityBlockRange
00128     Entry(std::string const& name, LuminosityBlockRange const& tag, bool is_tracked);
00129     LuminosityBlockRange getLuminosityBlockRange() const;
00130 
00131     // VLuminosityBlockRange
00132     Entry(std::string const& name, std::vector<LuminosityBlockRange> const& vtag, bool is_tracked);
00133     std::vector<LuminosityBlockRange> getVLuminosityBlockRange() const;
00134 
00135     // EventRange
00136     Entry(std::string const& name, EventRange const& tag, bool is_tracked);
00137     EventRange getEventRange() const;
00138 
00139     // VEventRange
00140     Entry(std::string const& name, std::vector<EventRange> const& vtag, bool is_tracked);
00141     std::vector<EventRange> getVEventRange() const;
00142 
00143     // ParameterSet
00144     Entry(std::string const& name, ParameterSet const& val, bool is_tracked);
00145     ParameterSet getPSet() const;
00146 
00147     // vPSet
00148     Entry(std::string const& name, std::vector<ParameterSet> const& val, bool is_tracked);
00149 
00150     std::vector<ParameterSet> getVPSet() const;
00151 
00152     // coded string
00153     Entry(std::string const& name, std::string const&);
00154     Entry(std::string const& name, std::string const& type,
00155           std::string const& value, bool is_tracked);
00156     Entry(std::string const& name, std::string const& type,
00157           std::vector<std::string> const& value, bool is_tracked);
00158 
00159     ~Entry();
00160     // encode
00161 
00162     std::string toString() const;
00163     void toString(std::string& result) const;
00164 
00165     size_t sizeOfString() const {return rep.size() + 4;}
00166 
00167     // access
00168     bool isTracked() const { return tracked == '+'; }
00169 
00170     char typeCode() const { return type; }
00171 
00172     friend std::ostream& operator<<(std::ostream& ost, Entry const& entry);
00173 
00174   private:
00175     std::string name_;
00176     std::string  rep;
00177     char         type;
00178     char         tracked;
00179 
00180     // verify class invariant
00181     void validate() const;
00182 
00183     // decode
00184     bool fromString(std::string::const_iterator b, std::string::const_iterator e);
00185 
00186     // helpers to throw exceptions
00187     void throwValueError(char const* expectedType) const;
00188     void throwEntryError(char const* expectedType,std::string const& badRep) const;
00189     void throwEncodeError(char const* type) const;
00190 
00191   };  // Entry
00192 
00193 
00194   inline bool
00195   operator==(Entry const& a, Entry const& b) {
00196     return a.toString() == b.toString();
00197   }
00198 
00199   inline bool
00200   operator!=(Entry const& a, Entry const& b) {
00201     return !(a == b);
00202   }
00203 } // namespace edm
00204 
00205 
00206 #endif