artdaq_demo  v3_11_02
AsciiSimulator.hh
1 #ifndef artdaq_demo_Generators_AsciiSimulator_hh
2 #define artdaq_demo_Generators_AsciiSimulator_hh
3 
4 #include "artdaq-core-demo/Overlays/AsciiFragment.hh"
5 #include "artdaq-core-demo/Overlays/FragmentType.hh"
6 #include "artdaq-core/Data/Fragment.hh"
7 #include "artdaq/Generators/CommandableFragmentGenerator.hh"
8 #include "fhiclcpp/fwd.h"
9 
10 #include <atomic>
11 #include <random>
12 #include <thread>
13 #include <vector>
14 
15 namespace demo {
25 class AsciiSimulator : public artdaq::CommandableFragmentGenerator
26 {
27 public:
34  explicit AsciiSimulator(fhicl::ParameterSet const& ps);
35 
36 private:
46  bool getNext_(artdaq::FragmentPtrs& frags) override;
47 
48  // Explicitly declare that there is nothing special to be done
49  // by the start, stop, and stopNoMutex methods in this class
50  void start() override {}
51  void stop() override {}
52  void stopNoMutex() override {}
53 
54  // FHiCL-configurable variables. Note that the C++ variable names
55  // are the FHiCL variable names with a "_" appended
56 
57  std::size_t const throttle_usecs_;
58  std::condition_variable throttle_cv_;
59  std::mutex throttle_mutex_;
60 
61  // Members needed to generate the simulated data
62  std::string string1_;
63  std::string string2_;
64 
65  artdaq::Fragment::timestamp_t timestamp_;
66  int timestampScale_;
67 };
68 } // namespace demo
69 
70 #endif /* artdaq_demo_Generators_AsciiSimulator_hh */
Generates ASCIIFragments filled with user-specified ASCII strings.
AsciiSimulator(fhicl::ParameterSet const &ps)
AsciiSimulator Constructor.