tdaq-develop-2025-02-12
TemplateTable_table.cc
1 #include "otsdaq/ConfigurationInterface/ConfigurationManager.h"
2 #include "otsdaq/Macros/TablePluginMacros.h"
3 #include "otsdaq/TablePlugins/TemplateTable.h"
4 
5 #include <iostream>
6 #include <string>
7 
8 using namespace ots;
9 
10 //==============================================================================
11 TemplateTable::TemplateTable(void) : TableBase("TemplateTable")
12 {
14  // WARNING: the field names used in C++ MUST match the Table INFO //
16 }
17 
18 //==============================================================================
19 TemplateTable::~TemplateTable(void) {}
20 
21 //==============================================================================
23 {
24  // use isFirstAppInContext to only run once per context, for example to avoid
25  // generating files on local disk multiple times.
26  bool isFirstAppInContext = configManager->isOwnerFirstAppInContext();
27 
28  __COUTV__(isFirstAppInContext);
29  // if(!isFirstAppInContext) return;
30 
31  // do something to validate or refactor table
32  __COUT__ << "*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*&*" << std::endl;
33  __COUT__ << configManager->__SELF_NODE__ << std::endl;
34 
35  // __COUT__ << configManager->getNode(this->getTableName()).getValueAsString()
36  // << std::endl;
37 
38  std::string value;
39  std::vector<std::pair<std::string, ConfigurationTree> > children =
40  configManager->__SELF_NODE__.getChildren();
41  for(auto& childPair : children)
42  {
43  // do something for each row in table
44  __COUT__ << childPair.first << std::endl;
45  __COUT__ << childPair.second.getNode(colNames_.colColumnName_) << std::endl;
46  childPair.second.getNode(colNames_.colColumnName_).getValue(value);
47  }
48 }
49 
50 DEFINE_OTS_TABLE(TemplateTable)
std::vector< std::pair< std::string, ConfigurationTree > > getChildren(std::map< std::string, TableVersion > *memberMap=0, std::string *accumulatedTreeErrors=0) const
void init(ConfigurationManager *configManager)
Methods.