1 #include "otsdaq-core/ConfigurationPluginDataFormats/IterateConfiguration.h"
2 #include "otsdaq-core/Macros/ConfigurationPluginMacros.h"
3 #include "otsdaq-core/ConfigurationInterface/ConfigurationManager.h"
12 const std::string IterateConfiguration::COMMAND_BEGIN_LABEL =
"BEGIN_LABEL";
13 const std::string IterateConfiguration::COMMAND_CHOOSE_FSM =
"CHOOSE_FSM";
14 const std::string IterateConfiguration::COMMAND_CONFIGURE_ACTIVE_GROUP =
"CONFIGURE_ACTIVE_GROUP";
15 const std::string IterateConfiguration::COMMAND_CONFIGURE_ALIAS =
"CONFIGURE_ALIAS";
16 const std::string IterateConfiguration::COMMAND_CONFIGURE_GROUP =
"CONFIGURE_GROUP";
17 const std::string IterateConfiguration::COMMAND_EXECUTE_FE_MACRO =
"EXECUTE_FE_MACRO";
18 const std::string IterateConfiguration::COMMAND_EXECUTE_MACRO =
"EXECUTE_MACRO";
19 const std::string IterateConfiguration::COMMAND_MODIFY_ACTIVE_GROUP =
"MODIFY_ACTIVE_GROUP";
20 const std::string IterateConfiguration::COMMAND_REPEAT_LABEL =
"REPEAT_LABEL";
21 const std::string IterateConfiguration::COMMAND_RUN =
"RUN";
23 const std::string IterateConfiguration::ITERATE_TABLE =
"IterateConfiguration";
24 const std::string IterateConfiguration::PLAN_TABLE =
"IterationPlanConfiguration";
25 const std::string IterateConfiguration::TARGET_TABLE =
"IterationTargetConfiguration";
27 const std::map<std::string,std::string> IterateConfiguration::commandToTableMap_ = IterateConfiguration::createCommandToTableMap();
49 IterateConfiguration::IterateConfiguration(
void)
55 IterateConfiguration::~IterateConfiguration(
void)
63 __COUT__ <<
"*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*" << std::endl;
64 __COUT__ << configManager->__SELF_NODE__ << std::endl;
67 auto childrenMap = configManager->__SELF_NODE__.getChildren();
68 for(
auto &childPair: childrenMap)
71 __COUT__ << childPair.first << std::endl;
78 std::vector<IterateConfiguration::Command> IterateConfiguration::getPlanCommands(
81 __COUT__ << configManager->__SELF_NODE__ << std::endl;
85 if(!planNode.getNode(IterateConfiguration::planTableCols_.Status_).getValue<
bool>())
87 __SS__ <<
"Error! Attempt to access disabled plan (Status=FALSE)." << std::endl;
88 __COUT_ERR__ << ss.str();
89 throw std::runtime_error(ss.str());
92 std::vector<IterateConfiguration::Command> commands;
94 auto commandChildren = planNode.getNode(
95 IterateConfiguration::iterateTableCols_.PlanLink_).getChildren();
97 for(
auto &commandChild: commandChildren)
99 __COUT__ <<
"Command \t" << commandChild.first << std::endl;
101 __COUT__ <<
"\t\tStatus \t" << commandChild.second.getNode(
102 IterateConfiguration::planTableCols_.Status_) << std::endl;
104 __COUT__ <<
"\t\tType \t" << commandChild.second.getNode(
105 IterateConfiguration::planTableCols_.CommandType_) << std::endl;
107 if(!commandChild.second.getNode(
108 IterateConfiguration::planTableCols_.Status_).getValue<
bool>())
112 commands.back().type_ = commandChild.second.getNode(
113 IterateConfiguration::planTableCols_.CommandType_).getValue<std::string>();
115 auto commandSpecificFields = commandChild.second.getNode(
116 IterateConfiguration::planTableCols_.CommandLink_).getChildren();
118 for(
unsigned int i=0; i<commandSpecificFields.size()-3; ++i)
120 __COUT__ <<
"\t\tParameter \t" << commandSpecificFields[i].first <<
" = \t" <<
121 commandSpecificFields[i].second << std::endl;
123 commands.back().params_.emplace(std::pair<
126 commandSpecificFields[i].first,
127 commandSpecificFields[i].second.getValueAsString()));