$treeview $search $mathjax $extrastylesheet
otsdaq
v2_03_00
$projectbrief
|
$projectbrief
|
$searchbox |
00001 #include <iostream> 00002 #include "otsdaq-core/ConfigurationPluginDataFormats/UDPDataListenerProducerTable.h" 00003 #include "otsdaq-coreMacros/TablePluginMacros.h" 00004 00005 using namespace ots; 00006 00007 //============================================================================== 00008 UDPDataListenerProducerConfiguration::UDPDataListenerProducerConfiguration(void) 00009 : TableBase("UDPDataListenerProducerConfiguration") 00010 { 00012 // WARNING: the names and the order MUST match the ones in the enum // 00014 // <?xml version="1.0" encoding="UTF-8" standalone="no" ?> 00015 // <ROOT xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 00016 // xsi:noNamespaceSchemaLocation="TableInfo.xsd"> <CONFIGURATION 00017 // Name="UDPDataListenerProducerConfiguration"> <VIEW 00018 // Name="UDP_DATA_LISTENER_PRODUCER_CONFIGURATION" Type="File,Database,DatabaseTest"> 00019 // <COLUMN Name="ProcessorID" StorageName="PROCESSOR_ID" DataType="VARCHAR2"/> 00020 // <COLUMN Name="BufferSize" StorageName="BUFFER_SIZE" DataType="NUMBER" /> 00021 // <COLUMN Name="IPAddress" StorageName="IP_ADDRESS" DataType="VARCHAR2"/> 00022 // <COLUMN Name="Port" StorageName="PORT" DataType="NUMBER" /> 00023 // </VIEW> 00024 // </CONFIGURATION> 00025 // </ROOT> 00026 } 00027 00028 //============================================================================== 00029 UDPDataListenerProducerConfiguration::~UDPDataListenerProducerConfiguration(void) {} 00030 00031 //============================================================================== 00032 void UDPDataListenerProducerConfiguration::init(ConfigurationManager* configManager) 00033 { 00034 std::string processorUID; 00035 for(unsigned int row = 0; row < TableBase::activeTableView_->getNumberOfRows(); row++) 00036 { 00037 TableBase::activeTableView_->getValue(processorUID, row, ProcessorID); 00038 processorIDToRowMap_[processorUID] = row; 00039 } 00040 } 00041 00042 //============================================================================== 00043 unsigned int UDPDataListenerProducerConfiguration::getBufferSize( 00044 std::string processorUID) const 00045 { 00046 check(processorUID); 00047 unsigned int val; 00048 TableBase::activeTableView_->getValue( 00049 val, processorIDToRowMap_.find(processorUID)->second, BufferSize); 00050 return val; 00051 } 00052 00053 //============================================================================== 00054 std::string UDPDataListenerProducerConfiguration::getIPAddress( 00055 std::string processorUID) const 00056 { 00057 check(processorUID); 00058 std::string val; 00059 TableBase::activeTableView_->getValue( 00060 val, processorIDToRowMap_.find(processorUID)->second, IPAddress); 00061 return val; 00062 } 00063 00064 //============================================================================== 00065 unsigned int UDPDataListenerProducerConfiguration::getPort(std::string processorUID) const 00066 { 00067 check(processorUID); 00068 unsigned int val; 00069 TableBase::activeTableView_->getValue( 00070 val, processorIDToRowMap_.find(processorUID)->second, Port); 00071 return val; 00072 } 00073 00074 //============================================================================== 00075 void UDPDataListenerProducerConfiguration::check(std::string processorUID) const 00076 { 00077 if(processorIDToRowMap_.find(processorUID) == processorIDToRowMap_.end()) 00078 { 00079 std::cout << __COUT_HDR_FL__ << "Couldn't find processor " << processorUID 00080 << " in the UDPDataStreamerConsumerConfiguration!" << std::endl; 00081 assert(0); 00082 } 00083 } 00084 00085 DEFINE_OTS_CONFIGURATION(UDPDataListenerProducerConfiguration)