otsdaq  v2_05_02_indev
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(std::string supervisorApplicationUID,
15  std::string bufferUID,
16  std::string processorUID,
17  const ConfigurationTree& theXDAQContextConfigTree,
18  const std::string& configurationPath)
19  : WorkLoop(processorUID)
20  , DataDecoder(supervisorApplicationUID, bufferUID, processorUID)
21  , DataConsumer(supervisorApplicationUID, bufferUID, processorUID, HighConsumerPriority)
22  , Configurable(theXDAQContextConfigTree, configurationPath)
23 {
24 }
25 
26 //==============================================================================
27 DataDecoderConsumer::~DataDecoderConsumer(void) {}
28 
29 //==============================================================================
30 bool DataDecoderConsumer::workLoopThread(toolbox::task::WorkLoop* workLoop)
31 {
32  // std::cout << __COUT_HDR_FL__ << __PRETTY_FUNCTION__ << processorUID_ << " running!"
33  // << std::endl;
34  std::string buffer;
35  std::map<std::string, std::string> header;
36  // unsigned long block;
37  if(DataConsumer::read(buffer, header) < 0)
38  usleep(100000);
39  else
40  {
41  std::cout << __COUT_HDR_FL__ << __PRETTY_FUNCTION__ << processorUID_ << " Buffer: " << buffer << std::endl;
42  }
43  return true;
44 }
45 
46 DEFINE_OTS_PROCESSOR(DataDecoderConsumer)