CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
12 #include <string>
13 #include <list>
14 
15 namespace edm {
16  class WrapperOwningHolder;
17  class ModuleDescription;
18  class ProductRegistry;
20  public:
21 
24 
25  struct TypeLabelItem {
26  TypeLabelItem (BranchType const& branchType, TypeID const& tid, std::string const& pin) :
27  branchType_(branchType),
28  typeID_(tid),
30  branchAlias_() {}
35  void setBranchAlias(std::string const& alias) const {branchAlias_ = alias;}
36  };
37 
38  typedef std::list<TypeLabelItem> TypeLabelList;
39 
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>
64  TypeLabelItem const& produces(std::string const& instanceName) {
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>
74  TypeLabelItem const& produces(std::string const& instanceName) {
75  TypeID tid(typeid(ProductType));
76  return produces<B>(tid,instanceName);
77  }
78 
79 
80  TypeLabelItem const& produces(const TypeID& id, std::string const& instanceName=std::string()) {
81  return produces<InEvent>(id,instanceName);
82  }
83 
84  template <BranchType B>
85  TypeLabelItem const& produces(const TypeID& id, std::string const& instanceName=std::string()) {
86  typeLabelList_.emplace_back(B, id, instanceName);
87  return *typeLabelList_.rbegin();
88  }
89  private:
91  };
92 
93 
94 }
95 
96 #endif
std::list< TypeLabelItem > TypeLabelList
TypeLabelItem const & produces(const TypeID &id, std::string const &instanceName=std::string())
TypeLabelItem const & produces(std::string const &instanceName)
BranchType
Definition: BranchType.h:11
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()
void setBranchAlias(std::string const &alias) const
TypeLabelItem const & produces(std::string const &instanceName)
TypeLabelItem(BranchType const &branchType, TypeID const &tid, std::string const &pin)
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)