#include "FERODBFieldPositions.h" //=========================================================================== FecFieldPositions::FecFieldPositions() { // // This class shows the positions of the various fields of the FEC Table in the // Oracle TPC Configuration DB. // int32_t position = 0; id = position++; // 0 BranchPosition = position++; // 1 Position = position++; // 2 ON_FEC = position++; // 3 SAMPA_MASK = position++; // 4 SAMPA_ANA_CFG = position++; // 5 SAMPA_CLK_CFG = position++; // 6 GBTX0_SAMPLINGPHASE_G0_CH0 = position++; // 7 GBTX0_SAMPLINGPHASE_G0_CH2 = position++; // 8 GBTX0_SAMPLINGPHASE_G0_CH4 = position++; // 9 GBTX0_SAMPLINGPHASE_G0_CH6 = position++; // 10 GBTX0_SAMPLINGPHASE_G1_CH0 = position++; // 11 GBTX0_SAMPLINGPHASE_G1_CH2 = position++; // 12 GBTX0_SAMPLINGPHASE_G1_CH4 = position++; // 13 GBTX0_SAMPLINGPHASE_G1_CH6 = position++; // 14 GBTX0_SAMPLINGPHASE_G2_CH0 = position++; // 15 GBTX0_SAMPLINGPHASE_G2_CH2 = position++; // 16 GBTX0_SAMPLINGPHASE_G2_CH4 = position++; // 17 GBTX0_SAMPLINGPHASE_G2_CH6 = position++; // 18 GBTX0_SAMPLINGPHASE_G3_CH0 = position++; // 19 GBTX0_SAMPLINGPHASE_G3_CH2 = position++; // 20 GBTX0_SAMPLINGPHASE_G3_CH4 = position++; // 21 GBTX0_SAMPLINGPHASE_G3_CH6 = position++; // 22 GBTX0_SAMPLINGPHASE_G4_CH0 = position++; // 23 GBTX0_SAMPLINGPHASE_G4_CH2 = position++; // 24 GBTX0_SAMPLINGPHASE_G4_CH4 = position++; // 25 GBTX0_SAMPLINGPHASE_G4_CH6 = position++; // 26 GBTX0_SAMPLINGPHASE_G5_CH1 = position++; // 27 GBTX0_SAMPLINGPHASE_G5_CH3 = position++; // 28 GBTX0_SAMPLINGPHASE_G5_CH5 = position++; // 29 GBTX0_SAMPLINGPHASE_G5_CH7 = position++; // 30 GBTX0_SAMPLINGPHASE_G6_CH1 = position++; // 31 GBTX0_SAMPLINGPHASE_G6_CH3 = position++; // 32 GBTX0_SAMPLINGPHASE_G6_CH5 = position++; // 33 GBTX0_SAMPLINGPHASE_G6_CH7 = position++; // 34 fSize = position; fColNames.push_back("id"); fColNames.push_back("BranchPosition"); fColNames.push_back("Position"); fColNames.push_back("ON_FEC"); fColNames.push_back("SAMPA_MASK"); fColNames.push_back("SAMPA_ANA_CFG"); fColNames.push_back("SAMPA_CLK_CFG"); fColNames.push_back("GBTX0_SAMPLINGPHASE_G0_CH0"); fColNames.push_back("GBTX0_SAMPLINGPHASE_G0_CH2"); fColNames.push_back("GBTX0_SAMPLINGPHASE_G0_CH4"); fColNames.push_back("GBTX0_SAMPLINGPHASE_G0_CH6"); fColNames.push_back("GBTX0_SAMPLINGPHASE_G1_CH0"); fColNames.push_back("GBTX0_SAMPLINGPHASE_G1_CH2"); fColNames.push_back("GBTX0_SAMPLINGPHASE_G1_CH4"); fColNames.push_back("GBTX0_SAMPLINGPHASE_G1_CH6"); fColNames.push_back("GBTX0_SAMPLINGPHASE_G2_CH0"); fColNames.push_back("GBTX0_SAMPLINGPHASE_G2_CH2"); fColNames.push_back("GBTX0_SAMPLINGPHASE_G2_CH4"); fColNames.push_back("GBTX0_SAMPLINGPHASE_G2_CH6"); fColNames.push_back("GBTX0_SAMPLINGPHASE_G3_CH0"); fColNames.push_back("GBTX0_SAMPLINGPHASE_G3_CH2"); fColNames.push_back("GBTX0_SAMPLINGPHASE_G3_CH4"); fColNames.push_back("GBTX0_SAMPLINGPHASE_G3_CH6"); fColNames.push_back("GBTX0_SAMPLINGPHASE_G4_CH0"); fColNames.push_back("GBTX0_SAMPLINGPHASE_G4_CH2"); fColNames.push_back("GBTX0_SAMPLINGPHASE_G4_CH4"); fColNames.push_back("GBTX0_SAMPLINGPHASE_G4_CH6"); fColNames.push_back("GBTX0_SAMPLINGPHASE_G5_CH1"); fColNames.push_back("GBTX0_SAMPLINGPHASE_G5_CH3"); fColNames.push_back("GBTX0_SAMPLINGPHASE_G5_CH5"); fColNames.push_back("GBTX0_SAMPLINGPHASE_G5_CH7"); fColNames.push_back("GBTX0_SAMPLINGPHASE_G6_CH1"); fColNames.push_back("GBTX0_SAMPLINGPHASE_G6_CH3"); fColNames.push_back("GBTX0_SAMPLINGPHASE_G6_CH5"); fColNames.push_back("GBTX0_SAMPLINGPHASE_G6_CH7"); if ( fColNames.size() != fSize ) cerr << "Error in FecFieldPositions constructor. Strange number of columns." << endl; } //=========================================================================== string FecFieldPositions::getColName(int32_t i) { // Return the names of the columns return fColNames[i]; } //=========================================================================== int32_t FecFieldPositions::getPosition(string colName) { // Find the column number (Position) of the column with name colName. for ( uint32_t i=0; i < fColNames.size(); i++ ) { if ( colName.compare(fColNames.at(i) ) == 0) { return i; } } return -1; } //=========================================================================== FecFieldPositions::~FecFieldPositions() { } //=========================================================================== //=========================================================================== //=========================================================================== //=========================================================================== //=========================================================================== //=========================================================================== UlFieldPositions::UlFieldPositions() { // // This class shows the positions of the various fields of the UL config // tables in the Oracle TPC Configuration DB. // int32_t position = 0; id = position++; // 0 BranchPosition = position++; // 1 Position = position++; // 2 for(int32_t pos = 0; pos < 80; pos++){ VAL[pos] = position++; // 3-83 } fSize = position; char carry[40]; fColNames.push_back("id"); fColNames.push_back("BranchPosition"); fColNames.push_back("Position"); for(int32_t pos = 0; pos < 80; pos++){ sprintf(carry, "VAL%02d", pos); fColNames.push_back(carry); } if ( fColNames.size() != fSize ) cerr << "Error in UlFieldPositions constructor. Strange number of columns." << endl; } //=========================================================================== string UlFieldPositions::getColName(int32_t i) { // Return the names of the columns return fColNames[i]; } //=========================================================================== int32_t UlFieldPositions::getPosition(string colName) { // Find the column number (Position) of the column with name colName. for ( uint32_t i=0; i < fColNames.size(); i++ ) { if ( colName.compare(fColNames.at(i) ) == 0) { return i; } } return -1; } //=========================================================================== UlFieldPositions::~UlFieldPositions() { } //=========================================================================== //=========================================================================== //=========================================================================== //=========================================================================== //=========================================================================== //=========================================================================== PartitionFieldPositions::PartitionFieldPositions() { // // This class shows the positions of the various fields of the PARTITION Table in the // Oracle TPC Configuration DB. // int32_t position = 0; id = position++; // 0 Position = position++; // 1 ON_PARTITION = position++; // 2 fSize = position; fColNames.push_back("id"); fColNames.push_back("Position"); fColNames.push_back("ON_PARTITION"); if ( fColNames.size() != fSize ) cerr << "Error in PartitionFieldPositions constructor. Strange number of columns." << endl; } //=========================================================================== string PartitionFieldPositions::getColName(int32_t i) { // Return the names of the columns return fColNames[i]; } //=========================================================================== int32_t PartitionFieldPositions::getPosition(string colName) { // Find the column number (Position) of the column with name colName. for ( uint32_t i=0; i < fColNames.size(); i++ ) { if ( colName.compare(fColNames.at(i) ) == 0) { return i; } } return -1; } //=========================================================================== PartitionFieldPositions::~PartitionFieldPositions() { } //=========================================================================== //=========================================================================== //=========================================================================== //=========================================================================== //=========================================================================== //=========================================================================== CruFieldPositions::CruFieldPositions() { // // This class shows the positions of the various fields of the CRU Table in the // Oracle TPC Configuration DB. // int32_t position = 0; id = position++; // 0 Position = position++; // 1 ON_CRU = position++; // 2 GFD_LINK_ACTIVE = position++; // 3 GFD_STRICT_SYNC = position++; // 4 GFD_ENABLE_MASK = position++; // 5 for(int32_t pos = 0; pos < 24; pos++){ GFD_STREAM_MASK[pos] = position++; // 6-29 } ON_LINK = position++; // 30 LINK_SELECTOR_A = position++; // 31 LINK_SELECTOR_B = position++; // 32 ZS_EN = position++; // 33 TRG_WINDOW_SIZE = position++; // 34 MAX_PAYLOAD_SIZE = position++; // 35 SUPPRESS_HBR = position++; // 36 USE_LINK_ID_15 = position++; // 37 ITCORR0 = position++; // 38 ITF_EN = position++; // 39 CMC_EN = position++; // 40 OFFSET = position++; // 41 RESYNC_EN = position++; // 42 BC_EN = position++; // 43 CMC_THRESH1 = position++; // 44 CMC_MIN_MATCHES = position++; // 45 CMC_MATCH_DISTANCE = position++; // 46 CMC_WRITEOUT_EN = position++; // 47 fSize = position; char carry[40]; fColNames.push_back("id"); fColNames.push_back("Position"); fColNames.push_back("ON_CRU"); fColNames.push_back("GFD_LINK_ACTIVE"); fColNames.push_back("GFD_STRICT_SYNC"); fColNames.push_back("GFD_ENABLE_MASK"); for(int32_t pos = 0; pos < 24; pos++){ sprintf(carry, "GFD_STREAM_MASK_%02d", pos); fColNames.push_back(carry); } fColNames.push_back("ON_LINK"); fColNames.push_back("LINK_SELECTOR_A"); fColNames.push_back("LINK_SELECTOR_B"); fColNames.push_back("ZS_EN"); fColNames.push_back("TRG_WINDOW_SIZE"); fColNames.push_back("MAX_PAYLOAD_SIZE"); fColNames.push_back("SUPPRESS_HBR"); fColNames.push_back("USE_LINK_ID_15"); fColNames.push_back("ITCORR0"); fColNames.push_back("ITF_EN"); fColNames.push_back("CMC_EN"); fColNames.push_back("OFFSET"); fColNames.push_back("RESYNC_EN"); fColNames.push_back("BC_EN"); fColNames.push_back("CMC_THRESH1"); fColNames.push_back("CMC_MIN_MATCHES"); fColNames.push_back("CMC_MATCH_DISTANCE"); fColNames.push_back("CMC_WRITEOUT_EN"); if ( fColNames.size() != fSize ) cerr << "Error in CruFieldPositions constructor. Strange number of columns." << endl; } //=========================================================================== string CruFieldPositions::getColName(int32_t i) { // Return the names of the columns return fColNames[i]; } //=========================================================================== int32_t CruFieldPositions::getPosition(string colName) { // Find the column number (Position) of the column with name colName. for ( uint32_t i=0; i < fColNames.size(); i++ ) { if ( colName.compare(fColNames.at(i) ) == 0) { return i; } } return -1; } //=========================================================================== CruFieldPositions::~CruFieldPositions() { } //=========================================================================== //=========================================================================== //=========================================================================== //=========================================================================== //=========================================================================== //=========================================================================== TpcFieldPositions::TpcFieldPositions( ) { // // This class shows the positions of the fields of the TPC Table in the // Oracle TPC Configuration DB. // int32_t position = 0; id = position++; // 0 Created = position++; // 1 Updated = position++; // 2 Revision = position++; // 3 Comment = position++; // 4 fSize = position; fColNames.push_back("Id"); fColNames.push_back("Created"); fColNames.push_back("Updated"); fColNames.push_back("Revision"); fColNames.push_back("Comment"); } //=========================================================================== string TpcFieldPositions::getColName(int32_t i) { // Return the names of the columns return fColNames[i]; } //=========================================================================== bool TpcFieldPositions::isDate(int32_t i) { if ( (i>0) && (i<3)) return true; else return false; } //=========================================================================== bool TpcFieldPositions::isString(int32_t i) { if (i==4) return true; else return false; } //=========================================================================== bool TpcFieldPositions::isNumber(int32_t i) { if ((i==0) || (i==3)) return true; else return false; } //=========================================================================== int32_t TpcFieldPositions::getPosition(string colName) { // Find the column number (Position) of the column with name colName. for ( uint32_t i=0; i < fColNames.size(); i++ ) { if ( colName.compare(fColNames.at(i) ) == 0) { return i; } } return -1; } //=========================================================================== TpcFieldPositions::~TpcFieldPositions() { } //=========================================================================== //=========================================================================== //=========================================================================== //=========================================================================== //=========================================================================== //=========================================================================== FERODBFieldPositions::FERODBFieldPositions( ) { // // This class shows the column positions of the result of the query // to the TPC FERO config database to get the configuration data. // UlTable = new UlFieldPositions(); FecTable = new FecFieldPositions(); CruTable = new CruFieldPositions(); PartitionTable = new PartitionFieldPositions(); TpcTable = new TpcFieldPositions(); } FERODBFieldPositions::~FERODBFieldPositions() { delete UlTable; delete CruTable; delete FecTable; delete PartitionTable; delete TpcTable; UlTable = 0; CruTable = 0; FecTable = 0; PartitionTable = 0; TpcTable = 0; }