otsdaq  v1_01_04
 All Classes Namespaces Functions
SupervisorDescriptorInfoBase.cc
1 #include "otsdaq-core/SupervisorDescriptorInfo/SupervisorDescriptorInfoBase.h"
2 #include <xdaq/ContextDescriptor.h>
3 #include "otsdaq-core/MessageFacility/MessageFacility.h"
4 
5 #include <cassert>
6 
7 using namespace ots;
8 
9 
10 //========================================================================================================================
11 SupervisorDescriptorInfoBase::SupervisorDescriptorInfoBase(void)
12 {
13 }
14 
15 //========================================================================================================================
16 SupervisorDescriptorInfoBase::~SupervisorDescriptorInfoBase()
17 {}
18 
19 //========================================================================================================================
20 void SupervisorDescriptorInfoBase::init(xdaq::ApplicationContext* applicationContext)
21 {
22  if(applicationContext->getDefaultZone()->getApplicationGroup("daq") == 0)
23  {
24  std::cout << __COUT_HDR_FL__ << "Can't find application group called \"daq\" (Must have been removed from the xdaq context configuration)" << std::endl;
25  //assert(0);
26  }
27 
28  //There is only one and only Supervisor! (Or Config Wizard!!)
29  theSupervisor_ = *(applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("ots::Supervisor").begin());
30  if(theSupervisor_ == 0)
31  std::cout << __COUT_HDR_FL__ << "Can't find application descriptor called \"ots::Supervisor\" (Must have been removed from the xdaq context configuration)" << std::endl;
32 
33  theWizard_ = *(applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("ots::OtsConfigurationWizardSupervisor").begin());
34  if(theWizard_ == 0)
35  std::cout << __COUT_HDR_FL__ << "Can't find application descriptor called \"ots::OtsConfigurationWizardSupervisor\" (Must have been removed from the xdaq context configuration)" << std::endl;
36 
37  if(theWizard_ == 0 && theSupervisor_ == 0)
38  {
39  __SS__ << "Must have THE Supervisor (or THE OtsConfigurationWizardSupervisor) as part of the context configuration!" << std::endl;
40  __COUT_ERR__ << "\n" << ss.str();
41  throw std::runtime_error(ss.str());
42  }
43 
44 
45  theLogbookSupervisor_ = *(applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("ots::LogbookSupervisor").begin());
46  if(theLogbookSupervisor_ == 0)
47  {
48  std::cout << __COUT_HDR_FL__ << "Can't find application descriptor called \"ots::LogbookSupervisor\" (Must have been removed from the xdaq context configuration)" << std::endl;
49  }
50 
51 
52  theDataManagerSupervisors_.clear();
53  for(auto& it: applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("ots::DataManagerSupervisor"))
54  theDataManagerSupervisors_[it->getLocalId()] = it;
55  if(theDataManagerSupervisors_.size() == 0)
56  {
57  std::cout << __COUT_HDR_FL__ << "Can't find application descriptor called \"ots::DataManagerSupervisor\" (Must have been removed from the xdaq context configuration)" << std::endl;
58  //assert(0);
59  }
60 
61  theFESupervisors_.clear();
62  for(auto& it: applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("ots::FESupervisor"))
63  theFESupervisors_[it->getLocalId()] = it;
64 
65  if(theFESupervisors_.size() == 0)
66  {
67  std::cout << __COUT_HDR_FL__ << "Can't find application descriptor called \"ots::FESupervisor\" (Must have been removed from the xdaq context configuration)" << std::endl;
68  //assert(0);
69  }
70 
71  theDTCSupervisors_.clear();
72  for(auto& it: applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("Ph2TkDAQ::DTCSupervisor"))
73  theDTCSupervisors_[it->getLocalId()] = it;
74 
75  if(theDTCSupervisors_.size() == 0)
76  {
77  std::cout << __COUT_HDR_FL__ << "Can't find application descriptor called \"ots::DTCSupervisor\" (Must have been removed from the xdaq context configuration)" << std::endl;
78  //assert(0);
79  }
80 
81  theFEDataManagerSupervisors_.clear();
82  for(auto& it: applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("ots::FEDataManagerSupervisor"))
83  theFEDataManagerSupervisors_[it->getLocalId()] = it;
84  if(theFEDataManagerSupervisors_.size() == 0)
85  {
86  std::cout << __COUT_HDR_FL__ << "Can't find application descriptor called \"ots::FEDataManagerSupervisor\" (Must have been removed from the xdaq context configuration)" << std::endl;
87  //assert(0);
88  }
89 
90 // theARTDAQFESupervisors_.clear();
91 // for(auto& it: applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("ots::ARTDAQFESupervisor"))
92 // theARTDAQFESupervisors_[it->getLocalId()] = it;
93 // if(theARTDAQFESupervisors_.size() == 0)
94 // {
95 // std::cout << __COUT_HDR_FL__ << "Can't find application descriptor called \"ots::ARTDAQFESupervisor\" (Must have been removed from the xdaq context configuration)" << std::endl;
96 // //assert(0);
97 // }
98 
99  theARTDAQFEDataManagerSupervisors_.clear();
100  for(auto& it: applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("ots::ARTDAQFEDataManagerSupervisor"))
101  theARTDAQFEDataManagerSupervisors_[it->getLocalId()] = it;
102  if(theARTDAQFEDataManagerSupervisors_.size() == 0)
103  {
104  std::cout << __COUT_HDR_FL__ << "Can't find application descriptor called \"ots::ARTDAQFEDataManagerSupervisor\" (Must have been removed from the xdaq context configuration)" << std::endl;
105  //assert(0);
106  }
107  theARTDAQDataManagerSupervisors_.clear();
108  for(auto& it: applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("ots::ARTDAQDataManagerSupervisor"))
109  theARTDAQDataManagerSupervisors_[it->getLocalId()] = it;
110  if(theARTDAQDataManagerSupervisors_.size() == 0)
111  {
112  std::cout << __COUT_HDR_FL__ << "Can't find application descriptor called \"ots::ARTDAQDataManagerSupervisor\" (Must have been removed from the xdaq context configuration)" << std::endl;
113  //assert(0);
114  }
115 
116  theARTDAQBuilderSupervisors_.clear();
117  for(auto& it: applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("ots::EventBuilderApp"))
118  theARTDAQBuilderSupervisors_[it->getLocalId()] = it;
119  if(theARTDAQBuilderSupervisors_.size() == 0)
120  {
121  std::cout << __COUT_HDR_FL__ << "Can't find application descriptor called \"ots::EventBuilderApp\" (Must have been removed from the xdaq context configuration)" << std::endl;
122  //assert(0);
123  }
124 
125  theARTDAQAggregatorSupervisors_.clear();
126  for(auto& it: applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("ots::AggregatorApp"))
127  theARTDAQAggregatorSupervisors_[it->getLocalId()] = it;
128  if(theARTDAQAggregatorSupervisors_.size() == 0)
129  {
130  std::cout << __COUT_HDR_FL__ << "Can't find application descriptor called \"ots::AggregatorApp\" (Must have been removed from the xdaq context configuration)" << std::endl;
131  //assert(0);
132  }
133 
134  theVisualSupervisors_.clear();
135  for(auto& it: applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("ots::VisualSupervisor"))
136  theVisualSupervisors_[it->getLocalId()] = it;
137  if(theVisualSupervisors_.size() == 0)
138  {
139  std::cout << __COUT_HDR_FL__ << "Can't find application descriptor called \"ots::VisualSupervisor\" (Must have been removed from the xdaq context configuration)" << std::endl;
140  //assert(0);
141  }
142 }
143 
144 //========================================================================================================================
145 const SupervisorDescriptors& SupervisorDescriptorInfoBase::getDataManagerDescriptors(void) const
146 {
147  return theDataManagerSupervisors_;
148 }
149 
150 //========================================================================================================================
151 const SupervisorDescriptors& SupervisorDescriptorInfoBase::getFEDescriptors(void) const
152 {
153  return theFESupervisors_;
154 }
155 
156 //========================================================================================================================
157 const SupervisorDescriptors& SupervisorDescriptorInfoBase::getDTCDescriptors(void) const
158 {
159  return theDTCSupervisors_;
160 }
161 
162 //========================================================================================================================
163 const SupervisorDescriptors& SupervisorDescriptorInfoBase::getFEDataManagerDescriptors(void) const
164 {
165  return theFEDataManagerSupervisors_;
166 }
167 
168 //========================================================================================================================
169 //const SupervisorDescriptors& SupervisorDescriptorInfoBase::getARTDAQFEDescriptors(void) const
170 //{
171 // return theARTDAQFESupervisors_;
172 //}
173 //========================================================================================================================
174 const SupervisorDescriptors& SupervisorDescriptorInfoBase::getARTDAQFEDataManagerDescriptors(void) const
175 {
176  return theARTDAQFEDataManagerSupervisors_;
177 }
178 //========================================================================================================================
179 const SupervisorDescriptors& SupervisorDescriptorInfoBase::getARTDAQDataManagerDescriptors (void) const
180 {
181  return theARTDAQDataManagerSupervisors_;
182 }
183 
184 //========================================================================================================================
185 const SupervisorDescriptors& SupervisorDescriptorInfoBase::getARTDAQBuilderDescriptors(void) const
186 {
187  return theARTDAQBuilderSupervisors_;
188 }
189 
190 //========================================================================================================================
191 const SupervisorDescriptors& SupervisorDescriptorInfoBase::getARTDAQAggregatorDescriptors(void) const
192 {
193  return theARTDAQAggregatorSupervisors_;
194 }
195 
196 //========================================================================================================================
197 const SupervisorDescriptors& SupervisorDescriptorInfoBase::getVisualDescriptors(void) const
198 {
199  return theVisualSupervisors_;
200 }
201 
202 //========================================================================================================================
203 XDAQ_CONST_CALL xdaq::ApplicationDescriptor* SupervisorDescriptorInfoBase::getSupervisorDescriptor(void) const
204 {
205  return theSupervisor_;
206 }
207 
208 //========================================================================================================================
209 XDAQ_CONST_CALL xdaq::ApplicationDescriptor* SupervisorDescriptorInfoBase::getWizardDescriptor(void) const
210 {
211  return theWizard_;
212 }
213 
214 //========================================================================================================================
215 XDAQ_CONST_CALL xdaq::ApplicationDescriptor* SupervisorDescriptorInfoBase::getLogbookDescriptor(void) const
216 {
217  return theLogbookSupervisor_;
218 }
219 
220 //========================================================================================================================
221 XDAQ_CONST_CALL xdaq::ApplicationDescriptor* SupervisorDescriptorInfoBase::getVisualDescriptor(xdata::UnsignedIntegerT instance) const
222 {
223  if(theVisualSupervisors_.find(instance) == theVisualSupervisors_.end())
224  std::cout << __COUT_HDR_FL__ << "Couldn't find: " << instance << std::endl;
225  return theVisualSupervisors_.find(instance)->second;
226 }
227 
228 //========================================================================================================================
229 XDAQ_CONST_CALL xdaq::ApplicationDescriptor* SupervisorDescriptorInfoBase::getDataManagerDescriptor(xdata::UnsignedIntegerT instance) const
230 {
231  if(theDataManagerSupervisors_.find(instance) == theDataManagerSupervisors_.end())
232  std::cout << __COUT_HDR_FL__ << "Couldn't find: " << instance << std::endl;
233  return theDataManagerSupervisors_.find(instance)->second;
234 }
235 
236 //========================================================================================================================
237 XDAQ_CONST_CALL xdaq::ApplicationDescriptor* SupervisorDescriptorInfoBase::getFEDescriptor(xdata::UnsignedIntegerT instance) const
238 {
239  if(theFESupervisors_.find(instance) == theFESupervisors_.end())
240  std::cout << __COUT_HDR_FL__ << "Couldn't find: " << instance << std::endl;
241  return theFESupervisors_.find(instance)->second;
242 }
243 
244 //========================================================================================================================
245 XDAQ_CONST_CALL xdaq::ApplicationDescriptor* SupervisorDescriptorInfoBase::getDTCDescriptor(xdata::UnsignedIntegerT instance) const
246 {
247  if(theDTCSupervisors_.find(instance) == theDTCSupervisors_.end())
248  std::cout << __COUT_HDR_FL__ << "Couldn't find: " << instance << std::endl;
249  return theDTCSupervisors_.find(instance)->second;
250 }
251 
252 //========================================================================================================================
253 XDAQ_CONST_CALL xdaq::ApplicationDescriptor* SupervisorDescriptorInfoBase::getFEDataManagerDescriptor(xdata::UnsignedIntegerT instance) const
254 {
255  if(theFEDataManagerSupervisors_.find(instance) == theFEDataManagerSupervisors_.end())
256  std::cout << __COUT_HDR_FL__ << "Couldn't find: " << instance << std::endl;
257  return theFEDataManagerSupervisors_.find(instance)->second;
258 }
259 
260 //========================================================================================================================
261 //XDAQ_CONST_CALL xdaq::ApplicationDescriptor* SupervisorDescriptorInfoBase::getARTDAQFEDescriptor(xdata::UnsignedIntegerT instance) const
262 //{
263 // if(theARTDAQFESupervisors_.find(instance) == theARTDAQFESupervisors_.end())
264 // std::cout << __COUT_HDR_FL__ << "Couldn't find: " << instance << std::endl;
265 // return theARTDAQFESupervisors_.find(instance)->second;
266 //}
267 
268 //========================================================================================================================
269 XDAQ_CONST_CALL xdaq::ApplicationDescriptor* SupervisorDescriptorInfoBase::getARTDAQFEDataManagerDescriptor(xdata::UnsignedIntegerT instance) const
270 {
271  if(theARTDAQFEDataManagerSupervisors_.find(instance) == theARTDAQFEDataManagerSupervisors_.end())
272  std::cout << __COUT_HDR_FL__ << "Couldn't find: " << instance << std::endl;
273  return theARTDAQFEDataManagerSupervisors_.find(instance)->second;
274 }
275 
276 //========================================================================================================================
277 XDAQ_CONST_CALL xdaq::ApplicationDescriptor* SupervisorDescriptorInfoBase::getARTDAQDataManagerDescriptor (xdata::UnsignedIntegerT instance) const
278 {
279  if(theARTDAQDataManagerSupervisors_.find(instance) == theARTDAQDataManagerSupervisors_.end())
280  std::cout << __COUT_HDR_FL__ << "Couldn't find: " << instance << std::endl;
281  return theARTDAQDataManagerSupervisors_.find(instance)->second;
282 }
283 
284 //========================================================================================================================
285 XDAQ_CONST_CALL xdaq::ApplicationDescriptor* SupervisorDescriptorInfoBase::getARTDAQBuilderDescriptor(xdata::UnsignedIntegerT instance) const
286 {
287  if(theARTDAQBuilderSupervisors_.find(instance) == theARTDAQBuilderSupervisors_.end())
288  std::cout << __COUT_HDR_FL__ << "Couldn't find: " << instance << std::endl;
289  return theARTDAQBuilderSupervisors_.find(instance)->second;
290 }
291 
292 //========================================================================================================================
293 XDAQ_CONST_CALL xdaq::ApplicationDescriptor* SupervisorDescriptorInfoBase::getARTDAQAggregatorDescriptor(xdata::UnsignedIntegerT instance) const
294 {
295  if(theARTDAQAggregatorSupervisors_.find(instance) == theARTDAQAggregatorSupervisors_.end())
296  std::cout << __COUT_HDR_FL__ << "Couldn't find: " << instance << std::endl;
297  return theARTDAQAggregatorSupervisors_.find(instance)->second;
298 }
299 
300 //========================================================================================================================
301 std::string SupervisorDescriptorInfoBase::getFEURL(xdata::UnsignedIntegerT instance) const
302 {
303  return getFEDescriptor(instance)->getContextDescriptor()->getURL();
304 }
305 
306 /*
307 //========================================================================================================================
308 std::string SupervisorDescriptorInfoBase::getARTDAQFEURL(xdata::UnsignedIntegerT instance) const
309 {
310  return getARTDAQFEDescriptor(instance)->getContextDescriptor()->getURL();
311 }
312 
313 //========================================================================================================================
314 std::string SupervisorDescriptorInfoBase::getARTDAQBuilderURL(xdata::UnsignedIntegerT instance) const
315 {
316  return getARTDAQBuilderDescriptor(instance)->getContextDescriptor()->getURL();
317 }
318 
319 //========================================================================================================================
320 std::string SupervisorDescriptorInfoBase::getARTDAQAggregatorURL(xdata::UnsignedIntegerT instance) const
321 {
322  return getARTDAQAggregatorDescriptor(instance)->getContextDescriptor()->getURL();
323 }
324 */