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 throw std::runtime_error("Must have THE Supervisor (or THE OtsConfigurationWizardSupervisor) as part of the context configuration!");
00039
00040
00041 theLogbookSupervisor_ = *(applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("ots::LogbookSupervisor").begin());
00042 if(theLogbookSupervisor_ == 0)
00043 {
00044 std::cout << __COUT_HDR_FL__ << "Can't find application descriptor called \"ots::LogbookSupervisor\" (Must have been removed from the xdaq context configuration)" << std::endl;
00045 }
00046
00047
00048 theDataManagerSupervisors_.clear();
00049 for(auto& it: applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("ots::DataManagerSupervisor"))
00050 theDataManagerSupervisors_[it->getLocalId()] = it;
00051 if(theDataManagerSupervisors_.size() == 0)
00052 {
00053 std::cout << __COUT_HDR_FL__ << "Can't find application descriptor called \"ots::DataManagerSupervisor\" (Must have been removed from the xdaq context configuration)" << std::endl;
00054
00055 }
00056
00057 theFESupervisors_.clear();
00058 for(auto& it: applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("ots::FESupervisor"))
00059 theFESupervisors_[it->getLocalId()] = it;
00060
00061 if(theFESupervisors_.size() == 0)
00062 {
00063 std::cout << __COUT_HDR_FL__ << "Can't find application descriptor called \"ots::FESupervisor\" (Must have been removed from the xdaq context configuration)" << std::endl;
00064
00065 }
00066
00067 theFEDataManagerSupervisors_.clear();
00068 for(auto& it: applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("ots::FEDataManagerSupervisor"))
00069 theFEDataManagerSupervisors_[it->getLocalId()] = it;
00070 if(theFEDataManagerSupervisors_.size() == 0)
00071 {
00072 std::cout << __COUT_HDR_FL__ << "Can't find application descriptor called \"ots::FEDataManagerSupervisor\" (Must have been removed from the xdaq context configuration)" << std::endl;
00073
00074 }
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085 theARTDAQFEDataManagerSupervisors_.clear();
00086 for(auto& it: applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("ots::ARTDAQFEDataManagerSupervisor"))
00087 theARTDAQFEDataManagerSupervisors_[it->getLocalId()] = it;
00088 if(theARTDAQFEDataManagerSupervisors_.size() == 0)
00089 {
00090 std::cout << __COUT_HDR_FL__ << "Can't find application descriptor called \"ots::ARTDAQFEDataManagerSupervisor\" (Must have been removed from the xdaq context configuration)" << std::endl;
00091
00092 }
00093 theARTDAQDataManagerSupervisors_.clear();
00094 for(auto& it: applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("ots::ARTDAQDataManagerSupervisor"))
00095 theARTDAQDataManagerSupervisors_[it->getLocalId()] = it;
00096 if(theARTDAQDataManagerSupervisors_.size() == 0)
00097 {
00098 std::cout << __COUT_HDR_FL__ << "Can't find application descriptor called \"ots::ARTDAQDataManagerSupervisor\" (Must have been removed from the xdaq context configuration)" << std::endl;
00099
00100 }
00101
00102 theARTDAQBuilderSupervisors_.clear();
00103 for(auto& it: applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("ots::EventBuilderApp"))
00104 theARTDAQBuilderSupervisors_[it->getLocalId()] = it;
00105 if(theARTDAQBuilderSupervisors_.size() == 0)
00106 {
00107 std::cout << __COUT_HDR_FL__ << "Can't find application descriptor called \"ots::EventBuilderApp\" (Must have been removed from the xdaq context configuration)" << std::endl;
00108
00109 }
00110
00111 theARTDAQAggregatorSupervisors_.clear();
00112 for(auto& it: applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("ots::AggregatorApp"))
00113 theARTDAQAggregatorSupervisors_[it->getLocalId()] = it;
00114 if(theARTDAQAggregatorSupervisors_.size() == 0)
00115 {
00116 std::cout << __COUT_HDR_FL__ << "Can't find application descriptor called \"ots::AggregatorApp\" (Must have been removed from the xdaq context configuration)" << std::endl;
00117
00118 }
00119
00120 theVisualSupervisors_.clear();
00121 for(auto& it: applicationContext->getDefaultZone()->getApplicationGroup("daq")->getApplicationDescriptors("ots::VisualSupervisor"))
00122 theVisualSupervisors_[it->getLocalId()] = it;
00123 if(theVisualSupervisors_.size() == 0)
00124 {
00125 std::cout << __COUT_HDR_FL__ << "Can't find application descriptor called \"ots::VisualSupervisor\" (Must have been removed from the xdaq context configuration)" << std::endl;
00126
00127 }
00128 }
00129
00130
00131 const SupervisorDescriptors& SupervisorDescriptorInfoBase::getDataManagerDescriptors(void) const
00132 {
00133 return theDataManagerSupervisors_;
00134 }
00135
00136
00137 const SupervisorDescriptors& SupervisorDescriptorInfoBase::getFEDescriptors(void) const
00138 {
00139 return theFESupervisors_;
00140 }
00141
00142
00143 const SupervisorDescriptors& SupervisorDescriptorInfoBase::getFEDataManagerDescriptors(void) const
00144 {
00145 return theFEDataManagerSupervisors_;
00146 }
00147
00148
00149
00150
00151
00152
00153
00154 const SupervisorDescriptors& SupervisorDescriptorInfoBase::getARTDAQFEDataManagerDescriptors(void) const
00155 {
00156 return theARTDAQFEDataManagerSupervisors_;
00157 }
00158
00159 const SupervisorDescriptors& SupervisorDescriptorInfoBase::getARTDAQDataManagerDescriptors (void) const
00160 {
00161 return theARTDAQDataManagerSupervisors_;
00162 }
00163
00164
00165 const SupervisorDescriptors& SupervisorDescriptorInfoBase::getARTDAQBuilderDescriptors(void) const
00166 {
00167 return theARTDAQBuilderSupervisors_;
00168 }
00169
00170
00171 const SupervisorDescriptors& SupervisorDescriptorInfoBase::getARTDAQAggregatorDescriptors(void) const
00172 {
00173 return theARTDAQAggregatorSupervisors_;
00174 }
00175
00176
00177 const SupervisorDescriptors& SupervisorDescriptorInfoBase::getVisualDescriptors(void) const
00178 {
00179 return theVisualSupervisors_;
00180 }
00181
00182
00183 XDAQ_CONST_CALL xdaq::ApplicationDescriptor* SupervisorDescriptorInfoBase::getSupervisorDescriptor(void) const
00184 {
00185 return theSupervisor_;
00186 }
00187
00188
00189 XDAQ_CONST_CALL xdaq::ApplicationDescriptor* SupervisorDescriptorInfoBase::getWizardDescriptor(void) const
00190 {
00191 return theWizard_;
00192 }
00193
00194
00195 XDAQ_CONST_CALL xdaq::ApplicationDescriptor* SupervisorDescriptorInfoBase::getLogbookDescriptor(void) const
00196 {
00197 return theLogbookSupervisor_;
00198 }
00199
00200
00201 XDAQ_CONST_CALL xdaq::ApplicationDescriptor* SupervisorDescriptorInfoBase::getVisualDescriptor(xdata::UnsignedIntegerT instance) const
00202 {
00203 if(theVisualSupervisors_.find(instance) == theVisualSupervisors_.end())
00204 std::cout << __COUT_HDR_FL__ << "Couldn't find: " << instance << std::endl;
00205 return theVisualSupervisors_.find(instance)->second;
00206 }
00207
00208
00209 XDAQ_CONST_CALL xdaq::ApplicationDescriptor* SupervisorDescriptorInfoBase::getDataManagerDescriptor(xdata::UnsignedIntegerT instance) const
00210 {
00211 if(theDataManagerSupervisors_.find(instance) == theDataManagerSupervisors_.end())
00212 std::cout << __COUT_HDR_FL__ << "Couldn't find: " << instance << std::endl;
00213 return theDataManagerSupervisors_.find(instance)->second;
00214 }
00215
00216
00217 XDAQ_CONST_CALL xdaq::ApplicationDescriptor* SupervisorDescriptorInfoBase::getFEDescriptor(xdata::UnsignedIntegerT instance) const
00218 {
00219 if(theFESupervisors_.find(instance) == theFESupervisors_.end())
00220 std::cout << __COUT_HDR_FL__ << "Couldn't find: " << instance << std::endl;
00221 return theFESupervisors_.find(instance)->second;
00222 }
00223
00224
00225 XDAQ_CONST_CALL xdaq::ApplicationDescriptor* SupervisorDescriptorInfoBase::getFEDataManagerDescriptor(xdata::UnsignedIntegerT instance) const
00226 {
00227 if(theFEDataManagerSupervisors_.find(instance) == theFEDataManagerSupervisors_.end())
00228 std::cout << __COUT_HDR_FL__ << "Couldn't find: " << instance << std::endl;
00229 return theFEDataManagerSupervisors_.find(instance)->second;
00230 }
00231
00232
00233
00234
00235
00236
00237
00238
00239
00240
00241 XDAQ_CONST_CALL xdaq::ApplicationDescriptor* SupervisorDescriptorInfoBase::getARTDAQFEDataManagerDescriptor(xdata::UnsignedIntegerT instance) const
00242 {
00243 if(theARTDAQFEDataManagerSupervisors_.find(instance) == theARTDAQFEDataManagerSupervisors_.end())
00244 std::cout << __COUT_HDR_FL__ << "Couldn't find: " << instance << std::endl;
00245 return theARTDAQFEDataManagerSupervisors_.find(instance)->second;
00246 }
00247
00248
00249 XDAQ_CONST_CALL xdaq::ApplicationDescriptor* SupervisorDescriptorInfoBase::getARTDAQDataManagerDescriptor (xdata::UnsignedIntegerT instance) const
00250 {
00251 if(theARTDAQDataManagerSupervisors_.find(instance) == theARTDAQDataManagerSupervisors_.end())
00252 std::cout << __COUT_HDR_FL__ << "Couldn't find: " << instance << std::endl;
00253 return theARTDAQDataManagerSupervisors_.find(instance)->second;
00254 }
00255
00256
00257 XDAQ_CONST_CALL xdaq::ApplicationDescriptor* SupervisorDescriptorInfoBase::getARTDAQBuilderDescriptor(xdata::UnsignedIntegerT instance) const
00258 {
00259 if(theARTDAQBuilderSupervisors_.find(instance) == theARTDAQBuilderSupervisors_.end())
00260 std::cout << __COUT_HDR_FL__ << "Couldn't find: " << instance << std::endl;
00261 return theARTDAQBuilderSupervisors_.find(instance)->second;
00262 }
00263
00264
00265 XDAQ_CONST_CALL xdaq::ApplicationDescriptor* SupervisorDescriptorInfoBase::getARTDAQAggregatorDescriptor(xdata::UnsignedIntegerT instance) const
00266 {
00267 if(theARTDAQAggregatorSupervisors_.find(instance) == theARTDAQAggregatorSupervisors_.end())
00268 std::cout << __COUT_HDR_FL__ << "Couldn't find: " << instance << std::endl;
00269 return theARTDAQAggregatorSupervisors_.find(instance)->second;
00270 }
00271
00272
00273 std::string SupervisorDescriptorInfoBase::getFEURL(xdata::UnsignedIntegerT instance) const
00274 {
00275 return getFEDescriptor(instance)->getContextDescriptor()->getURL();
00276 }
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296