otsdaq  v1_01_02
 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  throw std::runtime_error("Must have THE Supervisor (or THE OtsConfigurationWizardSupervisor) as part of the context configuration!");
39 
40 
41  theLogbookSupervisor_ = *(applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("ots::LogbookSupervisor").begin());
42  if(theLogbookSupervisor_ == 0)
43  {
44  std::cout << __COUT_HDR_FL__ << "Can't find application descriptor called \"ots::LogbookSupervisor\" (Must have been removed from the xdaq context configuration)" << std::endl;
45  }
46 
47 
48  theDataManagerSupervisors_.clear();
49  for(auto& it: applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("ots::DataManagerSupervisor"))
50  theDataManagerSupervisors_[it->getLocalId()] = it;
51  if(theDataManagerSupervisors_.size() == 0)
52  {
53  std::cout << __COUT_HDR_FL__ << "Can't find application descriptor called \"ots::DataManagerSupervisor\" (Must have been removed from the xdaq context configuration)" << std::endl;
54  //assert(0);
55  }
56 
57  theFESupervisors_.clear();
58  for(auto& it: applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("ots::FESupervisor"))
59  theFESupervisors_[it->getLocalId()] = it;
60 
61  if(theFESupervisors_.size() == 0)
62  {
63  std::cout << __COUT_HDR_FL__ << "Can't find application descriptor called \"ots::FESupervisor\" (Must have been removed from the xdaq context configuration)" << std::endl;
64  //assert(0);
65  }
66 
67  theFEDataManagerSupervisors_.clear();
68  for(auto& it: applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("ots::FEDataManagerSupervisor"))
69  theFEDataManagerSupervisors_[it->getLocalId()] = it;
70  if(theFEDataManagerSupervisors_.size() == 0)
71  {
72  std::cout << __COUT_HDR_FL__ << "Can't find application descriptor called \"ots::FEDataManagerSupervisor\" (Must have been removed from the xdaq context configuration)" << std::endl;
73  //assert(0);
74  }
75 
76 // theARTDAQFESupervisors_.clear();
77 // for(auto& it: applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("ots::ARTDAQFESupervisor"))
78 // theARTDAQFESupervisors_[it->getLocalId()] = it;
79 // if(theARTDAQFESupervisors_.size() == 0)
80 // {
81 // std::cout << __COUT_HDR_FL__ << "Can't find application descriptor called \"ots::ARTDAQFESupervisor\" (Must have been removed from the xdaq context configuration)" << std::endl;
82 // //assert(0);
83 // }
84 
85  theARTDAQFEDataManagerSupervisors_.clear();
86  for(auto& it: applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("ots::ARTDAQFEDataManagerSupervisor"))
87  theARTDAQFEDataManagerSupervisors_[it->getLocalId()] = it;
88  if(theARTDAQFEDataManagerSupervisors_.size() == 0)
89  {
90  std::cout << __COUT_HDR_FL__ << "Can't find application descriptor called \"ots::ARTDAQFEDataManagerSupervisor\" (Must have been removed from the xdaq context configuration)" << std::endl;
91  //assert(0);
92  }
93  theARTDAQDataManagerSupervisors_.clear();
94  for(auto& it: applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("ots::ARTDAQDataManagerSupervisor"))
95  theARTDAQDataManagerSupervisors_[it->getLocalId()] = it;
96  if(theARTDAQDataManagerSupervisors_.size() == 0)
97  {
98  std::cout << __COUT_HDR_FL__ << "Can't find application descriptor called \"ots::ARTDAQDataManagerSupervisor\" (Must have been removed from the xdaq context configuration)" << std::endl;
99  //assert(0);
100  }
101 
102  theARTDAQBuilderSupervisors_.clear();
103  for(auto& it: applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("ots::EventBuilderApp"))
104  theARTDAQBuilderSupervisors_[it->getLocalId()] = it;
105  if(theARTDAQBuilderSupervisors_.size() == 0)
106  {
107  std::cout << __COUT_HDR_FL__ << "Can't find application descriptor called \"ots::EventBuilderApp\" (Must have been removed from the xdaq context configuration)" << std::endl;
108  //assert(0);
109  }
110 
111  theARTDAQAggregatorSupervisors_.clear();
112  for(auto& it: applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("ots::AggregatorApp"))
113  theARTDAQAggregatorSupervisors_[it->getLocalId()] = it;
114  if(theARTDAQAggregatorSupervisors_.size() == 0)
115  {
116  std::cout << __COUT_HDR_FL__ << "Can't find application descriptor called \"ots::AggregatorApp\" (Must have been removed from the xdaq context configuration)" << std::endl;
117  //assert(0);
118  }
119 
120  theVisualSupervisors_.clear();
121  for(auto& it: applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("ots::VisualSupervisor"))
122  theVisualSupervisors_[it->getLocalId()] = it;
123  if(theVisualSupervisors_.size() == 0)
124  {
125  std::cout << __COUT_HDR_FL__ << "Can't find application descriptor called \"ots::VisualSupervisor\" (Must have been removed from the xdaq context configuration)" << std::endl;
126  //assert(0);
127  }
128 }
129 
130 //========================================================================================================================
131 const SupervisorDescriptors& SupervisorDescriptorInfoBase::getDataManagerDescriptors(void) const
132 {
133  return theDataManagerSupervisors_;
134 }
135 
136 //========================================================================================================================
137 const SupervisorDescriptors& SupervisorDescriptorInfoBase::getFEDescriptors(void) const
138 {
139  return theFESupervisors_;
140 }
141 
142 //========================================================================================================================
143 const SupervisorDescriptors& SupervisorDescriptorInfoBase::getFEDataManagerDescriptors(void) const
144 {
145  return theFEDataManagerSupervisors_;
146 }
147 
148 //========================================================================================================================
149 //const SupervisorDescriptors& SupervisorDescriptorInfoBase::getARTDAQFEDescriptors(void) const
150 //{
151 // return theARTDAQFESupervisors_;
152 //}
153 //========================================================================================================================
154 const SupervisorDescriptors& SupervisorDescriptorInfoBase::getARTDAQFEDataManagerDescriptors(void) const
155 {
156  return theARTDAQFEDataManagerSupervisors_;
157 }
158 //========================================================================================================================
159 const SupervisorDescriptors& SupervisorDescriptorInfoBase::getARTDAQDataManagerDescriptors (void) const
160 {
161  return theARTDAQDataManagerSupervisors_;
162 }
163 
164 //========================================================================================================================
165 const SupervisorDescriptors& SupervisorDescriptorInfoBase::getARTDAQBuilderDescriptors(void) const
166 {
167  return theARTDAQBuilderSupervisors_;
168 }
169 
170 //========================================================================================================================
171 const SupervisorDescriptors& SupervisorDescriptorInfoBase::getARTDAQAggregatorDescriptors(void) const
172 {
173  return theARTDAQAggregatorSupervisors_;
174 }
175 
176 //========================================================================================================================
177 const SupervisorDescriptors& SupervisorDescriptorInfoBase::getVisualDescriptors(void) const
178 {
179  return theVisualSupervisors_;
180 }
181 
182 //========================================================================================================================
183 XDAQ_CONST_CALL xdaq::ApplicationDescriptor* SupervisorDescriptorInfoBase::getSupervisorDescriptor(void) const
184 {
185  return theSupervisor_;
186 }
187 
188 //========================================================================================================================
189 XDAQ_CONST_CALL xdaq::ApplicationDescriptor* SupervisorDescriptorInfoBase::getWizardDescriptor(void) const
190 {
191  return theWizard_;
192 }
193 
194 //========================================================================================================================
195 XDAQ_CONST_CALL xdaq::ApplicationDescriptor* SupervisorDescriptorInfoBase::getLogbookDescriptor(void) const
196 {
197  return theLogbookSupervisor_;
198 }
199 
200 //========================================================================================================================
201 XDAQ_CONST_CALL xdaq::ApplicationDescriptor* SupervisorDescriptorInfoBase::getVisualDescriptor(xdata::UnsignedIntegerT instance) const
202 {
203  if(theVisualSupervisors_.find(instance) == theVisualSupervisors_.end())
204  std::cout << __COUT_HDR_FL__ << "Couldn't find: " << instance << std::endl;
205  return theVisualSupervisors_.find(instance)->second;
206 }
207 
208 //========================================================================================================================
209 XDAQ_CONST_CALL xdaq::ApplicationDescriptor* SupervisorDescriptorInfoBase::getDataManagerDescriptor(xdata::UnsignedIntegerT instance) const
210 {
211  if(theDataManagerSupervisors_.find(instance) == theDataManagerSupervisors_.end())
212  std::cout << __COUT_HDR_FL__ << "Couldn't find: " << instance << std::endl;
213  return theDataManagerSupervisors_.find(instance)->second;
214 }
215 
216 //========================================================================================================================
217 XDAQ_CONST_CALL xdaq::ApplicationDescriptor* SupervisorDescriptorInfoBase::getFEDescriptor(xdata::UnsignedIntegerT instance) const
218 {
219  if(theFESupervisors_.find(instance) == theFESupervisors_.end())
220  std::cout << __COUT_HDR_FL__ << "Couldn't find: " << instance << std::endl;
221  return theFESupervisors_.find(instance)->second;
222 }
223 
224 //========================================================================================================================
225 XDAQ_CONST_CALL xdaq::ApplicationDescriptor* SupervisorDescriptorInfoBase::getFEDataManagerDescriptor(xdata::UnsignedIntegerT instance) const
226 {
227  if(theFEDataManagerSupervisors_.find(instance) == theFEDataManagerSupervisors_.end())
228  std::cout << __COUT_HDR_FL__ << "Couldn't find: " << instance << std::endl;
229  return theFEDataManagerSupervisors_.find(instance)->second;
230 }
231 
232 //========================================================================================================================
233 //XDAQ_CONST_CALL xdaq::ApplicationDescriptor* SupervisorDescriptorInfoBase::getARTDAQFEDescriptor(xdata::UnsignedIntegerT instance) const
234 //{
235 // if(theARTDAQFESupervisors_.find(instance) == theARTDAQFESupervisors_.end())
236 // std::cout << __COUT_HDR_FL__ << "Couldn't find: " << instance << std::endl;
237 // return theARTDAQFESupervisors_.find(instance)->second;
238 //}
239 
240 //========================================================================================================================
241 XDAQ_CONST_CALL xdaq::ApplicationDescriptor* SupervisorDescriptorInfoBase::getARTDAQFEDataManagerDescriptor(xdata::UnsignedIntegerT instance) const
242 {
243  if(theARTDAQFEDataManagerSupervisors_.find(instance) == theARTDAQFEDataManagerSupervisors_.end())
244  std::cout << __COUT_HDR_FL__ << "Couldn't find: " << instance << std::endl;
245  return theARTDAQFEDataManagerSupervisors_.find(instance)->second;
246 }
247 
248 //========================================================================================================================
249 XDAQ_CONST_CALL xdaq::ApplicationDescriptor* SupervisorDescriptorInfoBase::getARTDAQDataManagerDescriptor (xdata::UnsignedIntegerT instance) const
250 {
251  if(theARTDAQDataManagerSupervisors_.find(instance) == theARTDAQDataManagerSupervisors_.end())
252  std::cout << __COUT_HDR_FL__ << "Couldn't find: " << instance << std::endl;
253  return theARTDAQDataManagerSupervisors_.find(instance)->second;
254 }
255 
256 //========================================================================================================================
257 XDAQ_CONST_CALL xdaq::ApplicationDescriptor* SupervisorDescriptorInfoBase::getARTDAQBuilderDescriptor(xdata::UnsignedIntegerT instance) const
258 {
259  if(theARTDAQBuilderSupervisors_.find(instance) == theARTDAQBuilderSupervisors_.end())
260  std::cout << __COUT_HDR_FL__ << "Couldn't find: " << instance << std::endl;
261  return theARTDAQBuilderSupervisors_.find(instance)->second;
262 }
263 
264 //========================================================================================================================
265 XDAQ_CONST_CALL xdaq::ApplicationDescriptor* SupervisorDescriptorInfoBase::getARTDAQAggregatorDescriptor(xdata::UnsignedIntegerT instance) const
266 {
267  if(theARTDAQAggregatorSupervisors_.find(instance) == theARTDAQAggregatorSupervisors_.end())
268  std::cout << __COUT_HDR_FL__ << "Couldn't find: " << instance << std::endl;
269  return theARTDAQAggregatorSupervisors_.find(instance)->second;
270 }
271 
272 //========================================================================================================================
273 std::string SupervisorDescriptorInfoBase::getFEURL(xdata::UnsignedIntegerT instance) const
274 {
275  return getFEDescriptor(instance)->getContextDescriptor()->getURL();
276 }
277 
278 /*
279 //========================================================================================================================
280 std::string SupervisorDescriptorInfoBase::getARTDAQFEURL(xdata::UnsignedIntegerT instance) const
281 {
282  return getARTDAQFEDescriptor(instance)->getContextDescriptor()->getURL();
283 }
284 
285 //========================================================================================================================
286 std::string SupervisorDescriptorInfoBase::getARTDAQBuilderURL(xdata::UnsignedIntegerT instance) const
287 {
288  return getARTDAQBuilderDescriptor(instance)->getContextDescriptor()->getURL();
289 }
290 
291 //========================================================================================================================
292 std::string SupervisorDescriptorInfoBase::getARTDAQAggregatorURL(xdata::UnsignedIntegerT instance) const
293 {
294  return getARTDAQAggregatorDescriptor(instance)->getContextDescriptor()->getURL();
295 }
296 */