tdaq-develop-2025-02-12
DataProducerBase.cc
1 #include "otsdaq/DataManager/DataProducerBase.h"
2 #include "otsdaq/ConfigurationInterface/ConfigurationManager.h"
3 #include "otsdaq/DataManager/DataManager.h"
4 #include "otsdaq/DataManager/DataManagerSingleton.h"
5 
6 #include <iostream>
7 #include <memory>
8 using namespace ots;
9 
10 #undef __MF_SUBJECT__
11 #define __MF_SUBJECT__ "Producer"
12 #define mfSubject_ (std::string("ProducerBase:") + DataProcessor::processorUID_)
13 
14 //==============================================================================
15 DataProducerBase::DataProducerBase(const std::string& supervisorApplicationUID,
16  const std::string& bufferUID,
17  const std::string& processorUID,
18  unsigned int bufferSize)
19  : DataProcessor(supervisorApplicationUID, bufferUID, processorUID)
20  , bufferSize_(bufferSize)
21 {
22  __GEN_COUT__ << "Constructor." << __E__;
23  registerToBuffer();
24  __GEN_COUT__ << "Constructed." << __E__;
25 } // end constructor()
26 
27 //==============================================================================
28 DataProducerBase::~DataProducerBase(void)
29 {
30  __GEN_COUT__ << "Destructed." << __E__;
31 } // end destructor()
32 
33 //==============================================================================
36 {
37  __GEN_COUT__ << "Producer '" << DataProcessor::processorUID_
38  << "' is registering to DataManager Supervisor Buffer '"
39  << DataProcessor::supervisorApplicationUID_ << ":"
40  << DataProcessor::bufferUID_ << ".'" << std::endl;
41 
42  DataManager* dataManager =
43  (DataManagerSingleton::getInstance(supervisorApplicationUID_));
44 
45  dataManager->registerProducer(bufferUID_, this);
46 
47  {
48  __GEN_SS__;
49  dataManager->dumpStatus(&ss);
50  std::cout << ss.str() << __E__;
51  }
52 
53  __GEN_COUT__ << "Producer '" << DataProcessor::processorUID_ << "' Registered."
54  << __E__;
55 } // end registerToBuffer()
56 
60 //{
61 // __GEN_COUT__ << "Producer '" << DataProcessor::processorUID_ <<
62 // "' is unregistering to DataManager Supervisor Buffer '" <<
63 // DataProcessor::supervisorApplicationUID_ << ":" <<
64 // DataProcessor::bufferUID_ << ".'" << std::endl;
65 //
66 // DataManager* dataManager =
67 // (DataManagerSingleton::getInstance(
68 // supervisorApplicationUID_));
69 //
70 // dataManager->unregisterProducer(
71 // bufferUID_,DataProcessor::processorUID_);
72 //
73 // {
74 // __GEN_SS__;
75 // dataManager->dumpStatus(&ss);
76 // std::cout << ss.str() << __E__;
77 // }
78 //
79 // __GEN_COUT__ << "Producer '" << DataProcessor::processorUID_ <<
80 // "' Unregistered." << __E__;
81 //} //end unregisterFromBuffer()
void registerProducer(const std::string &bufferUID, DataProducerBase *producer)
owner of the producer object!
Definition: DataManager.cc:689
void dumpStatus(std::ostream *out=(std::ostream *)&(std::cout)) const
Definition: DataManager.cc:36
virtual void registerToBuffer(void)
mirror DataConsumer::registerToBuffer