CMS 3D CMS Logo

ProductRegistryHelper.h
Go to the documentation of this file.
1 #ifndef FWCore_Framework_ProductRegistryHelper_h
2 #define FWCore_Framework_ProductRegistryHelper_h
3 
4 /*----------------------------------------------------------------------
5 
6 ProductRegistryHelper:
7 
8 ----------------------------------------------------------------------*/
9 
13 #include <string>
14 #include <list>
15 
16 namespace edm {
17  class ModuleDescription;
18  class ProductRegistry;
20  public:
21 
24 
25  struct TypeLabelItem {
26  TypeLabelItem (Transition const& transition, TypeID const& tid, std::string const& pin) :
27  transition_(transition),
28  typeID_(tid),
30  branchAlias_() {}
35  void setBranchAlias(std::string const& alias) const {branchAlias_ = alias;}
36  };
37 
38  typedef std::list<TypeLabelItem> TypeLabelList;
39 
41  TypeLabelList & typeLabelList();
42 
43  static
44  void addToRegistry(TypeLabelList::const_iterator const& iBegin,
45  TypeLabelList::const_iterator const& iEnd,
46  ModuleDescription const& iDesc,
47  ProductRegistry& iReg,
48  bool iIsListener=false);
49 
51 
58  template <class ProductType>
60  return produces<ProductType, InEvent>(std::string());
61  }
62 
63  template <class ProductType>
65  return produces<ProductType, InEvent>(instanceName);
66  }
67 
68  template <typename ProductType, BranchType B>
70  return produces<ProductType, B>(std::string());
71  }
72 
73  template <typename ProductType, BranchType B>
75  TypeID tid(typeid(ProductType));
76  return produces<B>(tid,instanceName);
77  }
78 
79  template <typename ProductType, Transition B>
81  return produces<ProductType, B>(std::string());
82  }
83 
84  template <typename ProductType, Transition B>
86  TypeID tid(typeid(ProductType));
87  return produces<B>(tid,instanceName);
88  }
89 
90 
92  return produces<Transition::Event>(id,instanceName);
93  }
94 
95  template <BranchType B>
98  return *typeLabelList_.rbegin();
99  }
100  template <Transition B>
102  typeLabelList_.emplace_back(B, id, instanceName);
103  return *typeLabelList_.rbegin();
104  }
105 
106  private:
107  TypeLabelList typeLabelList_;
108  };
109 
110 
111 }
112 
113 #endif
std::list< TypeLabelItem > TypeLabelList
TypeLabelItem const & produces(const TypeID &id, std::string const &instanceName=std::string())
TypeLabelItem const & produces(std::string const &instanceName)
TypeLabelList & typeLabelList()
used by the fwk to register the list of products of this module
TypeLabelItem const & produces()
declare what type of product will make and with which optional label
TypeLabelItem const & produces()
Transition
Definition: Transition.h:12
void setBranchAlias(std::string const &alias) const
TypeLabelItem const & produces(std::string const &instanceName)
static const std::string B
constexpr Transition convertToTransition(BranchType iValue)
Definition: Transition.h:26
HLT enums.
TypeLabelItem const & produces(const TypeID &id, std::string const &instanceName=std::string())
static void addToRegistry(TypeLabelList::const_iterator const &iBegin, TypeLabelList::const_iterator const &iEnd, ModuleDescription const &iDesc, ProductRegistry &iReg, bool iIsListener=false)
TypeLabelItem(Transition const &transition, TypeID const &tid, std::string const &pin)