otsdaq  v2_05_02_indev
TCPDataListenerProducer.h
1 #ifndef _ots_TCPDataListenerProducer_h_
2 #define _ots_TCPDataListenerProducer_h_
3 
4 #include "otsdaq/Configurable/Configurable.h"
5 #include "otsdaq/DataManager/DataProducer.h"
6 #include "otsdaq/NetworkUtilities/TCPSubscribeClient.h" // Make sure this is always first because <sys/types.h> (defined in Socket.h) must be first
7 
8 #include <string>
9 
10 namespace ots
11 {
12 class ConfigurationTree;
13 
15 {
16  public:
17  TCPDataListenerProducer(std::string supervisorApplicationUID,
18  std::string bufferUID,
19  std::string processorUID,
20  const ConfigurationTree& theXDAQContextConfigTree,
21  const std::string& configurationPath);
22  virtual ~TCPDataListenerProducer(void);
23  virtual void startProcessingData(std::string runNumber) override;
24  virtual void stopProcessingData(void) override;
25 
26  protected:
27  bool workLoopThread(toolbox::task::WorkLoop* workLoop) override;
28  void slowWrite(void);
29  void fastWrite(void);
30  // For slow write
31  std::string data_;
32  std::map<std::string, std::string> header_;
33  // For fast write
34  std::string* dataP_;
35  std::map<std::string, std::string>* headerP_;
36 
37  std::string ipAddress_;
38  unsigned short port_;
39  std::string dataType_;
40 
41  // bool getNextFragment(void);
42 };
43 
44 } // namespace ots
45 
46 #endif