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