tdaq-develop-2025-02-12
DataDecoderConsumer_processor.cc
1 #include "otsdaq/DataProcessorPlugins/DataDecoderConsumer.h"
2 #include "otsdaq/Macros/CoutMacros.h"
3 #include "otsdaq/Macros/ProcessorPluginMacros.h"
4 #include "otsdaq/MessageFacility/MessageFacility.h"
5 #include "otsdaq/TablePlugins/DataDecoderConsumerTable.h"
6 
7 #include <unistd.h>
8 #include <cassert>
9 #include <iostream>
10 
11 using namespace ots;
12 
13 //==============================================================================
14 DataDecoderConsumer::DataDecoderConsumer(
15  std::string supervisorApplicationUID,
16  std::string bufferUID,
17  std::string processorUID,
18  const ConfigurationTree& theXDAQContextConfigTree,
19  const std::string& configurationPath)
20  : WorkLoop(processorUID)
21  , DataDecoder(supervisorApplicationUID, bufferUID, processorUID)
22  , DataConsumer(
23  supervisorApplicationUID, bufferUID, processorUID, HighConsumerPriority)
24  , Configurable(theXDAQContextConfigTree, configurationPath)
25 {
26 }
27 
28 //==============================================================================
29 DataDecoderConsumer::~DataDecoderConsumer(void) {}
30 
31 //==============================================================================
32 bool DataDecoderConsumer::workLoopThread(toolbox::task::WorkLoop* workLoop)
33 {
34  // std::cout << __COUT_HDR_FL__ << __PRETTY_FUNCTION__ << processorUID_ << " running!"
35  // << std::endl;
36  std::string buffer;
37  std::map<std::string, std::string> header;
38  // unsigned long block;
39  if(DataConsumer::read(buffer, header) < 0)
40  usleep(100000);
41  else
42  {
43  std::cout << __COUT_HDR_FL__ << __PRETTY_FUNCTION__ << processorUID_
44  << " Buffer: " << buffer << std::endl;
45  }
46  return true;
47 }
48 
49 DEFINE_OTS_PROCESSOR(DataDecoderConsumer)
int read(D &buffer, H &header)
Copies the buffer into the passed parameters.
Definition: DataConsumer.h:38