CGEM BOSS 6.6.5.f
BESIII Offline Software System
Loading...
Searching...
No Matches
rdbModel::Rdb Class Reference

#include <Rdb.h>

Public Member Functions

virtual ~Rdb ()
 
 Rdb ()
 
unsigned getMajorVersion ()
 
unsigned getMinorVersion ()
 
const std::string & getCVSid ()
 
const std::string & getDbName ()
 
TablegetTable (const std::string &name) const
 
ColumngetColumn (const std::string &tableName, const std::string &colName) const
 
IndexgetIndex (const std::string &tableName, const std::string &indexName) const
 
unsigned int getNTable () const
 
void setConnection (Connection *connection)
 
int insertRow (const std::string &tName, Row &row, int *serial=0) const
 
int insertLatest (Table *t, Row &row, int *serial=0) const
 
int insertLatest (const std::string &tName, Row &row, int *serial=0) const
 
int supersedeRow (const std::string &tName, Row &row, int oldKey, int *newKey=0) const
 
int updateRows (const std::string &tName, Row &row, Assertion *where) const
 
unsigned int accept (Visitor *v)
 This is the recursive accept for the visitor pattern.
 
virtual ~Rdb ()
 
 Rdb ()
 
unsigned getMajorVersion ()
 
unsigned getMinorVersion ()
 
const std::string & getCVSid ()
 
const std::string & getDbName ()
 
TablegetTable (const std::string &name) const
 
ColumngetColumn (const std::string &tableName, const std::string &colName) const
 
IndexgetIndex (const std::string &tableName, const std::string &indexName) const
 
unsigned int getNTable () const
 
void setConnection (Connection *connection)
 
int insertRow (const std::string &tName, Row &row, int *serial=0) const
 
int insertLatest (Table *t, Row &row, int *serial=0) const
 
int insertLatest (const std::string &tName, Row &row, int *serial=0) const
 
int supersedeRow (const std::string &tName, Row &row, int oldKey, int *newKey=0) const
 
int updateRows (const std::string &tName, Row &row, Assertion *where) const
 
unsigned int accept (Visitor *v)
 This is the recursive accept for the visitor pattern.
 

Friends

class rdbModel::XercesBuilder
 

Detailed Description

This is the main container of all the rdb description. The Manager is responsible for its creation and destruction. Provide both a query interface (provide various functions to look up components by name) and also accept visitors.

Adapted from detModel::Gdd class, written by R. Giannitrapani and D. Favretto

Author
J. Bogart

Definition at line 41 of file Calibration/rdbModel/rdbModel-00-01-01/rdbModel/Rdb.h.

Constructor & Destructor Documentation

◆ ~Rdb() [1/2]

rdbModel::Rdb::~Rdb ( )
virtual

This is the destructor; it should be called only by the manager destructor. It starts the destruction of all the objects created by the builder

Definition at line 8 of file Rdb.cxx.

8 {
9 while (m_tables.size() ) {
10 Table* table = m_tables.back();
11 m_tables.pop_back();
12 delete table;
13 }
14 }

◆ Rdb() [1/2]

rdbModel::Rdb::Rdb ( )
inline

Definition at line 48 of file Calibration/rdbModel/rdbModel-00-01-01/rdbModel/Rdb.h.

48: m_connection(0) { }

◆ ~Rdb() [2/2]

virtual rdbModel::Rdb::~Rdb ( )
virtual

This is the destructor; it should be called only by the manager destructor. It starts the destruction of all the objects created by the builder

◆ Rdb() [2/2]

rdbModel::Rdb::Rdb ( )
inline

Definition at line 48 of file InstallArea/include/rdbModel/rdbModel/Rdb.h.

48: m_connection(0) { }

Member Function Documentation

◆ accept() [1/2]

unsigned int rdbModel::Rdb::accept ( Visitor v)

This is the recursive accept for the visitor pattern.

Definition at line 98 of file Rdb.cxx.

98 {
99 Visitor::VisitorState state = v->visitRdb(this);
100 if (state != Visitor::VCONTINUE) return state;
101
102 unsigned nTable = m_tables.size();
103
104 for (unsigned i = 0; i < nTable; i++) {
105 state = m_tables[i]->accept(v);
106 if (state != Visitor::VCONTINUE) return state;
107 }
108 return state;
109 }
**********Class see also m_nmax DOUBLE PRECISION m_amel DOUBLE PRECISION m_x2 DOUBLE PRECISION m_alfinv DOUBLE PRECISION m_Xenph INTEGER m_KeyWtm INTEGER m_idyfs DOUBLE PRECISION m_zini DOUBLE PRECISION m_q2 DOUBLE PRECISION m_Wt_KF DOUBLE PRECISION m_WtCut INTEGER m_KFfin *COMMON c_KarLud $ !Input CMS energy[GeV] $ !CMS energy after beam spread beam strahlung[GeV] $ !Beam energy spread[GeV] $ !z boost due to beam spread $ !electron beam mass *ff pair spectrum $ !minimum v
Definition: KarLud.h:35

Referenced by rdbModel::MysqlConnection::matchSchema(), and rdbModel::Manager::startVisitor().

◆ accept() [2/2]

unsigned int rdbModel::Rdb::accept ( Visitor v)

This is the recursive accept for the visitor pattern.

◆ getColumn() [1/2]

Column * rdbModel::Rdb::getColumn ( const std::string &  tableName,
const std::string &  colName 
) const

Definition at line 25 of file Rdb.cxx.

26 {
27 Table* table = getTable(tableName);
28 if (!table) return 0;
29
30 return table->getColumnByName(colName);
31
32 }
Table * getTable(const std::string &name) const
Definition: Rdb.cxx:16

Referenced by main().

◆ getColumn() [2/2]

Column * rdbModel::Rdb::getColumn ( const std::string &  tableName,
const std::string &  colName 
) const

◆ getCVSid() [1/2]

const std::string & rdbModel::Rdb::getCVSid ( )
inline

Definition at line 54 of file Calibration/rdbModel/rdbModel-00-01-01/rdbModel/Rdb.h.

54{return m_CVSid;};

◆ getCVSid() [2/2]

const std::string & rdbModel::Rdb::getCVSid ( )
inline

Definition at line 54 of file InstallArea/include/rdbModel/rdbModel/Rdb.h.

54{return m_CVSid;};

◆ getDbName() [1/2]

const std::string & rdbModel::Rdb::getDbName ( )
inline

Definition at line 56 of file Calibration/rdbModel/rdbModel-00-01-01/rdbModel/Rdb.h.

56{return m_dbName;};

Referenced by rdbModel::MysqlConnection::visitRdb().

◆ getDbName() [2/2]

const std::string & rdbModel::Rdb::getDbName ( )
inline

Definition at line 56 of file InstallArea/include/rdbModel/rdbModel/Rdb.h.

56{return m_dbName;};

◆ getIndex() [1/2]

Index * rdbModel::Rdb::getIndex ( const std::string &  tableName,
const std::string &  indexName 
) const

Definition at line 34 of file Rdb.cxx.

35 {
36 Table* table = getTable(tableName);
37 if (!table) return 0;
38
39 return table->getIndexByName(indexName);
40
41 }

◆ getIndex() [2/2]

Index * rdbModel::Rdb::getIndex ( const std::string &  tableName,
const std::string &  indexName 
) const

◆ getMajorVersion() [1/2]

unsigned rdbModel::Rdb::getMajorVersion ( )
inline

Definition at line 51 of file Calibration/rdbModel/rdbModel-00-01-01/rdbModel/Rdb.h.

51{return m_majorVersion;};

◆ getMajorVersion() [2/2]

unsigned rdbModel::Rdb::getMajorVersion ( )
inline

Definition at line 51 of file InstallArea/include/rdbModel/rdbModel/Rdb.h.

51{return m_majorVersion;};

◆ getMinorVersion() [1/2]

unsigned rdbModel::Rdb::getMinorVersion ( )
inline

Definition at line 52 of file Calibration/rdbModel/rdbModel-00-01-01/rdbModel/Rdb.h.

52{return m_minorVersion;};

◆ getMinorVersion() [2/2]

unsigned rdbModel::Rdb::getMinorVersion ( )
inline

Definition at line 52 of file InstallArea/include/rdbModel/rdbModel/Rdb.h.

52{return m_minorVersion;};

◆ getNTable() [1/2]

unsigned int rdbModel::Rdb::getNTable ( ) const
inline

Definition at line 68 of file Calibration/rdbModel/rdbModel-00-01-01/rdbModel/Rdb.h.

68{return m_tables.size();}

Referenced by rdbModel::MysqlConnection::visitRdb().

◆ getNTable() [2/2]

unsigned int rdbModel::Rdb::getNTable ( ) const
inline

Definition at line 68 of file InstallArea/include/rdbModel/rdbModel/Rdb.h.

68{return m_tables.size();}

◆ getTable() [1/2]

Table * rdbModel::Rdb::getTable ( const std::string &  name) const

Definition at line 16 of file Rdb.cxx.

16 {
17 unsigned nTable = m_tables.size();
18 for (unsigned iTable = 0; iTable < nTable; iTable++) {
19 Table* table = m_tables[iTable];
20 if (table->getName() == name) return table;
21 }
22 return 0;
23 }

Referenced by calibUtil::Metadata::checkNulls(), calibUtil::Metadata::checkValues(), getColumn(), getIndex(), insertLatest(), insertRow(), main(), supersedeRow(), and updateRows().

◆ getTable() [2/2]

Table * rdbModel::Rdb::getTable ( const std::string &  name) const

◆ insertLatest() [1/4]

int rdbModel::Rdb::insertLatest ( const std::string &  tName,
Row row,
int *  serial = 0 
) const

Definition at line 76 of file Rdb.cxx.

77 {
78 Table* t = getTable(tName);
79 if (!t) {
80 std::string msg("Rdb::insertLatest unknown table ");
81 msg = msg + tName;
82 throw RdbException(msg);
83 }
84 return (t->insertLatest(row, serial));
85 }
int t()
Definition: t.c:1

◆ insertLatest() [2/4]

int rdbModel::Rdb::insertLatest ( const std::string &  tName,
Row row,
int *  serial = 0 
) const

◆ insertLatest() [3/4]

int rdbModel::Rdb::insertLatest ( Table t,
Row row,
int *  serial = 0 
) const

The two forms of smart insert, in addition to filling in the service fields, as insertRow does, do various forms of consistency checking and may even update pre-existing rows.

Definition at line 72 of file Rdb.cxx.

72 {
73 return (t->insertLatest(row, serial));
74 }

Referenced by doSmartInsert().

◆ insertLatest() [4/4]

int rdbModel::Rdb::insertLatest ( Table t,
Row row,
int *  serial = 0 
) const

The two forms of smart insert, in addition to filling in the service fields, as insertRow does, do various forms of consistency checking and may even update pre-existing rows.

◆ insertRow() [1/2]

int rdbModel::Rdb::insertRow ( const std::string &  tName,
Row row,
int *  serial = 0 
) const

insertRow has only one value-added feature as compared to an SQL insert: it will take care of fields intended to be filled by the service (e.g., insert and update timestamps)

Definition at line 52 of file Rdb.cxx.

52 {
53 Table* t = getTable(tName);
54 if (!t) {
55 std::string msg("Rdb::insertRow unknown table ");
56 msg = msg + tName;
57 throw RdbException(msg);
58 }
59 return (t->insertRow(row, serial));
60 }

Referenced by doInsert().

◆ insertRow() [2/2]

int rdbModel::Rdb::insertRow ( const std::string &  tName,
Row row,
int *  serial = 0 
) const

insertRow has only one value-added feature as compared to an SQL insert: it will take care of fields intended to be filled by the service (e.g., insert and update timestamps)

◆ setConnection() [1/2]

void rdbModel::Rdb::setConnection ( Connection connection)

Definition at line 43 of file Rdb.cxx.

43 {
44 m_connection = connection;
45
46 // propagate to all our tables as well
47 for (unsigned i = 0; i < m_tables.size(); i++) {
48 m_tables[i]->setConnection(connection);
49 }
50 }

Referenced by rdbModel::MysqlConnection::visitRdb().

◆ setConnection() [2/2]

void rdbModel::Rdb::setConnection ( Connection connection)

◆ supersedeRow() [1/2]

int rdbModel::Rdb::supersedeRow ( const std::string &  tName,
Row row,
int  oldKey,
int *  newKey = 0 
) const

Definition at line 87 of file Rdb.cxx.

88 {
89 Table* t = getTable(tName);
90 if (!t) {
91 std::string msg("Rdb::supersedeRow unknown table ");
92 msg = msg + tName;
93 throw RdbException(msg);
94 }
95 return (t->supersedeRow(row, oldKey, newKey));
96 }

Referenced by doSupersede().

◆ supersedeRow() [2/2]

int rdbModel::Rdb::supersedeRow ( const std::string &  tName,
Row row,
int  oldKey,
int *  newKey = 0 
) const

◆ updateRows() [1/2]

int rdbModel::Rdb::updateRows ( const std::string &  tName,
Row row,
Assertion where 
) const

Fills in service fields, then invokes Connection::update

Definition at line 62 of file Rdb.cxx.

62 {
63 Table* t = getTable(tName);
64 if (!t) {
65 std::string msg("Rdb::insertRow unknown table ");
66 msg = msg + tName;
67 throw RdbException(msg);
68 }
69 return (t->updateRows(row, where));
70 }

Referenced by doUpdate().

◆ updateRows() [2/2]

int rdbModel::Rdb::updateRows ( const std::string &  tName,
Row row,
Assertion where 
) const

Fills in service fields, then invokes Connection::update

Friends And Related Function Documentation

◆ rdbModel::XercesBuilder


The documentation for this class was generated from the following files: