Classes | Public Types | Public Member Functions | Private Member Functions | List of all members
art::test::ProductIDGetter Class Reference
Inheritance diagram for art::test::ProductIDGetter:
art::EDProducer art::detail::Producer art::detail::LegacyModule art::Modifier art::ModuleBase art::ProductRegistryHelper

Classes

struct  Config
 

Public Types

using Parameters = Table< Config >
 
- Public Types inherited from art::EDProducer
using ModuleType = EDProducer
 
using WorkerType = WorkerT< EDProducer >
 
- Public Types inherited from art::detail::Producer
template<typename UserConfig , typename KeysToIgnore = void>
using Table = Modifier::Table< UserConfig, KeysToIgnore >
 
- Public Types inherited from art::Modifier
template<typename UserConfig , typename UserKeysToIgnore = void>
using Table = ProducerTable< UserConfig, detail::ModuleConfig, UserKeysToIgnore >
 

Public Member Functions

 ProductIDGetter (Parameters const &)
 
- Public Member Functions inherited from art::EDProducer
 EDProducer ()=default
 
 EDProducer (fhicl::ParameterSet const &pset)
 
template<typename Config >
 EDProducer (Table< Config > const &config)
 
std::string workerType () const
 
- Public Member Functions inherited from art::detail::Producer
virtual ~Producer () noexcept
 
 Producer ()
 
 Producer (fhicl::ParameterSet const &)
 
 Producer (Producer const &)=delete
 
 Producer (Producer &&)=delete
 
Produceroperator= (Producer const &)=delete
 
Produceroperator= (Producer &&)=delete
 
void doBeginJob ()
 
void doEndJob ()
 
void doRespondToOpenInputFile (FileBlock const &fb)
 
void doRespondToCloseInputFile (FileBlock const &fb)
 
void doRespondToOpenOutputFiles (FileBlock const &fb)
 
void doRespondToCloseOutputFiles (FileBlock const &fb)
 
bool doBeginRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doEndRun (RunPrincipal &rp, ModuleContext const &mc)
 
bool doBeginSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEndSubRun (SubRunPrincipal &srp, ModuleContext const &mc)
 
bool doEvent (EventPrincipal &ep, ModuleContext const &mc, std::atomic< std::size_t > &counts_run, std::atomic< std::size_t > &counts_passed, std::atomic< std::size_t > &counts_failed)
 
- Public Member Functions inherited from art::Modifier
virtual ~Modifier () noexcept
 
 Modifier ()
 
 Modifier (Modifier const &)=delete
 
 Modifier (Modifier &&)=delete
 
Modifieroperator= (Modifier const &)=delete
 
Modifieroperator= (Modifier &&)=delete
 
- Public Member Functions inherited from art::ModuleBase
virtual ~ModuleBase () noexcept
 
 ModuleBase ()
 
ModuleDescription const & moduleDescription () const
 
void setModuleDescription (ModuleDescription const &)
 
template<typename T , BranchType = InEvent>
ProductToken< T > consumes (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > consumesView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void consumesMany ()
 
template<typename T , BranchType = InEvent>
ProductToken< T > mayConsume (InputTag const &)
 
template<typename Element , BranchType = InEvent>
ViewToken< Element > mayConsumeView (InputTag const &)
 
template<typename T , BranchType = InEvent>
void mayConsumeMany ()
 
std::array< std::vector< ProductInfo >, NumBranchTypes > const & getConsumables () const
 
void sortConsumables (std::string const &current_process_name)
 
template<typename T , BranchType BT>
ViewToken< T > consumesView (InputTag const &tag)
 
template<typename T , BranchType BT>
ViewToken< T > mayConsumeView (InputTag const &tag)
 

Private Member Functions

void beginSubRun (art::SubRun &) override
 
void produce (art::Event &) override
 

Additional Inherited Members

- Static Public Member Functions inherited from art::EDProducer
static void commitEvent (EventPrincipal &ep, Event &e)
 

Detailed Description

Definition at line 26 of file ProductIDGetter_module.cc.

Member Typedef Documentation

Definition at line 30 of file ProductIDGetter_module.cc.

Constructor & Destructor Documentation

art::test::ProductIDGetter::ProductIDGetter ( Parameters const &  ps)
explicit

Definition at line 38 of file ProductIDGetter_module.cc.

39  : EDProducer{ps}
40 {
41  produces<std::vector<int>, art::InSubRun>();
42  produces<art::Ptr<int>, art::InSubRun>();
43  produces<std::vector<int>>();
44  produces<art::Ptr<int>>();
45 }
static const double ps
Definition: Units.h:103
EDProducer()=default

Member Function Documentation

void art::test::ProductIDGetter::beginSubRun ( art::SubRun sr)
overrideprivatevirtual

Reimplemented from art::EDProducer.

Definition at line 48 of file ProductIDGetter_module.cc.

49 {
50  auto vip = std::make_unique<std::vector<int>>();
51  vip->push_back(1);
52  vip->push_back(3);
53  vip->push_back(5);
54  vip->push_back(7);
55 
56  art::ProductID const pv{sr.getProductID<std::vector<int>>()};
57  auto ptr = std::make_unique<art::Ptr<int>>(pv, 2, sr.productGetter(pv));
58 
59  BOOST_REQUIRE(ptr->id().isValid());
60 
61  art::ProductID const id{sr.put(std::move(vip))};
62  art::Ptr<int> const ptr_check{id, 2, sr.productGetter(id)};
63 
64  BOOST_REQUIRE_EQUAL(ptr->id(), ptr_check.id());
65  BOOST_REQUIRE(!ptr_check.isAvailable());
66 
67  sr.put(std::move(ptr), art::fullSubRun());
68 }
ProductID getProductID(std::string const &instance_name="") const
Definition: DataViewImpl.h:347
EDProductGetter const * productGetter(ProductID const pid) const
BOOST_REQUIRE(inFile)
constexpr auto fullSubRun()
ProductID put(std::unique_ptr< PROD > &&edp, FullSemantic< Level::Run > const semantic)
Definition: DataViewImpl.h:692
Definition: fwd.h:26
void art::test::ProductIDGetter::produce ( art::Event e)
overrideprivatevirtual

Implements art::EDProducer.

Definition at line 71 of file ProductIDGetter_module.cc.

72 {
73  // Test that getting a ProductID for an unregistered product yields an
74  // exception.
75  BOOST_REQUIRE_EXCEPTION(
76  e.getProductID<int>(), art::Exception, [](art::Exception const& e) {
77  return e.categoryCode() == art::errors::ProductRegistrationFailure;
78  });
79 
80  auto vip = std::make_unique<std::vector<int>>();
81  vip->push_back(0);
82  vip->push_back(2);
83  vip->push_back(4);
84  vip->push_back(6);
85 
86  art::ProductID const pv{e.getProductID<std::vector<int>>()};
87  auto ptr = std::make_unique<art::Ptr<int>>(pv, 2, e.productGetter(pv));
88 
89  BOOST_REQUIRE(ptr->id().isValid());
90 
91  art::ProductID const id{e.put(std::move(vip))};
92  art::Ptr<int> const ptr_check{id, 2, e.productGetter(id)};
93 
94  BOOST_REQUIRE_EQUAL(ptr->id(), ptr_check.id());
95  BOOST_REQUIRE(!ptr_check.isAvailable());
96 
97  e.put(std::move(ptr));
98 }
ProductID getProductID(std::string const &instance_name="") const
Definition: DataViewImpl.h:347
EDProductGetter const * productGetter(ProductID const pid) const
BOOST_REQUIRE(inFile)
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
Definition: Exception.h:66
ProductID put(std::unique_ptr< PROD > &&edp, FullSemantic< Level::Run > const semantic)
Definition: DataViewImpl.h:692
Definition: fwd.h:26

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