otsdaq_components  v2_05_02_indev
FEOtsUDPTemplateInterfaceTable_table.cc
1 #include <iostream>
2 #include "otsdaq/TablePlugins/DataManagerTable.h"
3 
4 #include "otsdaq-components/UserTableDataFormats/FEOtsUDPTemplateInterfaceTable.h"
5 #include "otsdaq/Macros/TablePluginMacros.h"
6 
7 using namespace ots;
8 
9 //==============================================================================
10 FEWROtsUDPTemplateInterfaceTable::FEWROtsUDPTemplateInterfaceTable(void)
11  : FEInterfaceTableBase("FEWROtsUDPTemplateInterfaceTable")
12 {
14  // WARNING: the names and the order MUST match the ones in the enum //
16  // FEWROtsUDPTemplateInterfaceTableInfo.xml
17  //<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
18  //<ROOT xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
19  // xsi:noNamespaceSchemaLocation="TableInfo.xsd">
20  // <TABLE InterfaceID="FEWRPurdueFSSRInterfaceTable">
21  // <VIEW InterfaceID="FEWR_PURDUE_FSSR_INTERFACE_TABLE"
22  // Type="File,Database,DatabaseTest">
23  // <COLUMN NAME="InterfaceID" StorageName="INTERFACE_ID"
24  // DataType="VARCHAR2" /> <COLUMN InterfaceID="Status"
25  // StorageName="STATUS" DataType="VARCHAR2"/> <COLUMN
26  // InterfaceID="FirmwareVersion" StorageName="FIRMWARE_VERSION"
27  // DataType="NUMBER" /> <COLUMN InterfaceID="IPAddress"
28  // StorageName="IP_ADDRESS" DataType="VARCHAR2"/> <COLUMN
29  // InterfaceID="Port" StorageName="PORT" DataType="NUMBER" />
30  // <COLUMN InterfaceID="InterfaceIPAddress" StorageName="INTERFACE_IP_ADDRESS"
31  // DataType="VARCHAR2"/> <COLUMN InterfaceID="InterfacePort"
32  // StorageName="INTERFACE_PORT" DataType="NUMBER" /> <COLUMN
33  // InterfaceID="StreamingIPAddress" StorageName="STREAMING_IP_ADDRESS"
34  // DataType="VARCHAR2"/> <COLUMN InterfaceID="StreamingPort"
35  // StorageName="STREAMING_PORT" DataType="NUMBER" /> <COLUMN
36  // InterfaceID="NumberOfWords" StorageName="NUMBER_OF_WORDS"
37  // DataType="NUMBER" /> <COLUMN InterfaceID="DataRate"
38  // StorageName="DATA_RATE" DataType="NUMBER" />
39  // </VIEW>
40  // </TABLE>
41  //</ROOT>
42 }
43 
44 //==============================================================================
45 FEWROtsUDPTemplateInterfaceTable::~FEWROtsUDPTemplateInterfaceTable(void) {}
46 
47 //==============================================================================
48 void FEWROtsUDPTemplateInterfaceTable::init(ConfigurationManager* configManager)
49 {
50  /*
51  std::string enumValue1;
52  unsigned int enumValue2;
53  for(unsigned int row=0; row<TableBase::tableData_.getNumberOfRows();
54  row++)
55  {
56  TableBase::tableData_.getValue(enumValue1,row,Enum1);
57  TableBase::tableData_.getValue(enumValue2,row,Enum2);
58  }
59  */
60 }
61 
62 //==============================================================================
63 bool FEWROtsUDPTemplateInterfaceTable::getStatus(std::string interfaceID) const
64 {
65  bool tmpStatus;
66  TableBase::activeTableView_->getValue(
67  tmpStatus,
68  TableBase::activeTableView_->findRow(InterfaceID, interfaceID),
69  Status);
70  return tmpStatus;
71 }
72 
73 //==============================================================================
74 unsigned int FEWROtsUDPTemplateInterfaceTable::getFirmwareVersion(
75  std::string interfaceID) const
76 {
77  unsigned int tmpFirmwareVersion;
78  TableBase::activeTableView_->getValue(
79  tmpFirmwareVersion,
80  TableBase::activeTableView_->findRow(InterfaceID, interfaceID),
81  FirmwareVersion);
82  return tmpFirmwareVersion;
83 }
84 
85 //==============================================================================
86 std::string FEWROtsUDPTemplateInterfaceTable::getIPAddress(std::string interfaceID) const
87 {
88  std::string tmpIPAddress;
89  TableBase::activeTableView_->getValue(
90  tmpIPAddress,
91  TableBase::activeTableView_->findRow(InterfaceID, interfaceID),
92  IPAddress);
93  return tmpIPAddress;
94 }
95 
96 //==============================================================================
97 unsigned int FEWROtsUDPTemplateInterfaceTable::getPort(std::string interfaceID) const
98 {
99  unsigned int tmpPort;
100  TableBase::activeTableView_->getValue(
101  tmpPort, TableBase::activeTableView_->findRow(InterfaceID, interfaceID), Port);
102  return tmpPort;
103 }
104 
105 //==============================================================================
106 std::string FEWROtsUDPTemplateInterfaceTable::getInterfaceIPAddress(
107  std::string interfaceID) const
108 {
109  std::string tmpInterfaceIPAddress;
110  TableBase::activeTableView_->getValue(
111  tmpInterfaceIPAddress,
112  TableBase::activeTableView_->findRow(InterfaceID, interfaceID),
113  InterfaceIPAddress);
114  return tmpInterfaceIPAddress;
115 }
116 
117 //==============================================================================
118 unsigned int FEWROtsUDPTemplateInterfaceTable::getInterfacePort(
119  std::string interfaceID) const
120 {
121  unsigned int tmpInterfacePort;
122  TableBase::activeTableView_->getValue(
123  tmpInterfacePort,
124  TableBase::activeTableView_->findRow(InterfaceID, interfaceID),
125  InterfacePort);
126  return tmpInterfacePort;
127 }
128 
129 //==============================================================================
130 std::string FEWROtsUDPTemplateInterfaceTable::getStreamingIPAddress(
131  std::string interfaceID) const
132 {
133  std::string tmpStreamingIPAddress;
134  TableBase::activeTableView_->getValue(
135  tmpStreamingIPAddress,
136  TableBase::activeTableView_->findRow(InterfaceID, interfaceID),
137  StreamingIPAddress);
138  return tmpStreamingIPAddress;
139 }
140 
141 //==============================================================================
142 unsigned int FEWROtsUDPTemplateInterfaceTable::getStreamingPort(
143  std::string interfaceID) const
144 {
145  unsigned int tmpStreamingPort;
146  TableBase::activeTableView_->getValue(
147  tmpStreamingPort,
148  TableBase::activeTableView_->findRow(InterfaceID, interfaceID),
149  StreamingPort);
150  return tmpStreamingPort;
151 }
152 
153 //==============================================================================
154 int FEWROtsUDPTemplateInterfaceTable::getNumberOfWords(std::string interfaceID) const
155 {
156  unsigned int tmpStreamingPort;
157  TableBase::activeTableView_->getValue(
158  tmpStreamingPort,
159  TableBase::activeTableView_->findRow(InterfaceID, interfaceID),
160  NumberOfWords);
161  return tmpStreamingPort;
162 }
163 
164 //==============================================================================
165 unsigned int FEWROtsUDPTemplateInterfaceTable::getDataRate(std::string interfaceID) const
166 {
167  unsigned int tmpStreamingPort;
168  TableBase::activeTableView_->getValue(
169  tmpStreamingPort,
170  TableBase::activeTableView_->findRow(InterfaceID, interfaceID),
171  DataRate);
172  return tmpStreamingPort;
173 }
174 
175 DEFINE_OTS_TABLE(FEWROtsUDPTemplateInterfaceTable)