2 #include "otsdaq-core/ConfigurationPluginDataFormats/Configurations.h"
3 #include "otsdaq-coreMacros/TablePluginMacros.h"
8 Configurations::Configurations(
void) :
TableBase(
"Configurations")
29 Configurations::~Configurations(
void) {}
50 unsigned int tmpTableGroupKey;
52 for(
unsigned int row = 0; row < TableBase::activeTableView_->getNumberOfRows(); row++)
54 TableBase::activeTableView_->getValue(tmpTableGroupKey, row, TableGroupKeyAlias);
55 if(TableGroupKey == tmpTableGroupKey)
57 TableBase::activeTableView_->getValue(tmpKOC, row, KOC);
64 std::cout << __COUT_HDR_FL__ << __PRETTY_FUNCTION__ <<
"ERROR: Can't find KOC " << koc
72 TableVersion Configurations::getConditionVersion(
const TableGroupKey& TableGroupKey,
73 std::string koc)
const
75 unsigned int tmpTableGroupKey;
77 unsigned int conditionVersion;
79 for(
unsigned int row = 0; row < TableBase::activeTableView_->getNumberOfRows(); row++)
81 TableBase::activeTableView_->getValue(tmpTableGroupKey, row, TableGroupKeyAlias);
82 if(TableGroupKey == tmpTableGroupKey)
84 TableBase::activeTableView_->getValue(tmpKOC, row, KOC);
87 TableBase::activeTableView_->getValue(
88 conditionVersion, row, ConditionVersion);
95 std::cout << __COUT_HDR_FL__
96 <<
"***********************************************************************"
97 "*****************************************************"
99 std::cout << __COUT_HDR_FL__ <<
"\tCan't find KOC " << koc <<
" with TableGroupKey "
100 << TableGroupKey <<
" in the Configurations view" << std::endl;
101 std::cout << __COUT_HDR_FL__
102 <<
"***********************************************************************"
103 "*****************************************************"
105 __THROW__(
"Could not find koc for TableGroupKey");
113 int Configurations::setConditionVersionForView(
TableView* cfgView,
114 TableGroupKey TableGroupKey,
119 unsigned int row = 0;
120 unsigned int tmpTableGroupKey;
122 unsigned int tmpOldKOCVersion;
123 for(row = 0; row < cfgView->getNumberOfRows(); row++)
125 cfgView->getValue(tmpTableGroupKey, row, Configurations::TableGroupKeyAlias);
126 if(TableGroupKey == tmpTableGroupKey)
128 cfgView->getValue(tmpKOC, row, Configurations::KOC);
132 tmpOldKOCVersion, row, Configurations::ConditionVersion);
133 std::cout << __COUT_HDR_FL__ <<
"Found ConfigKey(" << TableGroupKey
134 <<
") and KOCAlias(" << koc <<
") pair."
135 <<
" Current version is: " << tmpOldKOCVersion
136 <<
" New version is: " << newKOCVersion << std::endl;
137 if(newKOCVersion == tmpOldKOCVersion)
146 std::cout << __COUT_HDR_FL__ <<
"Row found is:" << row << std::endl;
147 cfgView->setValue(newKOCVersion, row, Configurations::ConditionVersion);
148 std::cout << __COUT_HDR_FL__ <<
"Version changed to:" << newKOCVersion << std::endl;
157 std::set<std::string> Configurations::getListOfKocs(TableGroupKey TableGroupKey)
const
159 std::set<std::string> kocs;
160 getListOfKocsForView(TableBase::activeTableView_, kocs, TableGroupKey);
169 void Configurations::getListOfKocsForView(
TableView* cfgView,
170 std::set<std::string>& kocs,
171 TableGroupKey TableGroupKey)
const
175 std::cout << __COUT_HDR_FL__
176 <<
"*******************************************************************"
177 "*********************************************************"
179 std::cout << __COUT_HDR_FL__
180 <<
"\tCan't find list of Kocs for null cfgView pointer" << std::endl;
181 std::cout << __COUT_HDR_FL__
182 <<
"*******************************************************************"
183 "*********************************************************"
185 __THROW__(
"Null cfgView configuration view pointer");
189 unsigned int tmpTableGroupKey;
191 for(
unsigned int row = 0; row < cfgView->getNumberOfRows(); row++)
193 cfgView->getValue(tmpTableGroupKey, row, TableGroupKeyAlias);
194 if(TableGroupKey == TableGroupKey::INVALID || TableGroupKey == tmpTableGroupKey)
196 cfgView->getValue(tmpKOC, row, KOC);