Public Member Functions | Private Member Functions | Private Attributes | List of all members
art::ProducesCollector Class Reference

#include <ProducesCollector.h>

Public Member Functions

template<typename P , BranchType B = InEvent>
void produces (std::string const &instanceName={}, Persistable const persistable=Persistable::Yes)
 
template<typename P , BranchType B>
TypeLabel const & reconstitutes (std::string const &modLabel, std::string const &instanceName={})
 
TypeLabelLookup_t const & expectedProducts (BranchType) const
 
void fillDescriptions (ModuleDescription const &md)
 

Private Member Functions

TypeLabel const & insertOrThrow (BranchType const bt, TypeLabel const &tl)
 

Private Attributes

std::array< TypeLabelLookup_t, NumBranchTypestypeLabelList_ {{}}
 

Detailed Description

Definition at line 55 of file ProducesCollector.h.

Member Function Documentation

TypeLabelLookup_t const & art::ProducesCollector::expectedProducts ( BranchType  bt) const
inline

Definition at line 81 of file ProducesCollector.h.

82  {
83  return typeLabelList_[bt];
84  }
bt
Definition: tracks.py:83
std::array< TypeLabelLookup_t, NumBranchTypes > typeLabelList_
void art::ProducesCollector::fillDescriptions ( ModuleDescription const &  md)

Definition at line 88 of file ProducesCollector.cc.

89  {
90  auto fillDescriptionsPerBT = [this, &md](BranchType const bt) {
92  // Go through products that will be produced in the current process.
93  check_for_duplicate_friendly_names(expectedProducts);
94 
95  for (auto& [typeLabel, pd] : expectedProducts) {
96  pd = BranchDescription{bt,
97  typeLabel,
98  md.moduleLabel(),
99  md.parameterSetID(),
100  md.processConfiguration()};
101  }
102  };
103  for_each_branch_type(fillDescriptionsPerBT);
104  }
bt
Definition: tracks.py:83
std::array< TypeLabelLookup_t, NumBranchTypes > typeLabelList_
BranchType
Definition: BranchType.h:20
void for_each_branch_type(F f)
Definition: BranchType.h:38
TypeLabelLookup_t const & expectedProducts(BranchType) const
TypeLabel const & art::ProducesCollector::insertOrThrow ( BranchType const  bt,
TypeLabel const &  tl 
)
private

Definition at line 69 of file ProducesCollector.cc.

70  {
71  auto result = typeLabelList_[bt].emplace(tl, BranchDescription{});
72  if (!result.second) {
73  ostringstream oss;
74  oss << "An attempt was made to declare the following product in the same "
75  "module:\n"
76  << "Branch type: " << bt << '\n'
77  << "Class name: " << tl.className() << '\n'
78  << "Product instance name: " << tl.productInstanceName() << '\n';
79  throw Exception{
81  "An error occurred during a call to 'produces' or 'reconstitutes'."}
82  << oss.str();
83  }
84  return result.first->first;
85  }
static QCString result
bt
Definition: tracks.py:83
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
std::array< TypeLabelLookup_t, NumBranchTypes > typeLabelList_
template<typename P , art::BranchType B>
void art::ProducesCollector::produces ( std::string const &  instanceName = {},
Persistable const  persistable = Persistable::Yes 
)
inline

Definition at line 88 of file ProducesCollector.h.

90  {
91  verifyInstanceName(instanceName);
92  TypeID const productType{typeid(P)};
93  verifyFriendlyClassName(productType.friendlyClassName());
94  bool const isTransient = (persistable == Persistable::No);
95  TypeLabel const typeLabel{
96  productType, instanceName, SupportsView<P>::value, isTransient};
97  insertOrThrow(B, typeLabel);
98  }
TypeLabel const & insertOrThrow(BranchType const bt, TypeLabel const &tl)
void verifyFriendlyClassName(std::string const &fcn)
Definition: verify_names.cc:16
std::pair< float, std::string > P
void verifyInstanceName(std::string const &in)
Definition: verify_names.cc:5
template<typename P , BranchType B>
TypeLabel const & art::ProducesCollector::reconstitutes ( std::string const &  modLabel,
std::string const &  instanceName = {} 
)

Definition at line 102 of file ProducesCollector.h.

104  {
105  verifyModuleLabel(emulatedModule);
106  verifyInstanceName(instanceName);
107  TypeID const productType{typeid(P)};
108  verifyFriendlyClassName(productType.friendlyClassName());
109  TypeLabel const typeLabel{
110  productType, instanceName, SupportsView<P>::value, emulatedModule};
111  return insertOrThrow(B, typeLabel);
112  }
TypeLabel const & insertOrThrow(BranchType const bt, TypeLabel const &tl)
void verifyFriendlyClassName(std::string const &fcn)
Definition: verify_names.cc:16
std::pair< float, std::string > P
void verifyInstanceName(std::string const &in)
Definition: verify_names.cc:5

Member Data Documentation

std::array<TypeLabelLookup_t, NumBranchTypes> art::ProducesCollector::typeLabelList_ {{}}
private

Definition at line 77 of file ProducesCollector.h.


The documentation for this class was generated from the following files: