File indexing completed on 2023-03-17 11:04:10
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef gen_ParameterCollector_h
0013 #define gen_ParameterCollector_h
0014
0015 #include <ostream>
0016 #include <vector>
0017 #include <string>
0018 #include <map>
0019
0020 #include <boost/iterator/iterator_facade.hpp>
0021
0022 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0023
0024 namespace gen {
0025
0026 class ParameterCollector {
0027 public:
0028 ParameterCollector();
0029 ParameterCollector(const edm::ParameterSet &pset);
0030 ~ParameterCollector();
0031
0032
0033
0034
0035 class const_iterator
0036 : public boost::iterator_facade<const_iterator, const std::string, boost::forward_traversal_tag> {
0037 public:
0038 const_iterator() : collector_(nullptr), dump_(nullptr) {}
0039
0040 protected:
0041 friend class ParameterCollector;
0042
0043 inline const_iterator(const ParameterCollector *collector,
0044 std::vector<std::string>::const_iterator begin,
0045 std::vector<std::string>::const_iterator end,
0046 bool special = false,
0047 std::ostream *dump = nullptr);
0048
0049 private:
0050 friend class boost::iterator_core_access;
0051
0052 void increment();
0053 const std::string &dereference() const { return cache_; }
0054 bool equal(const const_iterator &other) const { return iter_ == other.iter_; }
0055
0056 void next();
0057
0058 typedef std::pair<std::vector<std::string>::const_iterator, std::vector<std::string>::const_iterator> IterPair;
0059
0060 const ParameterCollector *collector_;
0061 std::ostream *dump_;
0062 bool special_;
0063 std::vector<IterPair> iter_;
0064 std::string cache_;
0065 };
0066
0067
0068 const_iterator begin() const;
0069 const_iterator begin(std::ostream &dump) const;
0070
0071
0072 const_iterator begin(const std::string &block) const;
0073 const_iterator begin(const std::string &block, std::ostream &dump) const;
0074
0075
0076 const_iterator end() const { return const_iterator(); }
0077
0078
0079
0080 static std::string resolve(const std::string &line);
0081
0082 private:
0083 friend class const_iterator;
0084
0085 std::map<std::string, std::vector<std::string> > contents_;
0086 };
0087
0088 }
0089
0090 #endif