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

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 instances. More...
 
typedef Util::IndexedElementIterator< Bond, BondAccessor > BondIterator
 A mutable random access iterator used to iterate over the stored Chem::Bond instances. More...
 

Public Member Functions

virtual std::size_t getNumBonds () const =0
 Returns the number of bonds. More...
 
virtual const Bond & getBond (std::size_t idx) const =0
 Returns a const reference to the bond 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 instances. More...
 
ConstBondIterator getBondsEnd () const
 Returns a constant iterator pointing to the end of the stored const Chem::Bond instances. More...
 
BondIterator getBondsBegin ()
 Returns a mutable iterator pointing to the beginning of the stored Chem::Bond instances. More...
 
BondIterator getBondsEnd ()
 Returns a mutable iterator pointing to the end of the stored Chem::Bond instances. More...
 
ConstBondIterator begin () const
 Returns a constant iterator pointing to the beginning of the stored const Chem::Bond instances. More...
 
ConstBondIterator end () const
 Returns a constant iterator pointing to the end of the stored const Chem::Bond instances. More...
 
BondIterator begin ()
 Returns a mutable iterator pointing to the beginning of the stored Chem::Bond instances. More...
 
BondIterator end ()
 Returns a mutable iterator pointing to the end of the stored Chem::Bond instances. More...
 
virtual bool containsBond (const Bond &bond) const =0
 Tells whether the specified bond is part of the bond sequence. More...
 
virtual std::size_t getBondIndex (const Bond &bond) const =0
 Returns the index of the specified bond. More...
 
virtual void orderBonds (const BondCompareFunction &func)=0
 Orders the 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)
 Replaces the current set of properties by a copy of the properties of the container cntnr. More...
 

Detailed Description

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

Implementations have to guarantee that a given Chem::Bond instance 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 instances.

◆ BondIterator

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

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 bonds.

Returns
The number of bonds.

Implemented in 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 bond at index idx.

Parameters
idxThe zero-based index of the bond to return.
Returns
A const reference to the bond at the specified index.
Exceptions
Base::IndexErrorif idx is not in the range [0, getNumBonds()).

Implemented in 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 bond to return.
Returns
A non-const reference to the bond at the specified index.
Exceptions
Base::IndexErrorif idx is not in the range [0, getNumBonds()).

Implemented in 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 instances.

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

◆ getBondsEnd() [1/2]

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

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

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

◆ getBondsBegin() [2/2]

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

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

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

◆ getBondsEnd() [2/2]

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

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

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

◆ begin() [1/2]

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

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

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

◆ end() [1/2]

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

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

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

◆ begin() [2/2]

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

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

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

◆ end() [2/2]

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

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

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

◆ containsBond()

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

Tells whether the specified bond is part of the bond sequence.

Parameters
bondThe bond to look for.
Returns
true if bond is part of the sequence, and false otherwise.

Implemented in CDPL::ConfGen::CanonicalFragment, 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 bond.

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

Implemented in CDPL::ConfGen::CanonicalFragment, 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 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

Replaces the current set of properties by a copy of the properties of the container cntnr.

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

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