ToySource.h
Go to the documentation of this file.
1 #ifndef art_test_Integration_ToySource_h
2 #define art_test_Integration_ToySource_h
3 
4 // Our simulated input file format is:
5 // A parameter in a parameter set, which contains a vector of vector of int.
6 // Each inner vector is a triplet of run/subrun/event number.
7 // -1 means no new item of that type
8 //
9 
13 #include "fhiclcpp/ParameterSet.h"
14 
15 #include <string>
16 #include <vector>
17 
18 namespace arttest {
19  class ToySource;
20 }
21 
23 public:
26  art::SourceHelper const& sHelper);
27 
28  virtual ~ToySource() = default;
29 
30  void closeCurrentFile();
31 
32  virtual void readFile(std::string const& name, art::FileBlock*& fb) = 0;
33 
34  bool readNext(art::RunPrincipal const* const inR,
35  art::SubRunPrincipal const* const inSR,
36  art::RunPrincipal*& outR,
37  art::SubRunPrincipal*& outSR,
38  art::EventPrincipal*& outE);
39 
40 protected:
41  // Helper function to throw an exception with the appropriate text.
42  [[noreturn]] static void throw_exception_from(const char* funcname);
43 
44  using vv_t = std::vector<std::tuple<int, int, int>>;
46 
51 
56  bool const throw_on_readNext_;
57  bool const throw_on_readFile_;
58 
60 };
61 #endif /* art_test_Integration_ToySource_h */
62 
63 // Local Variables:
64 // mode: c++
65 // End:
std::string currentFilename_
Definition: ToySource.h:53
static const double ps
Definition: Units.h:103
std::string string
Definition: nybbler.cc:12
static void throw_exception_from(const char *funcname)
Definition: ToySource.cc:121
virtual ~ToySource()=default
bool readNext(art::RunPrincipal const *const inR, art::SubRunPrincipal const *const inSR, art::RunPrincipal *&outR, art::SubRunPrincipal *&outSR, art::EventPrincipal *&outE)
Definition: ToySource.cc:44
bool const throw_on_construction_
Definition: ToySource.h:54
std::vector< std::tuple< int, int, int >> vv_t
Definition: ToySource.h:44
intermediate_table::const_iterator const_iterator
art::TypeLabel vtl_
Definition: ToySource.h:59
vv_t::const_iterator iter
Definition: ToySource.h:45
bool const throw_on_readNext_
Definition: ToySource.h:56
bool const throw_on_readFile_
Definition: ToySource.h:57
fhicl::ParameterSet data_
Definition: ToySource.h:49
void closeCurrentFile()
Definition: ToySource.cc:34
art::SourceHelper const & sHelper_
Definition: ToySource.h:52
bool const throw_on_closeCurrentFile_
Definition: ToySource.h:55
virtual void readFile(std::string const &name, art::FileBlock *&fb)=0
ToySource(fhicl::ParameterSet const &ps, art::ProductRegistryHelper &help, art::SourceHelper const &sHelper)
Definition: ToySource.cc:12