otsdaq  v2_05_02_indev
IterateTable.h
1 #ifndef _ots_IterateTable_h_
2 #define _ots_IterateTable_h_
3 
4 #include "otsdaq/TableCore/TableBase.h"
5 
6 namespace ots
7 {
8 class IterateTable : public TableBase
9 {
10  public:
11  IterateTable(void);
12  virtual ~IterateTable(void);
13 
14  // Methods
15  void init(ConfigurationManager* configManager);
16 
17  // Getters
18 
20  {
21  std::string table_;
22  std::string UID_;
23  };
24 
25  struct Command
26  {
27  void addTarget() { targets_.push_back(CommandTarget()); }
28  std::string type_;
29  std::vector<CommandTarget> targets_;
30  std::map<std::string /*param name*/, std::string /*param value*/> params_;
31  };
32 
33  std::vector<IterateTable::Command> getPlanCommands(ConfigurationManager* configManager, const std::string& plan) const;
34 
35  static const std::string COMMAND_BEGIN_LABEL;
36  static const std::string COMMAND_CHOOSE_FSM;
37  static const std::string COMMAND_CONFIGURE_ACTIVE_GROUP;
38  static const std::string COMMAND_CONFIGURE_ALIAS;
39  static const std::string COMMAND_CONFIGURE_GROUP;
40  static const std::string COMMAND_EXECUTE_FE_MACRO;
41  static const std::string COMMAND_EXECUTE_MACRO;
42  static const std::string COMMAND_MODIFY_ACTIVE_GROUP;
43  static const std::string COMMAND_REPEAT_LABEL;
44  static const std::string COMMAND_RUN;
45 
46  static const std::string ITERATE_TABLE;
47  static const std::string PLAN_TABLE;
48  static const std::string TARGET_TABLE;
49 
50  static const std::map<std::string, std::string> commandToTableMap_;
51  static std::map<std::string, std::string> createCommandToTableMap()
52  {
53  std::map<std::string, std::string> m;
54  m[COMMAND_BEGIN_LABEL] = "IterationCommandBeginLabelTable";
55  m[COMMAND_CHOOSE_FSM] = "IterationCommandChooseFSMTable";
56  m[COMMAND_CONFIGURE_ACTIVE_GROUP] = ""; // no parameters
57  m[COMMAND_CONFIGURE_ALIAS] = "IterationCommandConfigureAliasTable";
58  m[COMMAND_CONFIGURE_GROUP] = "IterationCommandConfigureGroupTable";
59  m[COMMAND_EXECUTE_FE_MACRO] = "IterationCommandExecuteFEMacroTable";
60  m[COMMAND_EXECUTE_MACRO] = "IterationCommandExecuteMacroTable";
61  m[COMMAND_MODIFY_ACTIVE_GROUP] = "IterationCommandModifyGroupTable";
62  m[COMMAND_REPEAT_LABEL] = "IterationCommandRepeatLabelTable";
63  m[COMMAND_RUN] = "IterationCommandRunTable";
64  return m;
65  }
66 
68  {
69  const std::string Label_ = "Label";
70  } commandBeginLabelParams_;
71  static struct CommandChooseFSMParams
72  {
73  const std::string NameOfFSM_ = "NameOfStateMachine"; // by default ""
74  } commandChooseFSMParams_;
76  {
77  // no parameters
78  } commandConfigureActiveParams_;
80  {
81  const std::string SystemAlias_ = "SystemAlias";
82  } commandConfigureAliasParams_;
84  {
85  const std::string GroupName_ = "GroupName";
86  const std::string GroupKey_ = "GroupKey";
87  } commandConfigureGroupParams_;
88  static struct CommandExecuteMacroParams // treat FE and Macro the same
89  {
90  // targets
91  const std::string MacroName_ = "MacroName";
92  const std::string MacroParameterLink_ = "LinkToMacroDimensionalLoopTable";
93  const std::string EnableSavingOutput_ = "EnableSavingOutputsToFile";
94  const std::string OutputFilePath_ = "OutputFilePath";
95  const std::string OutputFileRadix_ = "OutputFileRadix";
96 
97  const std::string MacroArgumentString_ = "MacroArgumentString";
98 
99  // macro parameters
100  } commandExecuteMacroParams_;
102  {
103  // targets
104  const std::string DoTrackGroupChanges_ = "DoTrackGroupChanges";
105  const std::string RelativePathToField_ = "RelativePathToField";
106  const std::string FieldStartValue_ = "FieldStartValue";
107  const std::string FieldIterationStepSize_ = "FieldIterationStepSize";
108  } commandModifyActiveParams_;
110  {
111  const std::string Label_ = "Label";
112  const std::string NumberOfRepetitions_ = "NumberOfRepetitions";
113  } commandRepeatLabelParams_;
114  static struct CommandRunParams
115  {
116  const std::string WaitOnRunningThreads_ = "WaitForAllFrontEndsRunningThread";
117  const std::string DurationInSeconds_ = "DurationInSeconds";
118  } commandRunParams_;
119 
120  // for targets
121  static struct TargetParams
122  {
123  const std::string Tables_ = "CSVTargetTables";
124  const std::string UIDs_ = "CSVTargetUIDs";
125  } targetParams_;
126  static struct CommandTargetColumns
127  {
128  const std::string TargetsLink_ = "LinkToTargets";
129  const std::string TargetsLinkGroupID_ = "LinkToTargetsGroupID";
130 
131  } commandTargetCols_;
132  static struct TargetTableColumns
133  {
134  const std::string GroupID_ = "IterationTargetGroupID";
135  const std::string TargetLink_ = "LinkToTarget";
136  const std::string TargetLinkUID_ = "LinkToTargetUID";
137  } targetCols_;
138 
139  // for macro dimensional loop parameters
141  {
142  const std::string Priority_ = "DimensionalLoopPriority";
143  const std::string NumberOfIterations_ = "NumberOfIterations";
144  const std::string ParamLink_ = "LinkToDimensionalLoopParameterTable";
145  } macroDimLoopCols_;
147  {
148  const std::string Name_ = "ParameterName";
149  const std::string Value_ = "ParameterInitialValue";
150  const std::string Step_ = "ParameterStepSize";
151 
152  } macroParamCols_;
153 
154  // Table hierarchy is as follows:
155  // Iterate
156  // |- Plan
157  // |-Command Type 1
158  // |-Command Type 2 ...
159  // |-Command Type n
160 
161  // Column names
162 
163  static struct IterateTableColumns
164  {
165  const std::string PlanLink_ = "LinkToIterationPlanTable";
166  } iterateTableCols_;
167 
168  static struct PlanTableColumns
169  {
170  const std::string Status_ = TableViewColumnInfo::COL_NAME_STATUS;
171  const std::string GroupID_ = "IterationPlanGroupID";
172  const std::string CommandLink_ = "LinkToCommandUID";
173  const std::string CommandType_ = "CommandType";
174  } planTableCols_;
175 };
176 } // namespace ots
177 #endif