1 #include "otsdaq/FECore/FEProducerVInterface.h"
2 #include "otsdaq/DataManager/DataManager.h"
3 #include "otsdaq/DataManager/DataManagerSingleton.h"
8 #define __MF_SUBJECT__ "FEProducer"
9 #define mfSubject_ (std::string("FEProducer-") + DataProcessor::processorUID_)
12 FEProducerVInterface::FEProducerVInterface(
const std::string& interfaceUID,
14 const std::string& interfaceConfigurationPath)
15 :
FEVInterface(interfaceUID, theXDAQContextConfigTree, interfaceConfigurationPath)
16 ,
DataProducerBase(theXDAQContextConfigTree.getBackNode(interfaceConfigurationPath, 4).getValueAsString(),
17 theXDAQContextConfigTree.getNode(interfaceConfigurationPath +
"/" +
"LinkToDataBufferTable", 4).getValueAsString(),
24 __GEN_COUT__ <<
"'" << interfaceUID <<
"' Constructed." << __E__;
26 __GEN_COUTV__(interfaceConfigurationPath);
27 ConfigurationTree appNode = theXDAQContextConfigTree.getBackNode(interfaceConfigurationPath, 2);
29 __GEN_COUTV__(appNode.getValueAsString());
33 FEProducerVInterface::~FEProducerVInterface(
void)
35 __FE_COUT__ <<
"Destructor." << __E__;
38 __GEN_COUT__ <<
"FEProducer '" << DataProcessor::processorUID_ <<
"' is unregistering from DataManager Supervisor Buffer '"
39 << DataProcessor::supervisorApplicationUID_ <<
":" << DataProcessor::bufferUID_ <<
".'" << std::endl;
41 DataManager* dataManager = (DataManagerSingleton::getInstance(supervisorApplicationUID_));
47 dataManager->dumpStatus(&ss);
48 std::cout << ss.str() << __E__;
51 __GEN_COUT__ <<
"FEProducer '" << DataProcessor::processorUID_ <<
"' unregistered." << __E__;
53 __FE_COUT__ <<
"Destructed." << __E__;
79 void FEProducerVInterface::copyToNextBuffer(
const std::string& dataToWrite)
81 __FE_COUT__ <<
"Write Data: " << BinaryStringMacros::binaryNumberToHexString(dataToWrite) << __E__;
83 DataProducerBase::write<std::string, std::map<std::string, std::string> >(dataToWrite);
124 std::string* FEProducerVInterface::getNextBuffer(
void)
126 if(DataProducerBase::attachToEmptySubBuffer(FEProducerVInterface::dataP_, FEProducerVInterface::headerP_) < 0)
128 __GEN_SS__ <<
"There are no available buffers! Retrying...after waiting 10 milliseconds!" << std::endl;
132 return FEProducerVInterface::dataP_;
139 void FEProducerVInterface::writeCurrentBuffer(
void)
141 __FE_COUT__ <<
"Writing data of size " << FEProducerVInterface::dataP_->size() << __E__;
143 DataProducerBase::setWrittenSubBuffer<std::string, std::map<std::string, std::string> >();
145 __FE_COUT__ <<
"Data written." << __E__;
void unregisterFEProducer(const std::string &bufferID, const std::string &feProducerID)