$treeview $search $mathjax $extrastylesheet
otsdaq
v2_03_00
$projectbrief
|
$projectbrief
|
$searchbox |
00001 #include <iostream> 00002 #include "otsdaq-core/ConfigurationPluginDataFormats/DetectorTable.h" 00003 #include "otsdaq-coreMacros/TablePluginMacros.h" 00004 00005 using namespace ots; 00006 00007 //============================================================================== 00008 DetectorConfiguration::DetectorConfiguration(void) : TableBase("DetectorConfiguration") 00009 { 00011 // WARNING: the names and the order MUST match the ones in the enum // 00013 // DetectorConfigurationInfo.xml 00014 //<?xml version="1.0" encoding="UTF-8" standalone="no" ?> 00015 //<ROOT xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 00016 // xsi:noNamespaceSchemaLocation="TableInfo.xsd"> 00017 // <CONFIGURATION Name="DetectorConfiguration"> 00018 // <VIEW Name="DETECTOR_CONFIGURATION" Type="File,Database,DatabaseTest"> 00019 // <COLUMN Name="DetectorID" StorageName="DETECTOR_ID" DataType="VARCHAR2"/> 00020 // <COLUMN Name="DetectorType" StorageName="DETECTOR_TYPE" 00021 // DataType="VARCHAR2"/> <COLUMN Name="DetectorStatus" 00022 // StorageName="DETECTOR_STATUS" DataType="VARCHAR2"/> 00023 // </VIEW> 00024 // </CONFIGURATION> 00025 //</ROOT> 00026 } 00027 00028 //============================================================================== 00029 DetectorConfiguration::~DetectorConfiguration(void) {} 00030 00031 //============================================================================== 00032 void DetectorConfiguration::init(ConfigurationManager* configManager) 00033 { 00034 nameToRow_.clear(); 00035 detectorIDs_.clear(); 00036 detectorTypes_.clear(); 00037 std::string tmpDetectorID; 00038 std::map<std::string, bool> detectorTypes; 00039 for(unsigned int row = 0; row < TableBase::activeTableView_->getNumberOfRows(); row++) 00040 { 00041 TableBase::activeTableView_->getValue(tmpDetectorID, row, DetectorID); 00042 nameToRow_[tmpDetectorID] = row; 00043 detectorTypes[TableBase::getView().getDataView()[row][DetectorType]] = true; 00044 detectorIDs_.push_back(tmpDetectorID); 00045 } 00046 for(auto& it : detectorTypes) 00047 detectorTypes_.push_back(it.first); 00048 } 00049 00050 //============================================================================== 00051 const std::vector<std::string>& DetectorConfiguration::getDetectorIDs() const 00052 { 00053 return detectorIDs_; 00054 } 00055 00056 //============================================================================== 00057 const std::vector<std::string>& DetectorConfiguration::getDetectorTypes() const 00058 { 00059 return detectorTypes_; 00060 } 00061 00062 //============================================================================== 00063 const std::string& DetectorConfiguration::getDetectorType( 00064 const std::string& detectorID) const 00065 { 00066 return TableBase::getView() 00067 .getDataView()[nameToRow_.find(detectorID)->second][DetectorType]; 00068 } 00069 00070 //============================================================================== 00071 const std::string& DetectorConfiguration::getDetectorStatus( 00072 const std::string& detectorID) const 00073 { 00074 return TableBase::getView() 00075 .getDataView()[nameToRow_.find(detectorID)->second][DetectorStatus]; 00076 } 00077 00078 DEFINE_OTS_CONFIGURATION(DetectorConfiguration)