RDKit: Invariant.h File Reference

| RDKit Open-source cheminformatics and machine learning.

Loading...
Searching...
No Matches
Classes | Namespaces | Macros | Functions
Invariant.h File Reference
`#include <RDGeneral/export.h>`
`#include <cassert>`
`#include <string>`
`#include <stdexcept>`
`#include "BoostStartInclude.h"`
`#include <RDGeneral/RDLog.h>`
`#include "BoostEndInclude.h"`

Go to the source code of this file.

## Classes
class | Invar::Invariant

## Namespaces
namespace | Invar

## Macros
#define | INVARIANT_EXCEPTION_METHOD 1
#define | ASSERT_INVARIANT(expr, mess)
#define | CHECK_INVARIANT(expr, mess)
#define | PRECONDITION(expr, mess)
#define | POSTCONDITION(expr, mess)
#define | UNDER_CONSTRUCTION(fn)
#define | RANGE_CHECK(lo, x, hi)
#define | URANGE_CHECK(x, hi)
#define | TEST_ASSERT(expr)
#define | rdcast static_cast
#define | RDUNUSED_PARAM(x)

## Functions
RDKIT_RDGENERAL_EXPORT std::ostream & | Invar::operator<< (std::ostream &s, const Invariant &inv)

## Macro Definition Documentation

## ◆ ASSERT_INVARIANT

#define ASSERT_INVARIANT | ( |  | expr,
|  |  | mess )

Value:
assert(expr)

Definition at line 92 of file Invariant.h.

## ◆ CHECK_INVARIANT

#define CHECK_INVARIANT | ( |  | expr,
|  |  | mess )

Value:
if (!(expr)) { \
Invar::Invariant inv("Invariant Violation", mess, #expr, __FILE__, \
__LINE__); \
BOOST_LOG(rdErrorLog) << "\n\n****\n" << inv << "****\n" << std::endl; \
throw inv; \
}
rdErrorLog
RDKIT_RDGENERAL_EXPORT RDLogger rdErrorLog
Invar::Invariant
Definition Invariant.h:50

Definition at line 100 of file Invariant.h.

Referenced by RDKit::SLNParse::addBranchToMol(), RDKit::appendPackedIntToStream(), RDDataManip::MetricMatrixCalc< vectType, entryType >::calcMetricMatrix(), DistGeom::ChiralSet::ChiralSet(), RDKit::SLNParse::closeRingBond(), RDKit::countSwapsToInterconvert(), RDNumeric::SymmMatrix< double >::getCol(), RDCatalog::HierarchCatalog< FragCatalogEntry, FragCatParams, int >::getEntriesOfOrder(), RDNumeric::SymmMatrix< double >::getRow(), RDPickers::MaxMinPicker::lazyPick(), BFGSOpt::minimize(), RDNumeric::multiply(), RDNumeric::multiply(), RDNumeric::multiply(), RDNumeric::multiply(), RDNumeric::SquareMatrix< double >::operator*=(), RDNumeric::SymmMatrix< double >::operator*=(), RDNumeric::SymmMatrix< double >::operator+=(), RDNumeric::SymmMatrix< double >::operator-=(), RDPickers::LeaderPicker::pick(), RDPickers::MaxMinPicker::pick(), DistGeom::BoundsMatrix::setLowerBound(), DistGeom::BoundsMatrix::setUpperBound(), boost_adaptbx::python::streambuf::streambuf(), and RDNumeric::SymmMatrix< double >::transpose().

## ◆ INVARIANT_EXCEPTION_METHOD

#define INVARIANT_EXCEPTION_METHOD 1

Definition at line 36 of file Invariant.h.

## ◆ POSTCONDITION

#define POSTCONDITION | ( |  | expr,
|  |  | mess )

Value:
if (!(expr)) { \
Invar::Invariant inv("Post-condition Violation", mess, #expr, __FILE__, \
__LINE__); \
BOOST_LOG(rdErrorLog) << "\n\n****\n" << inv << "****\n" << std::endl; \
throw inv; \
}

Definition at line 116 of file Invariant.h.

Referenced by RDKit::PeriodicTable::getAtomicNumber(), and PySequenceHolder< T >::operator[]().

## ◆ PRECONDITION

#define PRECONDITION | ( |  | expr,
|  |  | mess )

Value:
if (!(expr)) { \
Invar::Invariant inv("Pre-condition Violation", mess, #expr, __FILE__, \
__LINE__); \
BOOST_LOG(rdErrorLog) << "\n\n****\n" << inv << "****\n" << std::endl; \
throw inv; \
}

Definition at line 108 of file Invariant.h.

Referenced by RDKit::SLNParse::addAtomToMol(), RDKit::SLNParse::addBranchToMol(), RDKit::FilterHierarchyMatcher::addChild(), RDCatalog::HierarchCatalog< FragCatalogEntry, FragCatParams, int >::addEntry(), RDKit::FixedMolSizeMolBundle::addMol(), RDKit::MolBundle::addMol(), RDKit::ExclusionList::addPattern(), RDKit::MultiFPBReader::addReader(), RDNumeric::Matrix< double >::assign(), RDNumeric::Vector< double >::assign(), RDKit::MolStandardize::TautomerEnumeratorResult::at(), RDKit::SLNParse::closeRingBond(), conrec::Contour(), RDKit::countSwapsToInterconvert(), RDKit::describeQuery(), RDKit::describeQuery(), RDGeom::PointND::directionVector(), RDNumeric::Vector< double >::dotProduct(), RDKit::MolDraw2Dwx::drawPolygon(), RDKit::PDBWriter::flush(), RDKit::SDWriter::flush(), RDKit::SmilesWriter::flush(), RDKit::TDTWriter::flush(), DistGeom::FourthDimContribs::FourthDimContribs(), RDKit::MolAlign::MolHistogram::get(), RDKit::PeriodicTable::getAbundanceForIsotope(), RDKit::PeriodicTable::getAbundanceForIsotope(), RDKit::RecursiveStructureQuery::getAtIdx(), RDKit::PeriodicTable::getAtomicWeight(), RDKit::PeriodicTable::getAtomicWeight(), RDNumeric::Matrix< double >::getCol(), RDKit::MolAlign::LAP::getCost(), RDKit::PeriodicTable::getDefaultValence(), RDKit::PeriodicTable::getDefaultValence(), RDKit::PeriodicTable::getElementName(), RDKit::PeriodicTable::getElementSymbol(), RDDepict::EmbeddedFrag::GetEmbeddedAtom(), DistGeom::FourthDimContribs::getEnergy(), RDKit::EnumerateLibraryBase::getEnumerator(), DistGeom::FourthDimContribs::getGrad(), RDKit::v1::SDMolSupplier::getItemText(), RDKit::v1::SmilesMolSupplier::getItemText(), RDKit::v1::TDTMolSupplier::getItemText(), RDFeatures::ImplicitFeature< FAMILYMARKER, TYPEMARKER, LOCTYPE >::getLoc(), RDKit::PeriodicTable::getMassForIsotope(), RDKit::PeriodicTable::getMassForIsotope(), RDKit::ExclusionList::getMatches(), RDKit::FilterMatchOps::And::getMatches(), RDKit::FilterMatchOps::Not::getMatches(), RDKit::FilterMatchOps::Or::getMatches(), RDKit::SubstructLibrary::getMol(), RDKit::SubstructLibrary::getMolecules(), RDKit::PeriodicTable::getMostCommonIsotope(), RDKit::PeriodicTable::getMostCommonIsotope(), RDKit::PeriodicTable::getMostCommonIsotopeMass(), RDKit::PeriodicTable::getMostCommonIsotopeMass(), RDKit::PeriodicTable::getNouterElecs(), RDKit::PeriodicTable::getNouterElecs(), RDKit::Atom::getOwningMol(), RDKit::Bond::getOwningMol(), RDKit::Conformer::getOwningMol(), RDKit::SubstanceGroup::getOwningMol(), RDKit::PeriodicTable::getRb0(), RDKit::PeriodicTable::getRb0(), RDKit::PeriodicTable::getRcovalent(), RDKit::PeriodicTable::getRcovalent(), RDKit::PeriodicTable::getRow(), RDKit::PeriodicTable::getRow(), RDNumeric::Matrix< double >::getRow(), RDKit::MolAlign::LAP::getRowSol(), RDKit::PeriodicTable::getRvdw(), RDKit::PeriodicTable::getRvdw(), RDNumeric::Matrix< double >::getVal(), RDNumeric::Vector< double >::getVal(), RDKit::PeriodicTable::getValenceList(), RDKit::PeriodicTable::getValenceList(), RDKit::ExclusionList::hasMatch(), RDKit::FilterMatchOps::And::hasMatch(), RDKit::FilterMatchOps::Not::hasMatch(), RDKit::FilterMatchOps::Or::hasMatch(), RDKit::MolBundle::initFromStream(), RDKit::v1::SDMolSupplier::length(), RDKit::v1::SmilesMolSupplier::length(), RDKit::v1::TDTMolSupplier::length(), BFGSOpt::linearSearch(), RDKit::MolEnumerator::LinkNodeOp::LinkNodeOp(), RDKit::mergeNullQueries(), BFGSOpt::minimize(), RDKit::MolDraw2DJS::MolDraw2DJS(), RDKit::PeriodicTable::moreElectroNegative(), RDKit::v1::SDMolSupplier::moveTo(), RDKit::v1::SmilesMolSupplier::moveTo(), RDKit::v1::TDTMolSupplier::moveTo(), RDKit::v1::MolSupplier::next(), RDKit::EnumerateLibraryBase::operator bool(), RDGeom::UniformGrid3D::operator&(), RDKit::Canon::ChiralAtomCompareFunctor::operator()(), RDKit::Canon::SpecialChiralityAtomCompareFunctor::operator()(), RDKit::Canon::SpecialSymmetryAtomCompareFunctor::operator()(), RDNumeric::Matrix< double >::operator+=(), RDNumeric::Vector< double >::operator+=(), RDNumeric::Matrix< double >::operator-=(), RDNumeric::Vector< double >::operator-=(), RDKit::DrawColour::operator/(), RDKit::SubstructLibrary::operator[](), RDKit::v1::SDMolSupplier::operator[](), RDKit::v1::SmilesMolSupplier::operator[](), RDKit::v1::TDTMolSupplier::operator[](), RDNumeric::Vector< double >::operator[](), RDNumeric::Vector< double >::operator[](), RDKit::ForceFieldsHelper::detail::OptimizeMoleculeConfsST(), RDKit::MolEnumerator::PositionVariationOp::PositionVariationOp(), Rankers::rankVect(), RDKit::MolEnumerator::RepeatUnitOp::RepeatUnitOp(), RDKit::Atom::setAtomMapNum(), RDCatalog::Catalog< FilterCatalogEntry, FilterCatalogParams >::setCatalogParams(), RDKit::v1::SDMolSupplier::setData(), RDKit::v1::SmilesMolSupplier::setData(), RDKit::v1::TDTMolSupplier::setData(), RDKit::MMFF::MMFFMolProperties::setMMFFDielectricConstant(), RDKit::MMFF::MMFFMolProperties::setMMFFVariant(), RDKit::FilterHierarchyMatcher::setPattern(), RDKit::v1::ForwardSDMolSupplier::setProcessPropertyLists(), RDKit::Bond::setStereo(), RDKit::v1::SDMolSupplier::setStreamIndices(), RDNumeric::Matrix< double >::setVal(), RDNumeric::Vector< double >::setVal(), RDKit::SubstructLibrary::size(), RDKit::SLNParse::startMol(), RDKit::TautomerQuery::TautomerQuery(), RDCatalog::HierarchCatalog< FragCatalogEntry, FragCatParams, int >::toStream(), RDKit::MolBundle::toStream(), RDNumeric::Matrix< double >::transpose(), and Queries::Query< int, Atom const *, true >::TypeConvert().

## ◆ RANGE_CHECK

#define RANGE_CHECK | ( |  | lo,
|  |  | x,
|  |  | hi )

Value:
if ((lo) > (hi) || (x) < (lo) || (x) > (hi)) { \
std::stringstream errstr; \
errstr << lo << " <= " << x << " <= " << hi; \
Invar::Invariant inv("Range Error", #x, errstr.str().c_str(), __FILE__, \
__LINE__); \
BOOST_LOG(rdErrorLog) << "\n\n****\n" << inv << "****\n" << std::endl; \
throw inv; \
}

Definition at line 131 of file Invariant.h.

## ◆ rdcast

#define rdcast static_cast

Definition at line 191 of file Invariant.h.

Referenced by RDKit::ChemicalReaction::addAgentTemplate(), RDKit::FPHolderBase::addFingerprint(), RDKit::FPHolderBase::addMol(), RDKit::ChemicalReaction::addProductTemplate(), RDKit::ChemicalReaction::addReactantTemplate(), RDKit::Conformer::getAtomPos(), RDKit::Conformer::getAtomPos(), RDKit::ROMol::getAtomWithIdx(), RDKit::ROMol::getAtomWithIdx(), RDKit::ROMol::getBondBetweenAtoms(), RDKit::ROMol::getBondBetweenAtoms(), RDKit::ROMol::getBondWithIdx(), RDKit::ROMol::getBondWithIdx(), RDKit::ChemicalReaction::getNumAgentTemplates(), RDKit::Conformer::getNumAtoms(), RDKit::ROMol::getNumAtoms(), RDKit::ROMol::getNumConformers(), RDKit::ChemicalReaction::getNumProductTemplates(), RDKit::ChemicalReaction::getNumReactantTemplates(), Rankers::rankVect(), RDKit::ROMol::ROMol(), RDKit::Conformer::setAtomPos(), RDKit::Atom::setIdx(), Queries::SetQuery< int, Atom const *, true >::size(), RDKit::CachedMolHolder::size(), RDKit::CachedSmilesMolHolder::size(), RDKit::CachedTrustedSmilesMolHolder::size(), RDKit::FPHolderBase::size(), RDKit::MolHolder::size(), and RDKit::SubstructLibrary::size().

## ◆ RDUNUSED_PARAM

#define RDUNUSED_PARAM | ( |  | x | ) |

Value:
(void)x;

Definition at line 196 of file Invariant.h.

Referenced by RDKit::getNumThreadsToUse(), RDKit::MolBundle::initFromStream(), BFGSOpt::minimize(), RDKit::MolDraw2D_detail::DrawText::setFontFile(), RDKit::streamRead(), RDKit::streamRead(), RDKit::MolDraw2D::tagAtoms(), RDDataManip::TanimotoDistanceMetric(), RDDataManip::TanimotoSimilarityMetric(), RDKit::MolBundle::toStream(), and RDKit::TverskySimilarity().

## ◆ TEST_ASSERT

#define TEST_ASSERT | ( |  | expr | ) |

Value:
if (!(expr)) { \
Invar::Invariant inv("Test Assert", "Expression Failed: ", #expr, \
__FILE__, __LINE__); \
BOOST_LOG(rdErrorLog) << "\n\n****\n" << inv << "****\n" << std::endl; \
; \
throw inv; \
}

Definition at line 151 of file Invariant.h.

Referenced by boost_adaptbx::python::streambuf::streambuf().

## ◆ UNDER_CONSTRUCTION

#define UNDER_CONSTRUCTION | ( |  | fn | ) |

Value:
Invar::Invariant inv("Incomplete Code", \
"This routine is still under development", fn, \
__FILE__, __LINE__); \
BOOST_LOG(rdErrorLog) << "\n\n****\n" << inv << "****\n" << std::endl; \
throw inv;

Definition at line 124 of file Invariant.h.

Referenced by RDKit::MolEnumerator::utils::getMolLinkNodes().

## ◆ URANGE_CHECK

#define URANGE_CHECK | ( |  | x,
|  |  | hi )

Value:
if (x >= (hi)) { \
std::stringstream errstr; \
errstr << x << " < " << hi; \
Invar::Invariant inv("Range Error", #x, errstr.str().c_str(), __FILE__, \
__LINE__); \
BOOST_LOG(rdErrorLog) << "\n\n****\n" << inv << "****\n" << std::endl; \
throw inv; \
}

Definition at line 141 of file Invariant.h.

Referenced by RDCatalog::HierarchCatalog< FragCatalogEntry, FragCatParams, int >::addEdge(), RDCatalog::HierarchCatalog< FragCatalogEntry, FragCatParams, int >::getEntryWithBitId(), RDCatalog::HierarchCatalog< FragCatalogEntry, FragCatParams, int >::getEntryWithIdx(), RDCatalog::HierarchCatalog< FragCatalogEntry, FragCatParams, int >::getIdOfEntryWithBitId(), RDKit::MMFF::MMFFMolProperties::getMMFFAtomType(), RDKit::MMFF::MMFFMolProperties::getMMFFFormalCharge(), RDKit::MMFF::MMFFMolProperties::getMMFFPartialCharge(), RDNumeric::SymmMatrix< double >::getVal(), and RDNumeric::SymmMatrix< double >::setVal().