test
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 ModuleDescription;
17  class ProductRegistry;
19  public:
20 
23 
24  struct TypeLabelItem {
25  TypeLabelItem (BranchType const& branchType, TypeID const& tid, std::string const& pin) :
26  branchType_(branchType),
27  typeID_(tid),
29  branchAlias_() {}
35  };
36 
37  typedef std::list<TypeLabelItem> TypeLabelList;
38 
41 
42  static
43  void addToRegistry(TypeLabelList::const_iterator const& iBegin,
44  TypeLabelList::const_iterator const& iEnd,
45  ModuleDescription const& iDesc,
46  ProductRegistry& iReg,
47  bool iIsListener=false);
48 
50 
57  template <class ProductType>
59  return produces<ProductType, InEvent>(std::string());
60  }
61 
62  template <class ProductType>
63  TypeLabelItem const& produces(std::string const& instanceName) {
64  return produces<ProductType, InEvent>(instanceName);
65  }
66 
67  template <typename ProductType, BranchType B>
69  return produces<ProductType, B>(std::string());
70  }
71 
72  template <typename ProductType, BranchType B>
73  TypeLabelItem const& produces(std::string const& instanceName) {
74  TypeID tid(typeid(ProductType));
75  return produces<B>(tid,instanceName);
76  }
77 
78 
79  TypeLabelItem const& produces(const TypeID& id, std::string const& instanceName=std::string()) {
80  return produces<InEvent>(id,instanceName);
81  }
82 
83  template <BranchType B>
84  TypeLabelItem const& produces(const TypeID& id, std::string const& instanceName=std::string()) {
85  typeLabelList_.emplace_back(B, id, instanceName);
86  return *typeLabelList_.rbegin();
87  }
88  private:
90  };
91 
92 
93 }
94 
95 #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)