BOSS 8.0.0
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.
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 42 of file Calibration/rdbModel/include/rdbModel/Rdb.h.

Constructor & Destructor Documentation

◆ ~Rdb() [1/3]

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 9 of file Rdb.cxx.

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

◆ Rdb() [1/3]

rdbModel::Rdb::Rdb ( )
inline

Definition at line 49 of file Calibration/rdbModel/include/rdbModel/Rdb.h.

49: m_connection( 0 ) {}

◆ ~Rdb() [2/3]

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/3]

rdbModel::Rdb::Rdb ( )
inline

Definition at line 49 of file InstallArea/x86_64-el9-gcc13-dbg/include/rdbModel/Rdb.h.

49: m_connection( 0 ) {}

◆ ~Rdb() [3/3]

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() [3/3]

rdbModel::Rdb::Rdb ( )
inline

Definition at line 49 of file InstallArea/x86_64-el9-gcc13-opt/include/rdbModel/Rdb.h.

49: m_connection( 0 ) {}

Member Function Documentation

◆ accept() [1/3]

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 {
106 state = m_tables[i]->accept( v );
107 if ( state != Visitor::VCONTINUE ) return state;
108 }
109 return state;
110 }
**********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().

◆ accept() [2/3]

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

This is the recursive accept for the visitor pattern.

◆ accept() [3/3]

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

This is the recursive accept for the visitor pattern.

◆ getColumn() [1/3]

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

Definition at line 28 of file Rdb.cxx.

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

Referenced by main().

◆ getColumn() [2/3]

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

◆ getColumn() [3/3]

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

◆ getCVSid() [1/3]

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

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

54{ return m_CVSid; };

◆ getCVSid() [2/3]

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

Definition at line 54 of file InstallArea/x86_64-el9-gcc13-dbg/include/rdbModel/Rdb.h.

54{ return m_CVSid; };

◆ getCVSid() [3/3]

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

Definition at line 54 of file InstallArea/x86_64-el9-gcc13-opt/include/rdbModel/Rdb.h.

54{ return m_CVSid; };

◆ getDbName() [1/3]

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

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

56{ return m_dbName; };

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

◆ getDbName() [2/3]

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

Definition at line 56 of file InstallArea/x86_64-el9-gcc13-dbg/include/rdbModel/Rdb.h.

56{ return m_dbName; };

◆ getDbName() [3/3]

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

Definition at line 56 of file InstallArea/x86_64-el9-gcc13-opt/include/rdbModel/Rdb.h.

56{ return m_dbName; };

◆ getIndex() [1/3]

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

Definition at line 35 of file Rdb.cxx.

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

◆ getIndex() [2/3]

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

◆ getIndex() [3/3]

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

◆ getMajorVersion() [1/3]

unsigned rdbModel::Rdb::getMajorVersion ( )
inline

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

51{ return m_majorVersion; };

◆ getMajorVersion() [2/3]

unsigned rdbModel::Rdb::getMajorVersion ( )
inline

Definition at line 51 of file InstallArea/x86_64-el9-gcc13-dbg/include/rdbModel/Rdb.h.

51{ return m_majorVersion; };

◆ getMajorVersion() [3/3]

unsigned rdbModel::Rdb::getMajorVersion ( )
inline

Definition at line 51 of file InstallArea/x86_64-el9-gcc13-opt/include/rdbModel/Rdb.h.

51{ return m_majorVersion; };

◆ getMinorVersion() [1/3]

unsigned rdbModel::Rdb::getMinorVersion ( )
inline

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

52{ return m_minorVersion; };

◆ getMinorVersion() [2/3]

unsigned rdbModel::Rdb::getMinorVersion ( )
inline

Definition at line 52 of file InstallArea/x86_64-el9-gcc13-dbg/include/rdbModel/Rdb.h.

52{ return m_minorVersion; };

◆ getMinorVersion() [3/3]

unsigned rdbModel::Rdb::getMinorVersion ( )
inline

Definition at line 52 of file InstallArea/x86_64-el9-gcc13-opt/include/rdbModel/Rdb.h.

52{ return m_minorVersion; };

◆ getNTable() [1/3]

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

Definition at line 66 of file Calibration/rdbModel/include/rdbModel/Rdb.h.

66{ return m_tables.size(); }

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

◆ getNTable() [2/3]

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

Definition at line 66 of file InstallArea/x86_64-el9-gcc13-dbg/include/rdbModel/Rdb.h.

66{ return m_tables.size(); }

◆ getNTable() [3/3]

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

Definition at line 66 of file InstallArea/x86_64-el9-gcc13-opt/include/rdbModel/Rdb.h.

66{ return m_tables.size(); }

◆ getTable() [1/3]

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

Definition at line 18 of file Rdb.cxx.

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

Referenced by getColumn(), getIndex(), insertLatest(), insertRow(), main(), supersedeRow(), and updateRows().

◆ getTable() [2/3]

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

◆ getTable() [3/3]

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

◆ insertLatest() [1/6]

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

Definition at line 76 of file Rdb.cxx.

76 {
77 Table* t = getTable( tName );
78 if ( !t )
79 {
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/6]

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

◆ insertLatest() [3/6]

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

◆ insertLatest() [4/6]

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() [5/6]

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.

◆ insertLatest() [6/6]

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/3]

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 50 of file Rdb.cxx.

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

Referenced by doInsert().

◆ insertRow() [2/3]

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)

◆ insertRow() [3/3]

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/3]

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

Definition at line 42 of file Rdb.cxx.

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

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

◆ setConnection() [2/3]

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

◆ setConnection() [3/3]

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

◆ supersedeRow() [1/3]

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

Definition at line 87 of file Rdb.cxx.

87 {
88 Table* t = getTable( tName );
89 if ( !t )
90 {
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/3]

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

◆ supersedeRow() [3/3]

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

◆ updateRows() [1/3]

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

Fills in service fields, then invokes Connection::update

Definition at line 61 of file Rdb.cxx.

61 {
62 Table* t = getTable( tName );
63 if ( !t )
64 {
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/3]

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

Fills in service fields, then invokes Connection::update

◆ updateRows() [3/3]

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

Fills in service fields, then invokes Connection::update

◆ rdbModel::XercesBuilder


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