Chemical Data Processing Library C++ API - Version 1.3.0
Classes | Public Types | Public Member Functions | Protected Member Functions | List of all members
CDPL::Chem::BondContainer Class Referenceabstract

A common interface for data-structures that support a random access to stored Chem::Bond instances. More...

#include <BondContainer.hpp>

+ Inheritance diagram for CDPL::Chem::BondContainer:

Public Types

typedef Util::IndexedElementIterator< const Bond, ConstBondAccessor > ConstBondIterator
 A constant random access iterator used to iterate over the stored const Chem::Bond objects. More...
 
typedef Util::IndexedElementIterator< Bond, BondAccessor > BondIterator
 A mutable random access iterator used to iterate over the stored Chem::Bond objects. More...
 

Public Member Functions

virtual std::size_t getNumBonds () const =0
 Returns the number of stored Chem::Bond objects. More...
 
virtual const Bond & getBond (std::size_t idx) const =0
 Returns a const reference to the Chem::Bond instance at index idx. More...
 
virtual Bond & getBond (std::size_t idx)=0
 Returns a non-const reference to the bond at index idx. More...
 
ConstBondIterator getBondsBegin () const
 Returns a constant iterator pointing to the beginning of the stored const Chem::Bond objects. More...
 
ConstBondIterator getBondsEnd () const
 Returns a constant iterator pointing to the end of the stored const Chem::Bond objects. More...
 
BondIterator getBondsBegin ()
 Returns a mutable iterator pointing to the beginning of the stored Chem::Bond objects. More...
 
BondIterator getBondsEnd ()
 Returns a mutable iterator pointing to the end of the stored Chem::Bond objects. More...
 
ConstBondIterator begin () const
 Returns a constant iterator pointing to the beginning of the stored const Chem::Bond objects. More...
 
ConstBondIterator end () const
 Returns a constant iterator pointing to the end of the stored const Chem::Bond objects. More...
 
BondIterator begin ()
 Returns a mutable iterator pointing to the beginning of the stored Chem::Bond objects. More...
 
BondIterator end ()
 Returns a mutable iterator pointing to the end of the stored Chem::Bond objects. More...
 
virtual bool containsBond (const Bond &bond) const =0
 Tells whether the specified Chem::Bond instance is stored in this container. More...
 
virtual std::size_t getBondIndex (const Bond &bond) const =0
 Returns the index of the specified Chem::Bond instance in this container. More...
 
virtual void orderBonds (const BondCompareFunction &func)=0
 Orders the stored bonds according to criteria implemented by the provided bond comparison function. More...
 
const BondContainer & getBonds () const
 Returns a const reference to itself. More...
 
BondContainer & getBonds ()
 Returns a reference to itself. More...
 

Protected Member Functions

virtual ~BondContainer ()
 Virtual destructor. More...
 
BondContainer & operator= (const BondContainer &cntnr)
 Assignment operator. More...
 

Detailed Description

A common interface for data-structures that support a random access to stored Chem::Bond instances.

Implementations have to guarantee that a given Chem::Bond object is stored only once and its index is unique amongst all contained Chem::Bond instances. Otherwise algorithms that rely on this behaviour may not work correctly!

Member Typedef Documentation

◆ ConstBondIterator

A constant random access iterator used to iterate over the stored const Chem::Bond objects.

◆ BondIterator

A mutable random access iterator used to iterate over the stored Chem::Bond objects.

Constructor & Destructor Documentation

◆ ~BondContainer()

virtual CDPL::Chem::BondContainer::~BondContainer ( )
inlineprotectedvirtual

Virtual destructor.

Member Function Documentation

◆ getNumBonds()

virtual std::size_t CDPL::Chem::BondContainer::getNumBonds ( ) const
pure virtual

Returns the number of stored Chem::Bond objects.

Returns
The number of stored Chem::Bond objects.

Implemented in CDPL::Chem::Molecule, CDPL::Chem::Atom, CDPL::ConfGen::CanonicalFragment, CDPL::Chem::Fragment, CDPL::Chem::BasicMolecule, and CDPL::Chem::BasicAtom.

◆ getBond() [1/2]

virtual const Bond& CDPL::Chem::BondContainer::getBond ( std::size_t  idx) const
pure virtual

Returns a const reference to the Chem::Bond instance at index idx.

Parameters
idxThe zero-based index of the Chem::Bond instance to return.
Returns
A const reference to the Chem::Bond instance at the specified index.
Exceptions
Base::IndexErrorif the container is empty or idx is not in the range [0, getNumBonds() - 1].

Implemented in CDPL::Chem::Molecule, CDPL::Chem::Atom, CDPL::ConfGen::CanonicalFragment, CDPL::Chem::Fragment, CDPL::Chem::BasicMolecule, and CDPL::Chem::BasicAtom.

◆ getBond() [2/2]

virtual Bond& CDPL::Chem::BondContainer::getBond ( std::size_t  idx)
pure virtual

Returns a non-const reference to the bond at index idx.

Parameters
idxThe zero-based index of the Chem::Bond instance to return.
Returns
A non-const reference to the bond at the specified index.
Exceptions
Base::IndexErrorif the number of bonds is zero or idx is not in the range [0, getNumBonds() - 1].

Implemented in CDPL::Chem::Molecule, CDPL::Chem::Atom, CDPL::ConfGen::CanonicalFragment, CDPL::Chem::Fragment, CDPL::Chem::BasicMolecule, and CDPL::Chem::BasicAtom.

◆ getBondsBegin() [1/2]

ConstBondIterator CDPL::Chem::BondContainer::getBondsBegin ( ) const

Returns a constant iterator pointing to the beginning of the stored const Chem::Bond objects.

Returns
A constant iterator pointing to the beginning of the stored const Chem::Bond objects.

◆ getBondsEnd() [1/2]

ConstBondIterator CDPL::Chem::BondContainer::getBondsEnd ( ) const

Returns a constant iterator pointing to the end of the stored const Chem::Bond objects.

Returns
A constant iterator pointing to the end of the stored const Chem::Bond objects.

◆ getBondsBegin() [2/2]

BondIterator CDPL::Chem::BondContainer::getBondsBegin ( )

Returns a mutable iterator pointing to the beginning of the stored Chem::Bond objects.

Returns
A mutable iterator pointing to the beginning of the stored Chem::Bond objects.

◆ getBondsEnd() [2/2]

BondIterator CDPL::Chem::BondContainer::getBondsEnd ( )

Returns a mutable iterator pointing to the end of the stored Chem::Bond objects.

Returns
A mutable iterator pointing to the end of the stored Chem::Bond objects.

◆ begin() [1/2]

ConstBondIterator CDPL::Chem::BondContainer::begin ( ) const

Returns a constant iterator pointing to the beginning of the stored const Chem::Bond objects.

Returns
A constant iterator pointing to the beginning of the stored const Chem::Bond objects.

◆ end() [1/2]

ConstBondIterator CDPL::Chem::BondContainer::end ( ) const

Returns a constant iterator pointing to the end of the stored const Chem::Bond objects.

Returns
A constant iterator pointing to the end of the stored const Chem::Bond objects.

◆ begin() [2/2]

BondIterator CDPL::Chem::BondContainer::begin ( )

Returns a mutable iterator pointing to the beginning of the stored Chem::Bond objects.

Returns
A mutable iterator pointing to the beginning of the stored Chem::Bond objects.

◆ end() [2/2]

BondIterator CDPL::Chem::BondContainer::end ( )

Returns a mutable iterator pointing to the end of the stored Chem::Bond objects.

Returns
A mutable iterator pointing to the end of the stored Chem::Bond objects.

◆ containsBond()

virtual bool CDPL::Chem::BondContainer::containsBond ( const Bond &  bond) const
pure virtual

Tells whether the specified Chem::Bond instance is stored in this container.

Parameters
bondThe Chem::Bond instance to look for.
Returns
true if bond is stored in the container, and false otherwise.

Implemented in CDPL::ConfGen::CanonicalFragment, CDPL::Chem::Molecule, CDPL::Chem::Atom, CDPL::Chem::Fragment, CDPL::Chem::BasicMolecule, and CDPL::Chem::BasicAtom.

◆ getBondIndex()

virtual std::size_t CDPL::Chem::BondContainer::getBondIndex ( const Bond &  bond) const
pure virtual

Returns the index of the specified Chem::Bond instance in this container.

Parameters
bondThe Chem::Bond instance for which to return the index.
Returns
The zero-based index of the specified Chem::Bond instance.
Exceptions
Base::ItemNotFoundif the specified Chem::Bond instance could not be found.

Implemented in CDPL::ConfGen::CanonicalFragment, CDPL::Chem::Molecule, CDPL::Chem::Atom, CDPL::Chem::Fragment, CDPL::Chem::BasicMolecule, and CDPL::Chem::BasicAtom.

◆ orderBonds()

virtual void CDPL::Chem::BondContainer::orderBonds ( const BondCompareFunction &  func)
pure virtual

Orders the stored bonds according to criteria implemented by the provided bond comparison function.

Parameters
funcThe bond comparison function implementing the applied ordering criteria.

Implemented in CDPL::ConfGen::CanonicalFragment, CDPL::Chem::Fragment, CDPL::Chem::BasicMolecule, and CDPL::Chem::BasicAtom.

◆ getBonds() [1/2]

const BondContainer& CDPL::Chem::BondContainer::getBonds ( ) const
inline

Returns a const reference to itself.

Returns
A const reference to itself.

◆ getBonds() [2/2]

BondContainer& CDPL::Chem::BondContainer::getBonds ( )
inline

Returns a reference to itself.

Returns
A reference to itself.

◆ operator=()

BondContainer& CDPL::Chem::BondContainer::operator= ( const BondContainer &  cntnr)
protected

Assignment operator.

Parameters
cntnrThe other container to copy.
Returns
A reference to itself.

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