BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
rdbModel::Assertion Class Reference

#include <Assertion.h>

Classes

class  Operator

Public Member Functions

 Assertion (Operator *op=0, Table *myTable=0, bool keepOp=false)
 Assertion (const Assertion *orig, Row *toBe)
 ~Assertion ()
Visitor::VisitorState accept (Visitor *v)
OperatorgetOperator () const
const std::string & getPrecompiled () const
bool getToBe () const
bool getOld () const
const std::string & getName () const
void setName (const std::string &name)
bool verify (Row &old, Row &toBe) const
 Assertion (Operator *op=0, Table *myTable=0, bool keepOp=false)
 Assertion (const Assertion *orig, Row *toBe)
 ~Assertion ()
Visitor::VisitorState accept (Visitor *v)
OperatorgetOperator () const
const std::string & getPrecompiled () const
bool getToBe () const
bool getOld () const
const std::string & getName () const
void setName (const std::string &name)
bool verify (Row &old, Row &toBe) const
 Assertion (Operator *op=0, Table *myTable=0, bool keepOp=false)
 Assertion (const Assertion *orig, Row *toBe)
 ~Assertion ()
Visitor::VisitorState accept (Visitor *v)
OperatorgetOperator () const
const std::string & getPrecompiled () const
bool getToBe () const
bool getOld () const
const std::string & getName () const
void setName (const std::string &name)
bool verify (Row &old, Row &toBe) const

Detailed Description

Assertions are used in at least two ways:

  1. As part of a table description. The assertion describes a condition which should be evaluated upon a particular event, such as when a new element is to be inserted. Such assertions stick around for the life of the application instance. If the assertion is checked often, a pre-compiled version (dependent on the type of connection) can save some time.
  2. As a WHERE clause in a client-institued UPDATE or SELECT. These are only around long enough to do the UPDATE or SELECT.

The bulk of the information comprising an assertion is kept in a tree whose nodes are "operations". An operation may be either a comparison ( =, <=, etc. and also "is null") or an operation which has child operations: OR, AND, NOT, for all, there exists, hence a node is a leaf node iff it's a comparison.

Once an operation has been incorporated into an Assertion or into another operation, it is 'owned' by this parent. Deleting the parent will cause its children to be deleted. Hence applications building assertions out of operators should never delete those operators.

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

Constructor & Destructor Documentation

◆ Assertion() [1/6]

rdbModel::Assertion::Assertion ( Operator * op = 0,
Table * myTable = 0,
bool keepOp = false )
inline

Normally, operator associated with the assertion will be deleted when the assertion itself is deleted, but this won't happen if keepOp is set to true.

Definition at line 177 of file Calibration/rdbModel/include/rdbModel/Tables/Assertion.h.

178 : m_op( op ), m_myTable( myTable ), m_keepOp( keepOp ) {
179 m_compiled.clear();
180 m_name.clear();
181 };

Referenced by Assertion().

◆ Assertion() [2/6]

rdbModel::Assertion::Assertion ( const Assertion * orig,
Row * toBe )

Copy original assertion, but, wherever a colRef is a "toBe", substitute with value from toBe row. toBe is not const because we may need to sort it.

Definition at line 26 of file Calibration/rdbModel/src/Tables/Assertion.cxx.

27 : m_op( 0 )
28 , m_myTable( orig->m_myTable )
29 , m_keepOp( false )
30 , m_name( "" )
31 , m_compiled( "" ) {
32 toBe->rowSort();
33 m_op = new Assertion::Operator( orig->m_op, toBe );
34 }

◆ ~Assertion() [1/3]

rdbModel::Assertion::~Assertion ( )

Definition at line 36 of file Calibration/rdbModel/src/Tables/Assertion.cxx.

36 {
37 if ( !m_keepOp ) delete m_op;
38 }

◆ Assertion() [3/6]

rdbModel::Assertion::Assertion ( Operator * op = 0,
Table * myTable = 0,
bool keepOp = false )
inline

Normally, operator associated with the assertion will be deleted when the assertion itself is deleted, but this won't happen if keepOp is set to true.

Definition at line 177 of file InstallArea/x86_64-el9-gcc13-dbg/include/rdbModel/Tables/Assertion.h.

178 : m_op( op ), m_myTable( myTable ), m_keepOp( keepOp ) {
179 m_compiled.clear();
180 m_name.clear();
181 };

◆ Assertion() [4/6]

rdbModel::Assertion::Assertion ( const Assertion * orig,
Row * toBe )

Copy original assertion, but, wherever a colRef is a "toBe", substitute with value from toBe row. toBe is not const because we may need to sort it.

◆ ~Assertion() [2/3]

rdbModel::Assertion::~Assertion ( )

◆ Assertion() [5/6]

rdbModel::Assertion::Assertion ( Operator * op = 0,
Table * myTable = 0,
bool keepOp = false )
inline

Normally, operator associated with the assertion will be deleted when the assertion itself is deleted, but this won't happen if keepOp is set to true.

Definition at line 177 of file InstallArea/x86_64-el9-gcc13-opt/include/rdbModel/Tables/Assertion.h.

178 : m_op( op ), m_myTable( myTable ), m_keepOp( keepOp ) {
179 m_compiled.clear();
180 m_name.clear();
181 };

◆ Assertion() [6/6]

rdbModel::Assertion::Assertion ( const Assertion * orig,
Row * toBe )

Copy original assertion, but, wherever a colRef is a "toBe", substitute with value from toBe row. toBe is not const because we may need to sort it.

◆ ~Assertion() [3/3]

rdbModel::Assertion::~Assertion ( )

Member Function Documentation

◆ accept() [1/3]

Visitor::VisitorState rdbModel::Assertion::accept ( Visitor * v)

Definition at line 347 of file Calibration/rdbModel/src/Tables/Assertion.cxx.

347 {
348 Visitor::VisitorState state = v->visitAssertion( this );
349 if ( state == Visitor::VBRANCHDONE ) return Visitor::VCONTINUE;
350 return state;
351 }
**********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

◆ accept() [2/3]

Visitor::VisitorState rdbModel::Assertion::accept ( Visitor * v)

◆ accept() [3/3]

Visitor::VisitorState rdbModel::Assertion::accept ( Visitor * v)

◆ getName() [1/3]

const std::string & rdbModel::Assertion::getName ( ) const
inline

Definition at line 206 of file Calibration/rdbModel/include/rdbModel/Tables/Assertion.h.

206{ return m_name; }

Referenced by rdbModel::Table::getAssertionByName().

◆ getName() [2/3]

const std::string & rdbModel::Assertion::getName ( ) const
inline

Definition at line 206 of file InstallArea/x86_64-el9-gcc13-dbg/include/rdbModel/Tables/Assertion.h.

206{ return m_name; }

◆ getName() [3/3]

const std::string & rdbModel::Assertion::getName ( ) const
inline

Definition at line 206 of file InstallArea/x86_64-el9-gcc13-opt/include/rdbModel/Tables/Assertion.h.

206{ return m_name; }

◆ getOld() [1/3]

bool rdbModel::Assertion::getOld ( ) const
inline

Returns true if associated operator or descendant refers to existing row

Definition at line 204 of file Calibration/rdbModel/include/rdbModel/Tables/Assertion.h.

204{ return m_op->getOld(); }

Referenced by verify().

◆ getOld() [2/3]

bool rdbModel::Assertion::getOld ( ) const
inline

Returns true if associated operator or descendant refers to existing row

Definition at line 204 of file InstallArea/x86_64-el9-gcc13-dbg/include/rdbModel/Tables/Assertion.h.

204{ return m_op->getOld(); }

◆ getOld() [3/3]

bool rdbModel::Assertion::getOld ( ) const
inline

Returns true if associated operator or descendant refers to existing row

Definition at line 204 of file InstallArea/x86_64-el9-gcc13-opt/include/rdbModel/Tables/Assertion.h.

204{ return m_op->getOld(); }

◆ getOperator() [1/3]

Operator * rdbModel::Assertion::getOperator ( ) const
inline

◆ getOperator() [2/3]

Operator * rdbModel::Assertion::getOperator ( ) const
inline

Definition at line 194 of file InstallArea/x86_64-el9-gcc13-dbg/include/rdbModel/Tables/Assertion.h.

194{ return m_op; }

◆ getOperator() [3/3]

Operator * rdbModel::Assertion::getOperator ( ) const
inline

Definition at line 194 of file InstallArea/x86_64-el9-gcc13-opt/include/rdbModel/Tables/Assertion.h.

194{ return m_op; }

◆ getPrecompiled() [1/3]

const std::string & rdbModel::Assertion::getPrecompiled ( ) const
inline

Definition at line 196 of file Calibration/rdbModel/include/rdbModel/Tables/Assertion.h.

196{ return m_compiled; }

◆ getPrecompiled() [2/3]

const std::string & rdbModel::Assertion::getPrecompiled ( ) const
inline

Definition at line 196 of file InstallArea/x86_64-el9-gcc13-dbg/include/rdbModel/Tables/Assertion.h.

196{ return m_compiled; }

◆ getPrecompiled() [3/3]

const std::string & rdbModel::Assertion::getPrecompiled ( ) const
inline

Definition at line 196 of file InstallArea/x86_64-el9-gcc13-opt/include/rdbModel/Tables/Assertion.h.

196{ return m_compiled; }

◆ getToBe() [1/3]

bool rdbModel::Assertion::getToBe ( ) const
inline

True if associated operator or descendant refers to future row (in which case can't call MySql::compileAssertion)

Definition at line 200 of file Calibration/rdbModel/include/rdbModel/Tables/Assertion.h.

200{ return m_op->getToBe(); }

Referenced by verify().

◆ getToBe() [2/3]

bool rdbModel::Assertion::getToBe ( ) const
inline

True if associated operator or descendant refers to future row (in which case can't call MySql::compileAssertion)

Definition at line 200 of file InstallArea/x86_64-el9-gcc13-dbg/include/rdbModel/Tables/Assertion.h.

200{ return m_op->getToBe(); }

◆ getToBe() [3/3]

bool rdbModel::Assertion::getToBe ( ) const
inline

True if associated operator or descendant refers to future row (in which case can't call MySql::compileAssertion)

Definition at line 200 of file InstallArea/x86_64-el9-gcc13-opt/include/rdbModel/Tables/Assertion.h.

200{ return m_op->getToBe(); }

◆ setName() [1/3]

void rdbModel::Assertion::setName ( const std::string & name)
inline

Definition at line 207 of file Calibration/rdbModel/include/rdbModel/Tables/Assertion.h.

207{ m_name = name; }

◆ setName() [2/3]

void rdbModel::Assertion::setName ( const std::string & name)
inline

Definition at line 207 of file InstallArea/x86_64-el9-gcc13-dbg/include/rdbModel/Tables/Assertion.h.

207{ m_name = name; }

◆ setName() [3/3]

void rdbModel::Assertion::setName ( const std::string & name)
inline

Definition at line 207 of file InstallArea/x86_64-el9-gcc13-opt/include/rdbModel/Tables/Assertion.h.

207{ m_name = name; }

◆ verify() [1/3]

bool rdbModel::Assertion::verify ( Row & old,
Row & toBe ) const

verify checks if assertion (which may refer to one or both of an old row and a proposed row) holds for these arguments. Caller is responsible for fetching old row fields out of dbs if necessary May throw RdbException

Definition at line 353 of file Calibration/rdbModel/src/Tables/Assertion.cxx.

353 {
354
355 if ( getOld() )
356 { // will actually use old vector, so sort
357 old.rowSort();
358 }
359 if ( getToBe() )
360 { // will actually use toBe vector, so sort
361 toBe.rowSort();
362 }
363 return m_op->verify( old, toBe, m_myTable );
364 }

Referenced by rdbModel::Table::insertLatest(), main(), and rdbModel::Assertion::Operator::verify().

◆ verify() [2/3]

bool rdbModel::Assertion::verify ( Row & old,
Row & toBe ) const

verify checks if assertion (which may refer to one or both of an old row and a proposed row) holds for these arguments. Caller is responsible for fetching old row fields out of dbs if necessary May throw RdbException

◆ verify() [3/3]

bool rdbModel::Assertion::verify ( Row & old,
Row & toBe ) const

verify checks if assertion (which may refer to one or both of an old row and a proposed row) holds for these arguments. Caller is responsible for fetching old row fields out of dbs if necessary May throw RdbException


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