00001 #include "otsdaq-core/SupervisorDescriptorInfo/SupervisorDescriptorInfoBase.h"
00002 #include <xdaq/ContextDescriptor.h>
00003 #include "otsdaq-core/MessageFacility/MessageFacility.h"
00004
00005 #include <cassert>
00006
00007 using namespace ots;
00008
00009
00010
00011 SupervisorDescriptorInfoBase::SupervisorDescriptorInfoBase(void)
00012 {
00013 }
00014
00015
00016 SupervisorDescriptorInfoBase::~SupervisorDescriptorInfoBase()
00017 {}
00018
00019
00020 void SupervisorDescriptorInfoBase::init(xdaq::ApplicationContext* applicationContext)
00021 {
00022 if(applicationContext->getDefaultZone()->getApplicationGroup("daq") == 0)
00023 {
00024 std::cout << __COUT_HDR_FL__ << "Can't find application group called \"daq\" (Must have been removed from the xdaq context configuration)" << std::endl;
00025
00026 }
00027
00028
00029 theSupervisor_ = *(applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("ots::Supervisor").begin());
00030 if(theSupervisor_ == 0)
00031 std::cout << __COUT_HDR_FL__ << "Can't find application descriptor called \"ots::Supervisor\" (Must have been removed from the xdaq context configuration)" << std::endl;
00032
00033 theWizard_ = *(applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("ots::OtsConfigurationWizardSupervisor").begin());
00034 if(theWizard_ == 0)
00035 std::cout << __COUT_HDR_FL__ << "Can't find application descriptor called \"ots::OtsConfigurationWizardSupervisor\" (Must have been removed from the xdaq context configuration)" << std::endl;
00036
00037 if(theWizard_ == 0 && theSupervisor_ == 0)
00038 {
00039 __SS__ << "Must have THE Supervisor (or THE OtsConfigurationWizardSupervisor) as part of the context configuration!" << std::endl;
00040 __COUT_ERR__ << "\n" << ss.str();
00041 throw std::runtime_error(ss.str());
00042 }
00043
00044
00045 theLogbookSupervisor_ = *(applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("ots::LogbookSupervisor").begin());
00046 if(theLogbookSupervisor_ == 0)
00047 {
00048 std::cout << __COUT_HDR_FL__ << "Can't find application descriptor called \"ots::LogbookSupervisor\" (Must have been removed from the xdaq context configuration)" << std::endl;
00049 }
00050
00051
00052 theDataManagerSupervisors_.clear();
00053 for(auto& it: applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("ots::DataManagerSupervisor"))
00054 theDataManagerSupervisors_[it->getLocalId()] = it;
00055 if(theDataManagerSupervisors_.size() == 0)
00056 {
00057 std::cout << __COUT_HDR_FL__ << "Can't find application descriptor called \"ots::DataManagerSupervisor\" (Must have been removed from the xdaq context configuration)" << std::endl;
00058
00059 }
00060
00061 theFESupervisors_.clear();
00062 for(auto& it: applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("ots::FESupervisor"))
00063 theFESupervisors_[it->getLocalId()] = it;
00064
00065 if(theFESupervisors_.size() == 0)
00066 {
00067 std::cout << __COUT_HDR_FL__ << "Can't find application descriptor called \"ots::FESupervisor\" (Must have been removed from the xdaq context configuration)" << std::endl;
00068
00069 }
00070
00071 theDTCSupervisors_.clear();
00072 for(auto& it: applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("Ph2TkDAQ::DTCSupervisor"))
00073 theDTCSupervisors_[it->getLocalId()] = it;
00074
00075 if(theDTCSupervisors_.size() == 0)
00076 {
00077 std::cout << __COUT_HDR_FL__ << "Can't find application descriptor called \"ots::DTCSupervisor\" (Must have been removed from the xdaq context configuration)" << std::endl;
00078
00079 }
00080
00081 theFEDataManagerSupervisors_.clear();
00082 for(auto& it: applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("ots::FEDataManagerSupervisor"))
00083 theFEDataManagerSupervisors_[it->getLocalId()] = it;
00084 if(theFEDataManagerSupervisors_.size() == 0)
00085 {
00086 std::cout << __COUT_HDR_FL__ << "Can't find application descriptor called \"ots::FEDataManagerSupervisor\" (Must have been removed from the xdaq context configuration)" << std::endl;
00087
00088 }
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099 theARTDAQFEDataManagerSupervisors_.clear();
00100 for(auto& it: applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("ots::ARTDAQFEDataManagerSupervisor"))
00101 theARTDAQFEDataManagerSupervisors_[it->getLocalId()] = it;
00102 if(theARTDAQFEDataManagerSupervisors_.size() == 0)
00103 {
00104 std::cout << __COUT_HDR_FL__ << "Can't find application descriptor called \"ots::ARTDAQFEDataManagerSupervisor\" (Must have been removed from the xdaq context configuration)" << std::endl;
00105
00106 }
00107 theARTDAQDataManagerSupervisors_.clear();
00108 for(auto& it: applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("ots::ARTDAQDataManagerSupervisor"))
00109 theARTDAQDataManagerSupervisors_[it->getLocalId()] = it;
00110 if(theARTDAQDataManagerSupervisors_.size() == 0)
00111 {
00112 std::cout << __COUT_HDR_FL__ << "Can't find application descriptor called \"ots::ARTDAQDataManagerSupervisor\" (Must have been removed from the xdaq context configuration)" << std::endl;
00113
00114 }
00115
00116 theARTDAQBuilderSupervisors_.clear();
00117 for(auto& it: applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("ots::EventBuilderApp"))
00118 theARTDAQBuilderSupervisors_[it->getLocalId()] = it;
00119 if(theARTDAQBuilderSupervisors_.size() == 0)
00120 {
00121 std::cout << __COUT_HDR_FL__ << "Can't find application descriptor called \"ots::EventBuilderApp\" (Must have been removed from the xdaq context configuration)" << std::endl;
00122
00123 }
00124
00125 theARTDAQAggregatorSupervisors_.clear();
00126 for(auto& it: applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("ots::AggregatorApp"))
00127 theARTDAQAggregatorSupervisors_[it->getLocalId()] = it;
00128 if(theARTDAQAggregatorSupervisors_.size() == 0)
00129 {
00130 std::cout << __COUT_HDR_FL__ << "Can't find application descriptor called \"ots::AggregatorApp\" (Must have been removed from the xdaq context configuration)" << std::endl;
00131
00132 }
00133
00134 theVisualSupervisors_.clear();
00135 for(auto& it: applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("ots::VisualSupervisor"))
00136 theVisualSupervisors_[it->getLocalId()] = it;
00137 if(theVisualSupervisors_.size() == 0)
00138 {
00139 std::cout << __COUT_HDR_FL__ << "Can't find application descriptor called \"ots::VisualSupervisor\" (Must have been removed from the xdaq context configuration)" << std::endl;
00140
00141 }
00142 }
00143
00144
00145 const SupervisorDescriptors& SupervisorDescriptorInfoBase::getDataManagerDescriptors(void) const
00146 {
00147 return theDataManagerSupervisors_;
00148 }
00149
00150
00151 const SupervisorDescriptors& SupervisorDescriptorInfoBase::getFEDescriptors(void) const
00152 {
00153 return theFESupervisors_;
00154 }
00155
00156
00157 const SupervisorDescriptors& SupervisorDescriptorInfoBase::getDTCDescriptors(void) const
00158 {
00159 return theDTCSupervisors_;
00160 }
00161
00162
00163 const SupervisorDescriptors& SupervisorDescriptorInfoBase::getFEDataManagerDescriptors(void) const
00164 {
00165 return theFEDataManagerSupervisors_;
00166 }
00167
00168
00169
00170
00171
00172
00173
00174 const SupervisorDescriptors& SupervisorDescriptorInfoBase::getARTDAQFEDataManagerDescriptors(void) const
00175 {
00176 return theARTDAQFEDataManagerSupervisors_;
00177 }
00178
00179 const SupervisorDescriptors& SupervisorDescriptorInfoBase::getARTDAQDataManagerDescriptors (void) const
00180 {
00181 return theARTDAQDataManagerSupervisors_;
00182 }
00183
00184
00185 const SupervisorDescriptors& SupervisorDescriptorInfoBase::getARTDAQBuilderDescriptors(void) const
00186 {
00187 return theARTDAQBuilderSupervisors_;
00188 }
00189
00190
00191 const SupervisorDescriptors& SupervisorDescriptorInfoBase::getARTDAQAggregatorDescriptors(void) const
00192 {
00193 return theARTDAQAggregatorSupervisors_;
00194 }
00195
00196
00197 const SupervisorDescriptors& SupervisorDescriptorInfoBase::getVisualDescriptors(void) const
00198 {
00199 return theVisualSupervisors_;
00200 }
00201
00202
00203 XDAQ_CONST_CALL xdaq::ApplicationDescriptor* SupervisorDescriptorInfoBase::getSupervisorDescriptor(void) const
00204 {
00205 return theSupervisor_;
00206 }
00207
00208
00209 XDAQ_CONST_CALL xdaq::ApplicationDescriptor* SupervisorDescriptorInfoBase::getWizardDescriptor(void) const
00210 {
00211 return theWizard_;
00212 }
00213
00214
00215 XDAQ_CONST_CALL xdaq::ApplicationDescriptor* SupervisorDescriptorInfoBase::getLogbookDescriptor(void) const
00216 {
00217 return theLogbookSupervisor_;
00218 }
00219
00220
00221 XDAQ_CONST_CALL xdaq::ApplicationDescriptor* SupervisorDescriptorInfoBase::getVisualDescriptor(xdata::UnsignedIntegerT instance) const
00222 {
00223 if(theVisualSupervisors_.find(instance) == theVisualSupervisors_.end())
00224 std::cout << __COUT_HDR_FL__ << "Couldn't find: " << instance << std::endl;
00225 return theVisualSupervisors_.find(instance)->second;
00226 }
00227
00228
00229 XDAQ_CONST_CALL xdaq::ApplicationDescriptor* SupervisorDescriptorInfoBase::getDataManagerDescriptor(xdata::UnsignedIntegerT instance) const
00230 {
00231 if(theDataManagerSupervisors_.find(instance) == theDataManagerSupervisors_.end())
00232 std::cout << __COUT_HDR_FL__ << "Couldn't find: " << instance << std::endl;
00233 return theDataManagerSupervisors_.find(instance)->second;
00234 }
00235
00236
00237 XDAQ_CONST_CALL xdaq::ApplicationDescriptor* SupervisorDescriptorInfoBase::getFEDescriptor(xdata::UnsignedIntegerT instance) const
00238 {
00239 if(theFESupervisors_.find(instance) == theFESupervisors_.end())
00240 std::cout << __COUT_HDR_FL__ << "Couldn't find: " << instance << std::endl;
00241 return theFESupervisors_.find(instance)->second;
00242 }
00243
00244
00245 XDAQ_CONST_CALL xdaq::ApplicationDescriptor* SupervisorDescriptorInfoBase::getDTCDescriptor(xdata::UnsignedIntegerT instance) const
00246 {
00247 if(theDTCSupervisors_.find(instance) == theDTCSupervisors_.end())
00248 std::cout << __COUT_HDR_FL__ << "Couldn't find: " << instance << std::endl;
00249 return theDTCSupervisors_.find(instance)->second;
00250 }
00251
00252
00253 XDAQ_CONST_CALL xdaq::ApplicationDescriptor* SupervisorDescriptorInfoBase::getFEDataManagerDescriptor(xdata::UnsignedIntegerT instance) const
00254 {
00255 if(theFEDataManagerSupervisors_.find(instance) == theFEDataManagerSupervisors_.end())
00256 std::cout << __COUT_HDR_FL__ << "Couldn't find: " << instance << std::endl;
00257 return theFEDataManagerSupervisors_.find(instance)->second;
00258 }
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269 XDAQ_CONST_CALL xdaq::ApplicationDescriptor* SupervisorDescriptorInfoBase::getARTDAQFEDataManagerDescriptor(xdata::UnsignedIntegerT instance) const
00270 {
00271 if(theARTDAQFEDataManagerSupervisors_.find(instance) == theARTDAQFEDataManagerSupervisors_.end())
00272 std::cout << __COUT_HDR_FL__ << "Couldn't find: " << instance << std::endl;
00273 return theARTDAQFEDataManagerSupervisors_.find(instance)->second;
00274 }
00275
00276
00277 XDAQ_CONST_CALL xdaq::ApplicationDescriptor* SupervisorDescriptorInfoBase::getARTDAQDataManagerDescriptor (xdata::UnsignedIntegerT instance) const
00278 {
00279 if(theARTDAQDataManagerSupervisors_.find(instance) == theARTDAQDataManagerSupervisors_.end())
00280 std::cout << __COUT_HDR_FL__ << "Couldn't find: " << instance << std::endl;
00281 return theARTDAQDataManagerSupervisors_.find(instance)->second;
00282 }
00283
00284
00285 XDAQ_CONST_CALL xdaq::ApplicationDescriptor* SupervisorDescriptorInfoBase::getARTDAQBuilderDescriptor(xdata::UnsignedIntegerT instance) const
00286 {
00287 if(theARTDAQBuilderSupervisors_.find(instance) == theARTDAQBuilderSupervisors_.end())
00288 std::cout << __COUT_HDR_FL__ << "Couldn't find: " << instance << std::endl;
00289 return theARTDAQBuilderSupervisors_.find(instance)->second;
00290 }
00291
00292
00293 XDAQ_CONST_CALL xdaq::ApplicationDescriptor* SupervisorDescriptorInfoBase::getARTDAQAggregatorDescriptor(xdata::UnsignedIntegerT instance) const
00294 {
00295 if(theARTDAQAggregatorSupervisors_.find(instance) == theARTDAQAggregatorSupervisors_.end())
00296 std::cout << __COUT_HDR_FL__ << "Couldn't find: " << instance << std::endl;
00297 return theARTDAQAggregatorSupervisors_.find(instance)->second;
00298 }
00299
00300
00301 std::string SupervisorDescriptorInfoBase::getFEURL(xdata::UnsignedIntegerT instance) const
00302 {
00303 return getFEDescriptor(instance)->getContextDescriptor()->getURL();
00304 }
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324