otsdaq  v2_03_00
FEConfiguration_configuration.cc
1 #include <iostream>
2 #include "otsdaq-core/ConfigurationPluginDataFormats/FETable.h"
3 #include "otsdaq-coreMacros/TablePluginMacros.h"
4 
5 using namespace ots;
6 
7 //==============================================================================
8 FEConfiguration::FEConfiguration(void) : TableBase("FEConfiguration")
9 {
11  // WARNING: the names and the order MUST match the ones in the enum //
13  // FEConfigurationInfo.xml
14  //<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
15  //<ROOT xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
16  // xsi:noNamespaceSchemaLocation="TableInfo.xsd">
17  // <CONFIGURATION Name="FEConfiguration">
18  // <VIEW Name="FE_CONFIGURATION" Type="File,Database,DatabaseTest">
19  // <COLUMN Name="SupervisorType" StorageName="SUPERVISOR_TYPE"
20  // DataType="VARCHAR2"/> <COLUMN Name="SupervisorInstance"
21  // StorageName="SUPERVISOR_INSTANCE" DataType="NUMBER" /> <COLUMN
22  // Name="FrontEndType" StorageName="FRONT_END_TYPE" DataType="VARCHAR2"/>
23  // <COLUMN Name="FrontEndID" StorageName="INTERFACE_ID"
24  // DataType="VARCHAR2"/>
25  // </VIEW>
26  // </CONFIGURATION>
27  //</ROOT>
28 }
29 
30 //==============================================================================
31 FEConfiguration::~FEConfiguration(void) {}
32 
33 //==============================================================================
34 void FEConfiguration::init(ConfigurationManager* configManager)
35 {
36  std::string tmpType;
37  unsigned int tmpInstance;
38  std::string tmpID;
39  for(unsigned int row = 0; row < TableBase::activeTableView_->getNumberOfRows(); row++)
40  {
41  TableBase::activeTableView_->getValue(tmpType, row, SupervisorType);
42  TableBase::activeTableView_->getValue(tmpInstance, row, SupervisorInstance);
43  TableBase::activeTableView_->getValue(tmpID, row, FrontEndId);
44  std::cout << __COUT_HDR_FL__ << "Type: " << tmpType << " Name: " << tmpInstance
45  << " row: " << row << std::endl;
46  typeNameToRow_[composeUniqueName(tmpType, tmpInstance)][tmpID] = row;
47  }
48 }
49 //
51 // std::vector<std::string> FEConfiguration::getListOfFEIDs(void) const
52 //{
53 // std::vector<std::string> list;
54 // for(const auto& itSupervisors : typeNameToRow_)
55 // for(const auto& itFrontEnds : itSupervisors.second)
56 // list.push_back(itFrontEnds.first);
57 // return list;
58 //}
59 //
61 // std::vector<std::string> FEConfiguration::getListOfFEIDs(const std::string&
62 // supervisorType, unsigned int supervisorInstance) const
63 //{
64 // std::string uniqueName = composeUniqueName(supervisorType, supervisorInstance);
65 // std::vector<std::string> list;
66 // if(typeNameToRow_.find(uniqueName) == typeNameToRow_.end())
67 // {
68 // std::cout << __COUT_HDR_FL__
69 // << "Couldn't find any supervisor of type " << supervisorType
70 // << " and instance " << supervisorInstance
71 // << std::endl;
72 // //assert(0); //RAR - 8/12/16 - empty list is ok
73 // }
74 // else
75 // {
76 // for(const auto& it : typeNameToRow_.find(uniqueName)->second)
77 // list.push_back(it.first);
78 // }
79 //
80 // return list;
81 //}
82 //
84 // const std::string FEConfiguration::getFEInterfaceType(const std::string& frontEndID)
85 // const
86 //{
87 // for(const auto& itSupervisors : typeNameToRow_)
88 // for(const auto& itFrontEnds : itSupervisors.second)
89 // if(itFrontEnds.first == frontEndID)
90 // return
91 // TableBase::getView().getDataView()[typeNameToRow_.find(itSupervisors.first)->second.find(frontEndID)->second][FrontEndType];
92 // std::cout << __COUT_HDR_FL__ << "Didn't find any interface with ID: " << frontEndID <<
93 // std::endl; assert(0);
94 // __THROW__("FEID not found!");
95 // return "";
96 //}
97 //
99 // const std::string FEConfiguration::getFEInterfaceType(const std::string&
100 // supervisorType, unsigned int supervisorInstance, const std::string& frontEndID) const
101 //{
102 // std::string uniqueName = composeUniqueName(supervisorType, supervisorInstance);
103 // if(typeNameToRow_.find(uniqueName) == typeNameToRow_.end())
104 // {
105 // std::cout << __COUT_HDR_FL__
106 // << "Couldn't find any supervisor of type " << supervisorType
107 // << " and instance " << supervisorInstance
108 // << std::endl;
109 // assert(0);
110 // }
111 // if(typeNameToRow_.find(uniqueName)->second.find(frontEndID) ==
112 // typeNameToRow_.find(uniqueName)->second.end())
113 // {
114 // std::cout << __COUT_HDR_FL__
115 // << "Couldn't find any front end ID " << frontEndID
116 // << " for supervisor type " << supervisorType
117 // << " and instance " << supervisorInstance
118 // << std::endl;
119 // assert(0);
120 // }
121 //
122 // return
123 // TableBase::getView().getDataView()[typeNameToRow_.find(uniqueName)->second.find(frontEndID)->second][FrontEndType];
124 //}
125 
127 // std::vector<unsigned int> FEConfiguration::getListOfFEWRs(void) const
128 //{
129 // return getListOfFEs("FEWR");
130 //}
131 //
133 // std::vector<unsigned int> FEConfiguration::getListOfFEWRs(unsigned int
134 // supervisorInstance) const
135 //{
136 // return getListOfFEs("FEWR",supervisorInstance);
137 //}
138 //
140 // const std::string& FEConfiguration::getFEWRInterfaceName(unsigned int id) const
141 //{
142 // return getFEInterfaceType("FEWR", id);
143 //}
144 //
146 // std::vector<unsigned int> FEConfiguration::getListOfFEWs(void) const
147 //{
148 // return getListOfFEs("FEW");
149 //}
150 //
152 // std::vector<unsigned int> FEConfiguration::getListOfFEWs(unsigned int
153 // supervisorInstance) const
154 //{
155 // return getListOfFEs("FEW",supervisorInstance);
156 //}
157 //
159 // const std::string& FEConfiguration::getFEWInterfaceName(unsigned int id) const
160 //{
161 // return getFEInterfaceType("FEW", id);
162 //}
163 //
165 // std::vector<unsigned int> FEConfiguration::getListOfFERs(void) const
166 //{
167 // return getListOfFEs("FER");
168 //}
169 //
171 // std::vector<unsigned int> FEConfiguration::getListOfFERs(unsigned int
172 // supervisorInstance) const
173 //{
174 // return getListOfFEs("FER",supervisorInstance);
175 //}
176 //
178 // const std::string& FEConfiguration::getFERInterfaceName(unsigned int id) const
179 //{
180 // return getFEInterfaceType("FER", id);
181 //}
182 
183 DEFINE_OTS_CONFIGURATION(FEConfiguration)