1 #include "otsdaq/CoreSupervisors/FEDataManagerSupervisor.h"
3 #include "../ARTDAQDataManager/ARTDAQDataManager.h"
4 #include "otsdaq/ConfigurationInterface/ConfigurationManager.h"
5 #include "otsdaq/DataManager/DataManager.h"
6 #include "otsdaq/DataManager/DataManagerSingleton.h"
17 __SUP_COUT__ <<
"Constructor." << __E__;
26 __SUP_COUTV__(CoreSupervisorBase::theStateMachineImplementation_.size());
38 __SUP_COUT__ <<
"Adding ARTDAQ Data Manager now...!" << __E__;
39 CoreSupervisorBase::theStateMachineImplementation_.push_back(
40 DataManagerSingleton::getInstance<ARTDAQDataManager>(CorePropertySupervisorBase::getContextTreeNode(),
41 CorePropertySupervisorBase::getSupervisorConfigurationPath(),
42 CorePropertySupervisorBase::getSupervisorUID()));
46 __SUP_COUT__ <<
"Adding Data Manager now...!" << __E__;
47 CoreSupervisorBase::theStateMachineImplementation_.push_back(
48 DataManagerSingleton::getInstance<DataManager>(CorePropertySupervisorBase::getContextTreeNode(),
49 CorePropertySupervisorBase::getSupervisorConfigurationPath(),
50 CorePropertySupervisorBase::getSupervisorUID()));
55 __SUP_COUT__ <<
"Constructed." << __E__;
59 FEDataManagerSupervisor::~FEDataManagerSupervisor(
void)
61 __SUP_COUT__ <<
"Destroying..." << __E__;
67 DataManagerSingleton::deleteInstance(CoreSupervisorBase::getSupervisorUID());
68 theStateMachineImplementation_.pop_back();
70 __SUP_COUT__ <<
"Destructed." << __E__;
77 void FEDataManagerSupervisor::transitionConfiguring(toolbox::Event::Reference e)
79 __SUP_COUT__ <<
"transitionConfiguring" << __E__;
81 theDataManager_->parentSupervisorHasFrontends_ =
true;
86 if(theStateMachineImplementation_.size() != 2)
88 __SUP_SS__ <<
"State machine size is not 2! It is " << theStateMachineImplementation_.size() <<
". What happened??" << __E__;
93 theStateMachineImplementation_[0] = theStateMachineImplementation_[1];
94 theStateMachineImplementation_[1] = p;
96 CoreSupervisorBase::transitionConfiguring(e);
101 std::cout << ss.str() << __E__;
110 theStateMachineImplementation_[1] = theStateMachineImplementation_[0];
111 theStateMachineImplementation_[0] = p;
120 void FEDataManagerSupervisor::transitionStarting(toolbox::Event::Reference e)
122 __SUP_COUT__ <<
"transitionStarting" << __E__;
127 if(theStateMachineImplementation_.size() != 2)
129 __SUP_SS__ <<
"State machine size is not 2! It is " << theStateMachineImplementation_.size() <<
". What happened??" << __E__;
133 theStateMachineImplementation_[0] = theStateMachineImplementation_[1];
134 theStateMachineImplementation_[1] = p;
136 CoreSupervisorBase::transitionStarting(e);
139 theStateMachineImplementation_[1] = theStateMachineImplementation_[0];
140 theStateMachineImplementation_[0] = p;
149 void FEDataManagerSupervisor::transitionResuming(toolbox::Event::Reference e)
151 __SUP_COUT__ <<
"transitionStarting" << __E__;
156 if(theStateMachineImplementation_.size() != 2)
158 __SUP_SS__ <<
"State machine size is not 2! It is " << theStateMachineImplementation_.size() <<
". What happened??" << __E__;
162 theStateMachineImplementation_[0] = theStateMachineImplementation_[1];
163 theStateMachineImplementation_[1] = p;
165 CoreSupervisorBase::transitionResuming(e);
168 theStateMachineImplementation_[1] = theStateMachineImplementation_[0];
169 theStateMachineImplementation_[0] = p;
181 DataManager* FEDataManagerSupervisor::extractDataManager()
185 for(
unsigned int i = 0; i < theStateMachineImplementation_.size(); ++i)
189 theDataManager_ =
dynamic_cast<DataManager*
>(theStateMachineImplementation_[i]);
193 throw(std::runtime_error(
""));
195 __SUP_COUT__ <<
"State Machine " << i <<
" WAS of type DataManager" << __E__;
201 __SUP_COUT__ <<
"State Machine " << i <<
" was NOT of type DataManager" << __E__;
205 __SUP_COUT__ <<
"theDataManager pointer = " << theDataManager_ << __E__;
207 return theDataManager_;