otsdaq_prepmodernization  v2_05_02_indev
NimStreamConsumer.h
1 #ifndef _ots_NimStreamConsumer_h_
2 #define _ots_NimStreamConsumer_h_
3 
4 //#include "otsdaq/DataManager/DataConsumer.h"
5 //#include "otsdaq/Configurable/Configurable.h"
6 #include "otsdaq-utilities/Visualization/VisualVConsumer.h"
7 
8 #include <string>
9 #include <vector>
10 
11 namespace ots
12 {
13 // class ConfigurationManager;
14 
15 class NimStreamConsumer : public VisualVConsumer
16 {
17  public:
18  NimStreamConsumer(std::string supervisorApplicationUID,
19  std::string bufferUID,
20  std::string processorUID,
21  const ConfigurationTree& theXDAQContextConfigTree,
22  const std::string& configurationPath);
23  virtual ~NimStreamConsumer(void);
24 
25  virtual std::string getNext(std::map<std::string, std::string>);
26 
27  // structure to hold state change data
28  struct timeline_pt
29  {
30  int timestamp;
31  int y_0;
32  int y_1;
33  int y_2;
34  int y_3;
35  };
36 
37  // Timeline of state change data
38  std::vector<timeline_pt> timeline;
39 
40  const std::vector<std::string> getTimelineData(int timestamp, int count);
41 
42  private:
43  bool workLoopThread(toolbox::task::WorkLoop* workLoop) override;
44  void fastRead(void) override;
45  void slowRead(void) override;
46 
47  // For fast read
48  std::string* dataP_;
49  std::map<std::string, std::string>* headerP_;
50  // For slow read
51  std::string data_;
52  std::map<std::string, std::string> header_;
53 
54  std::string data_str;
55 };
56 }
57 
58 #endif