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 $Id: ProductRegistryHelper.h,v 1.16 2011/07/06 20:29:12 wmtan Exp $
9 
10 
11 ----------------------------------------------------------------------*/
12 
15 #include <string>
16 #include <list>
17 
18 namespace edm {
19  class WrapperOwningHolder;
20  class ModuleDescription;
21  class ProductRegistry;
23  public:
24 
27 
28  struct TypeLabelItem {
29  TypeLabelItem (BranchType const& branchType, TypeID const& tid, std::string const& pin) :
30  branchType_(branchType),
31  typeID_(tid),
33  branchAlias_() {}
36  std::string productInstanceName_;
37  mutable std::string branchAlias_;
38  void setBranchAlias(std::string const& alias) const {branchAlias_ = alias;}
39  };
40 
41  typedef std::list<TypeLabelItem> TypeLabelList;
42 
45 
46  static
47  void addToRegistry(TypeLabelList::const_iterator const& iBegin,
48  TypeLabelList::const_iterator const& iEnd,
49  ModuleDescription const& iDesc,
50  ProductRegistry& iReg,
51  bool iIsListener=false);
52 
54 
61  template <class ProductType>
63  return produces<ProductType, InEvent>(std::string());
64  }
65 
66  template <class ProductType>
67  TypeLabelItem const& produces(std::string const& instanceName) {
68  return produces<ProductType, InEvent>(instanceName);
69  }
70 
71  template <typename ProductType, BranchType B>
73  return produces<ProductType, B>(std::string());
74  }
75 
76  template <typename ProductType, BranchType B>
77  TypeLabelItem const& produces(std::string const& instanceName) {
78  TypeID tid(typeid(ProductType));
79  return produces<B>(tid,instanceName);
80  }
81 
82 
83  TypeLabelItem const& produces(const TypeID& id, std::string const& instanceName=std::string()) {
84  return produces<InEvent>(id,instanceName);
85  }
86 
87  template <BranchType B>
88  TypeLabelItem const& produces(const TypeID& id, std::string const& instanceName=std::string()) {
89  TypeLabelItem tli(B, id, instanceName);
90  typeLabelList_.push_back(tli);
91  return *typeLabelList_.rbegin();
92  }
93  private:
95  };
96 
97 
98 }
99 
100 #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)
author Stefano ARGIRO author Bill Tanenbaum
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)