otsdaq_components  v2_05_02_indev
FEOtsUDPLCLS2InterfaceTable_table.cc
1 #include <iostream>
2 #include "otsdaq/TablePlugins/DataManagerTable.h"
3 
4 #include "otsdaq-components/UserTableDataFormats/FEOtsUDPLCLS2InterfaceTable.h"
5 #include "otsdaq/Macros/TablePluginMacros.h"
6 
7 using namespace ots;
8 
9 //==============================================================================
10 FEOtsUDPLCLS2InterfaceTable::FEOtsUDPLCLS2InterfaceTable(void)
11  : FEInterfaceTableBase("FEOtsUDPLCLS2InterfaceTable")
12 {
14  // WARNING: the names and the order MUST match the ones in the enum //
16  // FEOtsUDPLCLS2InterfaceTableInfo.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 FEOtsUDPLCLS2InterfaceTable::~FEOtsUDPLCLS2InterfaceTable(void) {}
46 
47 //==============================================================================
48 void FEOtsUDPLCLS2InterfaceTable::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 FEOtsUDPLCLS2InterfaceTable::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 FEOtsUDPLCLS2InterfaceTable::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 FEOtsUDPLCLS2InterfaceTable::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 FEOtsUDPLCLS2InterfaceTable::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 FEOtsUDPLCLS2InterfaceTable::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 FEOtsUDPLCLS2InterfaceTable::getInterfacePort(std::string interfaceID) const
119 {
120  unsigned int tmpInterfacePort;
121  TableBase::activeTableView_->getValue(
122  tmpInterfacePort,
123  TableBase::activeTableView_->findRow(InterfaceID, interfaceID),
124  InterfacePort);
125  return tmpInterfacePort;
126 }
127 
128 //==============================================================================
129 std::string FEOtsUDPLCLS2InterfaceTable::getStreamingIPAddress(
130  std::string interfaceID) const
131 {
132  std::string tmpStreamingIPAddress;
133  TableBase::activeTableView_->getValue(
134  tmpStreamingIPAddress,
135  TableBase::activeTableView_->findRow(InterfaceID, interfaceID),
136  StreamingIPAddress);
137  return tmpStreamingIPAddress;
138 }
139 
140 //==============================================================================
141 unsigned int FEOtsUDPLCLS2InterfaceTable::getStreamingPort(std::string interfaceID) const
142 {
143  unsigned int tmpStreamingPort;
144  TableBase::activeTableView_->getValue(
145  tmpStreamingPort,
146  TableBase::activeTableView_->findRow(InterfaceID, interfaceID),
147  StreamingPort);
148  return tmpStreamingPort;
149 }
150 
151 //==============================================================================
152 int FEOtsUDPLCLS2InterfaceTable::getNumberOfWords(std::string interfaceID) const
153 {
154  unsigned int tmpStreamingPort;
155  TableBase::activeTableView_->getValue(
156  tmpStreamingPort,
157  TableBase::activeTableView_->findRow(InterfaceID, interfaceID),
158  NumberOfWords);
159  return tmpStreamingPort;
160 }
161 
162 //==============================================================================
163 unsigned int FEOtsUDPLCLS2InterfaceTable::getDataRate(std::string interfaceID) const
164 {
165  unsigned int tmpStreamingPort;
166  TableBase::activeTableView_->getValue(
167  tmpStreamingPort,
168  TableBase::activeTableView_->findRow(InterfaceID, interfaceID),
169  DataRate);
170  return tmpStreamingPort;
171 }
172 
173 DEFINE_OTS_TABLE(FEOtsUDPLCLS2InterfaceTable)