9 #include "otsdaq/ConfigurationInterface/ConfigurationInterface.h"
10 #include "otsdaq/ConfigurationInterface/ConfigurationManagerRW.h"
22 void FlattenActiveSystemAliasTableGroups(
int argc,
char* argv[])
24 std::cout <<
"=================================================\n";
25 std::cout <<
"=================================================\n";
26 std::cout <<
"=================================================\n";
27 __COUT__ <<
"\nFlattening Active System Aliases!" << std::endl;
29 std::cout <<
"\n\nusage: Two arguments:\n\t <baseFlatVersion> <pathToSwapIn "
31 <<
"\t Default values: baseFlatVersion = 0, pathToSwapIn = \"\" \n\n"
34 std::cout <<
"\n\nNote: you can optionally just swap databases (and not modify their "
36 <<
" by providing an invalid baseFlatVersion of -1.\n\n"
39 std::cout <<
"\n\nNote: This assumes artdaq db file type interface. "
40 <<
"The current database/ will be moved to database_<linuxtime>/ "
41 <<
"and if a pathToSwapIn is specified it will be copied to database/ "
42 <<
"before saving the currently active groups.\n\n"
45 std::cout <<
"argc = " << argc << std::endl;
46 for(
int i = 0; i < argc; i++)
47 std::cout <<
"argv[" << i <<
"] = " << argv[i] << std::endl;
51 std::cout <<
"Error! Must provide at least one parameter.\n\n" << std::endl;
56 std::string flatVersionStr = argv[1];
57 if(flatVersionStr.find(
'h') != std::string::npos)
59 std::cout <<
"Recognized parameter 1. as a 'help' option. Usage was printed. Exiting." << std::endl;
64 std::string pathToSwapIn =
"";
66 sscanf(argv[1],
"%d", &flatVersion);
68 pathToSwapIn = argv[2];
70 __COUT__ <<
"flatVersion = " << flatVersion << std::endl;
71 __COUT__ <<
"pathToSwapIn = " << pathToSwapIn << std::endl;
81 setenv(
"CONFIGURATION_TYPE",
"File", 1);
82 setenv(
"CONFIGURATION_DATA_PATH", (std::string(getenv(
"USER_DATA")) +
"/ConfigurationDataExamples").c_str(), 1);
83 setenv(
"TABLE_INFO_PATH", (std::string(getenv(
"USER_DATA")) +
"/TableInfo").c_str(), 1);
87 setenv(
"SERVICE_DATA_PATH", (std::string(getenv(
"USER_DATA")) +
"/ServiceData").c_str(), 1);
91 setenv(
"OTSDAQ_LIB", (std::string(getenv(
"USER_DATA")) +
"/").c_str(), 1);
92 setenv(
"OTSDAQ_UTILITIES_LIB", (std::string(getenv(
"USER_DATA")) +
"/").c_str(), 1);
95 setenv(
"OTS_MAIN_PORT",
"2015", 1);
98 setenv(
"XDAQ_CONFIGURATION_DATA_PATH", (std::string(getenv(
"USER_DATA")) +
"/XDAQConfigurations").c_str(), 1);
99 setenv(
"XDAQ_CONFIGURATION_XML",
"otsConfigurationNoRU_CMake", 1);
106 std::cout <<
"\n\n\n" << __COUT_HDR_FL__ <<
"Loading active Aliases..." << std::endl;
134 std::map<std::pair<std::string, TableGroupKey>,
TableGroupKey> groupSet;
136 std::map<std::pair<std::string, TableVersion>,
TableVersion> modifiedTables;
137 std::map<std::string, std::pair<TableGroupKey, TableGroupKey>> activeGroupKeys;
138 std::map<std::pair<std::string, TableGroupKey>, std::string> groupErrors;
140 std::string activeBackboneGroupName =
"";
141 std::string activeContextGroupName =
"";
142 std::string activeIterateGroupName =
"";
143 std::string activeConfigGroupName =
"";
145 std::string nowTime = std::to_string(time(0));
147 std::string thenTime =
"";
148 if(pathToSwapIn !=
"")
150 thenTime = pathToSwapIn.substr(pathToSwapIn.rfind(
'_') + 1);
151 __COUT__ <<
"thenTime = " << thenTime << std::endl;
156 std::map<std::string, std::pair<std::string, TableGroupKey>> activeGroupsMap = cfgMgr->getActiveTableGroups();
158 for(
const auto& activeGroup : activeGroupsMap)
160 groupSet.insert(std::pair<std::pair<std::string, TableGroupKey>,
TableGroupKey>(
161 std::pair<std::string, TableGroupKey>(activeGroup.second.first, activeGroup.second.second),
TableGroupKey()));
162 activeGroupKeys.insert(std::pair<std::string, std::pair<TableGroupKey, TableGroupKey>>(
163 activeGroup.second.first, std::pair<TableGroupKey, TableGroupKey>(activeGroup.second.second,
TableGroupKey())));
165 if(activeGroup.first == ConfigurationManager::ACTIVE_GROUP_NAME_BACKBONE)
167 activeBackboneGroupName = activeGroup.second.first;
168 __COUT__ <<
"found activeBackboneGroupName = " << activeBackboneGroupName << std::endl;
170 else if(activeGroup.first == ConfigurationManager::ACTIVE_GROUP_NAME_CONTEXT)
172 activeContextGroupName = activeGroup.second.first;
173 __COUT__ <<
"found activeContextGroupName = " << activeContextGroupName << std::endl;
175 else if(activeGroup.first == ConfigurationManager::ACTIVE_GROUP_NAME_ITERATE)
177 activeIterateGroupName = activeGroup.second.first;
178 __COUT__ <<
"found activeIterateGroupName = " << activeIterateGroupName << std::endl;
180 else if(activeGroup.first == ConfigurationManager::ACTIVE_GROUP_NAME_CONFIGURATION)
182 activeConfigGroupName = activeGroup.second.first;
183 __COUT__ <<
"found activeConfigGroupName = " << activeConfigGroupName << std::endl;
190 const std::string groupAliasesTableName = ConfigurationManager::GROUP_ALIASES_TABLE_NAME;
191 std::map<std::string, TableVersion> activeVersions = cfgMgr->getActiveVersions();
192 if(activeVersions.find(groupAliasesTableName) == activeVersions.end())
194 __SS__ <<
"\nActive version of " << groupAliasesTableName <<
" missing! " << groupAliasesTableName
195 <<
" is a required member of the Backbone configuration group."
196 <<
"\n\nLikely you need to activate a valid Backbone group." << std::endl;
200 std::vector<std::pair<std::string, ConfigurationTree>> aliasNodePairs = cfgMgr->getNode(groupAliasesTableName).getChildren();
201 for(
auto& groupPair : aliasNodePairs)
202 groupSet.insert(std::pair<std::pair<std::string, TableGroupKey>,
TableGroupKey>(
203 std::pair<std::string, TableGroupKey>(groupPair.second.getNode(
"GroupName").getValueAsString(),
204 TableGroupKey(groupPair.second.getNode(
"GroupKey").getValueAsString())),
207 __COUT__ <<
"Identified groups:" << std::endl;
208 for(
auto& group : groupSet)
209 __COUT__ << group.first.first <<
" " << group.first.second << std::endl;
210 __COUT__ << std::endl;
211 __COUT__ << std::endl;
216 std::string currentDir = __ENV__(
"ARTDAQ_DATABASE_URI");
218 if(currentDir.find(
"filesystemdb://") != 0)
220 __SS__ <<
"filesystemdb:// was not found in $ARTDAQ_DATABASE_URI!" << std::endl;
221 __COUT_ERR__ <<
"\n" << ss.str();
225 currentDir = currentDir.substr(std::string(
"filesystemdb://").length());
226 while(currentDir.length() && currentDir[currentDir.length() - 1] ==
'/')
227 currentDir = currentDir.substr(0, currentDir.length() - 1);
228 std::string moveToDir = currentDir +
"_" + nowTime;
231 __SS__ << (
"Aborting move! Must at least give version argument to flatten to!") << std::endl;
232 __COUT_ERR__ <<
"\n" << ss.str();
236 if(pathToSwapIn !=
"")
239 if((dp = opendir(pathToSwapIn.c_str())) == 0)
241 __COUT__ <<
"ERROR:(" << errno <<
"). Can't open directory: " << pathToSwapIn << std::endl;
248 __COUT__ <<
"Moving current directory: \t" << currentDir << std::endl;
249 __COUT__ <<
"\t... to: \t\t" << moveToDir << std::endl;
251 rename(currentDir.c_str(), moveToDir.c_str());
253 if(pathToSwapIn !=
"")
255 __COUT__ <<
"Swapping in directory: \t" << pathToSwapIn << std::endl;
256 __COUT__ <<
"\t.. to: \t\t" << currentDir << std::endl;
257 rename(pathToSwapIn.c_str(), currentDir.c_str());
261 std::string activeGroupsFile = ConfigurationManager::ACTIVE_GROUPS_FILENAME +
"." + thenTime;
262 FILE* fp = fopen(activeGroupsFile.c_str(),
"r");
265 __COUT__ <<
"Swapping active groups file: \t" << activeGroupsFile << std::endl;
266 __COUT__ <<
"\t.. to: \t\t" << ConfigurationManager::ACTIVE_GROUPS_FILENAME << std::endl;
267 rename(activeGroupsFile.c_str(), ConfigurationManager::ACTIVE_GROUPS_FILENAME.c_str());
276 std::string accumulateErrors =
"";
280 std::map<std::string , std::string > groupAliases;
281 std::string groupComment;
282 std::string groupAuthor;
283 std::string groupCreateTime;
284 time_t groupCreateTime_t;
285 TableBase* groupMetadataTable = cfgMgr->getMetadataTable();
290 __COUT__ <<
"\n\nflatVersion " <<
TableVersion(flatVersion) <<
" is an invalid or temporary version. Skipping to end!" << std::endl;
294 for(
auto& groupPair : groupSet)
298 __COUT__ <<
"****************************" << std::endl;
299 __COUT__ <<
"Loading members for " << groupPair.first.first <<
"(" << groupPair.first.second <<
")" << std::endl;
300 __COUT__ <<
"flatVersion = " << flatVersion << std::endl;
303 if(pathToSwapIn !=
"")
305 __COUT__ <<
"REVERT by Swapping back directory: \t" << currentDir << std::endl;
306 __COUT__ <<
"\t.. to: \t\t" << pathToSwapIn << std::endl;
307 if(rename(currentDir.c_str(), pathToSwapIn.c_str()) < 0)
309 __SS__ <<
"Problem!" << std::endl;
315 __COUT__ <<
"REVERT by Moving directory: \t" << currentDir << std::endl;
316 __COUT__ <<
"\t.. to temporary directory: \t\t" << (moveToDir +
"_tmp") << std::endl;
317 if(rename(currentDir.c_str(), (moveToDir +
"_tmp").c_str()) < 0)
319 __SS__ <<
"Problem!" << std::endl;
324 __COUT__ <<
"REVERT by Moving directory: \t" << moveToDir << std::endl;
325 __COUT__ <<
"\t... to: \t\t" << currentDir << std::endl;
326 if(rename(moveToDir.c_str(), currentDir.c_str()) < 0)
328 __SS__ <<
"Problem!" << std::endl;
336 accumulateErrors =
"";
337 cfgMgr->loadTableGroup(groupPair.first.first,
338 groupPair.first.second,
350 catch(std::runtime_error& e)
352 __COUT__ <<
"Error was caught loading members for " << groupPair.first.first <<
"(" << groupPair.first.second <<
")" << std::endl;
353 __COUT__ << e.what() << std::endl;
358 __COUT__ <<
"Error was caught loading members for " << groupPair.first.first <<
"(" << groupPair.first.second <<
")" << std::endl;
367 __COUT__ <<
"Moving current directory: \t" << currentDir << std::endl;
368 __COUT__ <<
"\t... to: \t\t" << moveToDir << std::endl;
369 if(rename(currentDir.c_str(), moveToDir.c_str()) < 0)
371 __SS__ <<
"Problem!" << std::endl;
375 if(pathToSwapIn !=
"")
377 __COUT__ <<
"Swapping in directory: \t" << pathToSwapIn << std::endl;
378 __COUT__ <<
"\t.. to: \t\t" << currentDir << std::endl;
379 if(rename(pathToSwapIn.c_str(), currentDir.c_str()) < 0)
381 __SS__ <<
"Problem!" << std::endl;
387 __COUT__ <<
"Moving temporary directory: \t" << (moveToDir +
"_tmp") << std::endl;
388 __COUT__ <<
"\t.. to current directory: \t\t" << currentDir << std::endl;
389 if(rename((moveToDir +
"_tmp").c_str(), currentDir.c_str()) < 0)
391 __SS__ <<
"Problem!" << std::endl;
404 groupErrors.insert(std::pair<std::pair<std::string, TableGroupKey>, std::string>(
405 std::pair<std::string, TableGroupKey>(groupPair.first.first, groupPair.first.second),
"Error caught loading the group."));
414 for(
auto& memberPair : memberMap)
416 __COUT__ << memberPair.first <<
":v" << memberPair.second << std::endl;
420 if(modifiedTables.find(std::pair<std::string, TableVersion>(memberPair.first, memberPair.second)) != modifiedTables.end())
422 __COUT__ <<
"Table was already modified!" << std::endl;
423 memberPair.second = modifiedTables[std::pair<std::string, TableVersion>(memberPair.first, memberPair.second)];
424 __COUT__ <<
"\t to...\t" << memberPair.first <<
":v" << memberPair.second << std::endl;
429 config = cfgMgr->getTableByName(memberPair.first);
430 cfgView = config->getViewP();
432 theInterface_->saveActiveVersion(config);
436 cfgView->setVersion(memberPair.second);
439 modifiedTables.insert(std::pair<std::pair<std::string, TableVersion>,
TableVersion>(
440 std::pair<std::string, TableVersion>(memberPair.first, memberPair.second),
TableVersion(flatVersion)));
442 memberPair.second = flatVersion;
444 __COUT__ <<
"\t to...\t" << memberPair.first <<
":v" << memberPair.second << std::endl;
450 __COUTV__(StringMacros::mapToString(groupAliases));
451 __COUTV__(groupComment);
452 __COUTV__(groupAuthor);
453 __COUTV__(groupCreateTime);
454 sscanf(groupCreateTime.c_str(),
"%ld", &groupCreateTime_t);
455 __COUTV__(groupCreateTime_t);
459 while(groupMetadataTable->getViewP()->getNumberOfRows() > 1)
460 groupMetadataTable->getViewP()->deleteRow(0);
461 if(groupMetadataTable->getViewP()->getNumberOfRows() == 0)
462 groupMetadataTable->getViewP()->addRow();
466 groupMetadataTable->getViewP()->setValue(
467 StringMacros::mapToString(groupAliases,
"," ,
":" ), 0, ConfigurationManager::METADATA_COL_ALIASES);
468 groupMetadataTable->getViewP()->setValue(groupComment, 0, ConfigurationManager::METADATA_COL_COMMENT);
469 groupMetadataTable->getViewP()->setValue(groupAuthor, 0, ConfigurationManager::METADATA_COL_AUTHOR);
470 groupMetadataTable->getViewP()->setValue(groupCreateTime_t, 0, ConfigurationManager::METADATA_COL_TIMESTAMP);
473 groupMetadataTable->getViewP()->setVersion(
TableVersion(flatVersion));
474 theInterface_->saveActiveVersion(groupMetadataTable);
477 memberMap[groupMetadataTable->getTableName()] = groupMetadataTable->getViewVersion();
481 theInterface_->saveTableGroup(memberMap, TableGroupKey::getFullGroupString(groupPair.first.first,
TableGroupKey(flatVersion)));
487 if(activeGroupKeys.find(groupPair.first.first) != activeGroupKeys.end() && activeGroupKeys[groupPair.first.first].first == groupPair.first.second)
488 activeGroupKeys[groupPair.first.first].second =
TableGroupKey(flatVersion);
490 catch(std::runtime_error& e)
492 __COUT__ <<
"Error was caught saving group " << groupPair.first.first <<
" (" << groupPair.first.second <<
") " << std::endl;
493 __COUT__ << e.what() << std::endl;
495 groupErrors.insert(std::pair<std::pair<std::string, TableGroupKey>, std::string>(
496 std::pair<std::string, TableGroupKey>(groupPair.first.first, groupPair.first.second),
"Error caught saving the group."));
500 __COUT__ <<
"Error was caught saving group " << groupPair.first.first <<
" (" << groupPair.first.second <<
") " << std::endl;
502 groupErrors.insert(std::pair<std::pair<std::string, TableGroupKey>, std::string>(
503 std::pair<std::string, TableGroupKey>(groupPair.first.first, groupPair.first.second),
"Error caught saving the group."));
514 FILE* fp = fopen((moveToDir +
"/README_otsdaq_flatten.txt").c_str(),
"a");
516 __COUT__ <<
"\tError opening README file!" << std::endl;
524 timeinfo = localtime(&rawtime);
525 strftime(buffer, 200,
"%b %d, %Y %I:%M%p %Z", timeinfo);
528 "This database was moved from...\n\t %s \nto...\n\t %s \nat this "
529 "time \n\t %lu \t %s\n\n\n",
541 FILE* fp = fopen((currentDir +
"/README_otsdaq_flatten.txt").c_str(),
"a");
544 __COUT__ <<
"\tError opening README file!" << std::endl;
552 timeinfo = localtime(&rawtime);
553 strftime(buffer, 200,
"%b %d, %Y %I:%M:%S%p %Z", timeinfo);
556 "This database was moved from...\t %s \t to...\t %s at this time \t "
558 pathToSwapIn.c_str(),
592 if(activeBackboneGroupName ==
"")
594 __COUT__ <<
"No active Backbone table identified." << std::endl;
600 <<
"Modifying the active Backbone table to reflect new table versions and "
605 cfgMgr->loadTableGroup(activeBackboneGroupName, activeGroupKeys[activeBackboneGroupName].second,
true, &memberMap, 0, &accumulateErrors);
610 const std::string groupAliasesName = ConfigurationManager::GROUP_ALIASES_TABLE_NAME;
611 const std::string versionAliasesName = ConfigurationManager::VERSION_ALIASES_TABLE_NAME;
613 std::map<std::string, TableVersion> activeMap = cfgMgr->getActiveVersions();
616 if(activeMap.find(groupAliasesName) != activeMap.end())
618 __COUT__ <<
"\n\nModifying " << groupAliasesName << std::endl;
619 config = cfgMgr->getTableByName(groupAliasesName);
620 cfgView = config->getViewP();
622 unsigned int col1 = cfgView->findCol(
"GroupName");
623 unsigned int col2 = cfgView->findCol(
"GroupKey");
630 for(
unsigned int row = 0; row < cfgView->getNumberOfRows(); ++row)
633 for(
const auto& group : groupSet)
634 if(group.second.isInvalid())
636 else if(cfgView->getDataView()[row][col1] == group.first.first && cfgView->getDataView()[row][col2] == group.first.second.toString())
639 __COUT__ <<
"Changing row " << row <<
" for " << cfgView->getDataView()[row][col1] <<
" key=" << cfgView->getDataView()[row][col2]
640 <<
" to NEW key=" << group.second << std::endl;
641 cfgView->setValue(group.second.toString(), row, col2);
647 cfgView->deleteRow(row--);
653 if(activeMap.find(versionAliasesName) != activeMap.end())
655 __COUT__ <<
"\n\nModifying " << versionAliasesName << std::endl;
656 config = cfgMgr->getTableByName(versionAliasesName);
657 cfgView = config->getViewP();
658 unsigned int col1 = cfgView->findCol(
"TableName");
659 unsigned int col2 = cfgView->findCol(
"Version");
663 for(
unsigned int row = 0; row < cfgView->getNumberOfRows(); ++row)
666 for(
const auto& table : modifiedTables)
667 if(cfgView->getDataView()[row][col1] == table.first.first && cfgView->getDataView()[row][col2] == table.first.second.toString())
670 __COUT__ <<
"Changing row " << row <<
" for " << cfgView->getDataView()[row][col1] <<
" version=" << cfgView->getDataView()[row][col2]
671 <<
" to NEW version=" << table.second << std::endl;
672 cfgView->setValue(table.second.toString(), row, col2);
678 cfgView->deleteRow(row--);
684 __COUT__ << groupAliasesName <<
":v" << memberMap[groupAliasesName] << std::endl;
686 config = cfgMgr->getTableByName(groupAliasesName);
687 cfgView = config->getViewP();
689 theInterface_->saveActiveVersion(config);
691 memberMap[groupAliasesName] = flatVersion;
693 __COUT__ <<
"\t to...\t" << groupAliasesName <<
":v" << memberMap[groupAliasesName] << std::endl;
695 __COUT__ << versionAliasesName <<
":v" << memberMap[versionAliasesName] << std::endl;
697 config = cfgMgr->getTableByName(versionAliasesName);
698 cfgView = config->getViewP();
700 theInterface_->saveActiveVersion(config);
702 memberMap[versionAliasesName] = flatVersion;
704 __COUT__ <<
"\t to...\t" << versionAliasesName <<
":v" << memberMap[versionAliasesName] << std::endl;
707 theInterface_->saveTableGroup(memberMap, TableGroupKey::getFullGroupString(activeBackboneGroupName,
TableGroupKey(flatVersion)));
709 activeGroupKeys[activeBackboneGroupName].second =
TableGroupKey(flatVersion);
711 __COUT__ <<
"New to-be-active backbone group " << activeBackboneGroupName <<
":v" << activeGroupKeys[activeBackboneGroupName].second << std::endl;
719 std::cout <<
"\n\n" << __COUT_HDR_FL__ <<
"Manipulating the Active Groups file..." << std::endl;
722 FILE* fp = fopen(ConfigurationManager::ACTIVE_GROUPS_FILENAME.c_str(),
"r");
725 __SS__ <<
"Original active groups file '" << ConfigurationManager::ACTIVE_GROUPS_FILENAME <<
"' not found." << std::endl;
729 __COUT__ <<
"Backing up file: " << ConfigurationManager::ACTIVE_GROUPS_FILENAME << std::endl;
733 std::string renameFile = ConfigurationManager::ACTIVE_GROUPS_FILENAME +
"." + nowTime;
734 rename(ConfigurationManager::ACTIVE_GROUPS_FILENAME.c_str(), renameFile.c_str());
736 __COUT__ <<
"Backup file name: " << renameFile << std::endl;
738 TableGroupKey *theConfigurationTableGroupKey_, *theContextTableGroupKey_, *theBackboneTableGroupKey_, *theIterateTableGroupKey_;
739 std::string theConfigurationTableGroup_, theContextTableGroup_, theBackboneTableGroup_, theIterateTableGroup_;
741 theConfigurationTableGroup_ = activeConfigGroupName;
742 theConfigurationTableGroupKey_ = &(activeGroupKeys[activeConfigGroupName].second);
744 theContextTableGroup_ = activeContextGroupName;
745 theContextTableGroupKey_ = &(activeGroupKeys[activeContextGroupName].second);
747 theBackboneTableGroup_ = activeBackboneGroupName;
748 theBackboneTableGroupKey_ = &(activeGroupKeys[activeBackboneGroupName].second);
750 theIterateTableGroup_ = activeIterateGroupName;
751 theIterateTableGroupKey_ = &(activeGroupKeys[activeIterateGroupName].second);
755 __COUT__ <<
"Updating persistent active groups to " << ConfigurationManager::ACTIVE_GROUPS_FILENAME <<
" ..." << std::endl;
757 std::string fn = ConfigurationManager::ACTIVE_GROUPS_FILENAME;
758 FILE* fp = fopen(fn.c_str(),
"w");
762 fprintf(fp,
"%s\n", theContextTableGroup_.c_str());
763 fprintf(fp,
"%s\n", theContextTableGroupKey_ ? theContextTableGroupKey_->toString().c_str() :
"-1");
764 fprintf(fp,
"%s\n", theBackboneTableGroup_.c_str());
765 fprintf(fp,
"%s\n", theBackboneTableGroupKey_ ? theBackboneTableGroupKey_->toString().c_str() :
"-1");
766 fprintf(fp,
"%s\n", theConfigurationTableGroup_.c_str());
767 fprintf(fp,
"%s\n", theConfigurationTableGroupKey_ ? theConfigurationTableGroupKey_->toString().c_str() :
"-1");
768 fprintf(fp,
"%s\n", theIterateTableGroup_.c_str());
769 fprintf(fp,
"%s\n", theIterateTableGroupKey_ ? theIterateTableGroupKey_->toString().c_str() :
"-1");
776 std::cout <<
"\n\n" << __COUT_HDR_FL__ <<
"Resulting Groups:" << std::endl;
777 for(
const auto& group : groupSet)
778 __COUT__ <<
"\t" << group.first.first <<
": " << group.first.second <<
" => " << group.second << std::endl;
779 std::cout <<
"\n\n" << __COUT_HDR_FL__ <<
"Resulting Groups end." << std::endl;
783 std::cout <<
"\n\n" << __COUT_HDR_FL__ <<
"Resulting Active Groups:" << std::endl;
784 for(
const auto& activeGroup : activeGroupKeys)
785 __COUT__ <<
"\t" << activeGroup.first <<
": " << activeGroup.second.first <<
" => " << activeGroup.second.second << std::endl;
787 __COUT__ << activeBackboneGroupName <<
" is the " << ConfigurationManager::ACTIVE_GROUP_NAME_BACKBONE <<
"." << std::endl;
788 std::cout <<
"\n\n" << __COUT_HDR_FL__ <<
"Resulting Active Groups end." << std::endl;
792 std::cout <<
"\n\n" << __COUT_HDR_FL__ <<
"End of Flattening Active Table Groups!\n\n\n" << std::endl;
794 __COUT__ <<
"****************************" << std::endl;
795 __COUT__ <<
"There were " << groupSet.size() <<
" groups considered, and there were " << groupErrors.size() <<
" errors found handling those groups."
797 __COUT__ <<
"The following errors were found handling the groups:" << std::endl;
798 for(
auto& groupErr : groupErrors)
799 __COUT__ <<
"\t" << groupErr.first.first <<
" " << groupErr.first.second <<
": \t" << groupErr.second << std::endl;
800 __COUT__ <<
"End of errors.\n\n" << std::endl;
802 __COUT__ <<
"Run the following to return to your previous database structure:" << std::endl;
803 __COUT__ <<
"\t otsdaq_flatten_system_aliases -1 " << moveToDir <<
"\n\n" << std::endl;
807 FILE* fp = fopen((currentDir +
"/fromConfigurationToTableConversion").c_str(),
"w");
810 fprintf(fp,
"converted");
815 FILE* fp = fopen((currentDir +
"/fromConfigurationToTableConversion2").c_str(),
"w");
818 fprintf(fp,
"converted");
823 FILE* fp = fopen((currentDir +
"/artdaqDaqTableConversion").c_str(),
"w");
826 fprintf(fp,
"converted");
831 FILE* fp = fopen((currentDir +
"/fromIndexRebuild").c_str(),
"w");
834 fprintf(fp,
"rebuilt");
842 int main(
int argc,
char* argv[])
844 FlattenActiveSystemAliasTableGroups(argc, argv);