otsdaq  3.11.00
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/TCPListenServer.h" // Make sure this is always first because <sys/types.h> (defined in Socket.h) must be first
7 
8 #include <atomic>
9 #include <chrono>
10 #include <cstdint>
11 #include <map>
12 #include <string>
13 
14 namespace ots
15 {
16 class ConfigurationTree;
17 
19  public Configurable,
20  public TCPListenServer
21 {
22  public:
23  TCPDataListenerProducer(std::string supervisorApplicationUID,
24  std::string bufferUID,
25  std::string processorUID,
26  const ConfigurationTree& theXDAQContextConfigTree,
27  const std::string& configurationPath);
28  virtual ~TCPDataListenerProducer(void);
29  virtual void startProcessingData(std::string runNumber) override;
30  virtual void stopProcessingData(void) override;
31 
34  std::map<std::string, std::string> getExtraStatus(void) const override;
35 
36  protected:
37  bool workLoopThread(toolbox::task::WorkLoop* workLoop) override;
38  void slowWrite(void);
39  void fastWrite(void);
40  void sampleSocketBacklog(void);
41 
42  std::atomic<uint64_t> statClients_{0};
43  std::atomic<uint64_t> statSocketBacklogBytes_{0};
44  std::chrono::steady_clock::time_point lastBacklogSample_{};
46  std::string data_;
47  std::map<std::string, std::string> header_;
49  std::string* dataP_;
50  std::map<std::string, std::string>* headerP_;
51 
52  std::string dataType_;
53  unsigned port_;
54 
55  // bool getNextFragment(void);
56 };
57 
58 } // namespace ots
59 
60 #endif
std::string data_
For slow write.
bool workLoopThread(toolbox::task::WorkLoop *workLoop) override
bool TCPDataListenerProducer::getNextFragment(void)
std::string * dataP_
For fast write.
std::map< std::string, std::string > getExtraStatus(void) const override
void sampleSocketBacklog(void)
work-loop thread only
defines used also by OtsConfigurationWizardSupervisor