BareStringProducer_module.cc
Go to the documentation of this file.
1 //--------------------------------------------------------------------
2 //
3 // Produces an IntProduct instance.
4 //
5 //--------------------------------------------------------------------
6 
12 #include "fhiclcpp/ParameterSet.h"
13 
14 #include <memory>
15 #include <string>
16 
17 namespace arttest {
18  class BareStringProducer;
19 }
20 
22 
24 public:
25  struct Config {
28  art::InEvent};
29  };
30 
32  explicit BareStringProducer(Parameters const& p)
33  : EDProducer{p}
34  , value_{p().value()}
36  {
37  art::test::run_time_produces<std::string>(this, branchType_);
38  }
39 
40 private:
41  void beginRun(art::Run& r) override;
42  void beginSubRun(art::SubRun& sr) override;
43  void produce(art::Event& e) override;
44 
47 
48 }; // BareStringProducer
49 
50 void
52 {
53  if (branchType_ != art::InRun)
54  return;
55  r.put(std::make_unique<std::string>(value_));
56 }
57 
58 void
60 {
62  return;
63  sr.put(std::make_unique<std::string>(value_));
64 }
65 
66 void
68 {
70  return;
71  e.put(std::make_unique<std::string>(value_));
72 }
73 
void beginRun(art::Run &r) override
std::string string
Definition: nybbler.cc:12
EDProducer()=default
Definition: Run.h:21
const double e
#define DEFINE_ART_MODULE(klass)
Definition: ModuleMacros.h:68
p
Definition: test.py:228
void beginSubRun(art::SubRun &sr) override
BranchType
Definition: BranchType.h:18
ProductID put(std::unique_ptr< PROD > &&edp, FullSemantic< Level::Run > const semantic)
Definition: DataViewImpl.h:692
static const double sr
Definition: Units.h:167
void produce(art::Event &e) override
AdcRoiViewer::Name Name