File indexing completed on 2024-04-06 12:12:01
0001 #ifndef Framework_ConstProductRegistry_h
0002 #define Framework_ConstProductRegistry_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022 #include <vector>
0023 #include <string>
0024
0025
0026 #include "FWCore/Framework/interface/SignallingProductRegistry.h"
0027 #include "FWCore/ServiceRegistry/interface/connect_but_block_self.h"
0028 #include "FWCore/Utilities/interface/propagate_const.h"
0029
0030
0031 namespace edm {
0032 class ConstProductRegistry {
0033 public:
0034 typedef ProductRegistry::ProductList ProductList;
0035
0036 ConstProductRegistry(SignallingProductRegistry& iReg) : reg_(&iReg) {}
0037
0038 ConstProductRegistry(ConstProductRegistry const&) = delete;
0039 ConstProductRegistry& operator=(ConstProductRegistry const&) = delete;
0040
0041
0042 ProductRegistry const& productRegistry() const { return *reg_; }
0043
0044 ProductList const& productList() const { return reg_->productList(); }
0045
0046
0047
0048
0049 std::vector<std::string> allBranchNames() const { return reg_->allBranchNames(); }
0050
0051
0052
0053
0054
0055 std::vector<BranchDescription const*> allBranchDescriptions() const { return reg_->allBranchDescriptions(); }
0056
0057 bool anyProductProduced() const { return reg_->anyProductProduced(); }
0058
0059 template <class T>
0060 void watchProductAdditions(const T& iFunc) {
0061 serviceregistry::connect_but_block_self(reg_->productAddedSignal_, iFunc);
0062 }
0063 template <class T, class TMethod>
0064 void watchProductAdditions(T const& iObj, TMethod iMethod) {
0065 using std::placeholders::_1;
0066 serviceregistry::connect_but_block_self(reg_->productAddedSignal_, std::bind(iMethod, iObj, _1));
0067 }
0068
0069 private:
0070
0071 edm::propagate_const<SignallingProductRegistry*> reg_;
0072 };
0073 }
0074
0075 #endif