Chemical Data Processing Library C++ API - Version 1.4.0
Public Member Functions | Friends | List of all members
CDPL::Chem::BasicBond Class Reference

Default implementation of the Chem::Bond interface. More...

#include <BasicBond.hpp>

+ Inheritance diagram for CDPL::Chem::BasicBond:

Public Member Functions

std::size_t getNumAtoms () const
 Returns the number of atoms incident to this bond (always 2). More...
 
const MoleculegetMolecule () const
 Returns the parent molecule. More...
 
MoleculegetMolecule ()
 Returns the parent molecule. More...
 
const AtomgetBegin () const
 Returns the first atom of the bond. More...
 
AtomgetBegin ()
 Returns the first atom of the bond. More...
 
const AtomgetEnd () const
 Returns the second atom of the bond. More...
 
AtomgetEnd ()
 Returns the second atom of the bond. More...
 
const AtomgetAtom (std::size_t idx) const
 Returns the bond atom at index idx. More...
 
AtomgetAtom (std::size_t idx)
 Returns the bond atom at index idx. More...
 
bool containsAtom (const Atom &atom) const
 Tells whether atom is one of the two bonded atoms. More...
 
std::size_t getAtomIndex (const Atom &atom) const
 Returns the index of atom within this bond. More...
 
const AtomgetNeighbor (const Atom &atom) const
 Returns the atom on the opposite side of atom. More...
 
AtomgetNeighbor (const Atom &atom)
 Returns the atom on the opposite side of atom. More...
 
std::size_t getIndex () const
 Returns the zero-based index of this bond within the parent molecule. More...
 
void orderAtoms (const AtomCompareFunction &func)
 Reorders the begin/end atoms of this bond according to the comparison function func. More...
 
BasicBondoperator= (const BasicBond &bond)
 Assignment operator that replaces the current set of properties with the properties of bond;. More...
 
Bondoperator= (const Bond &bond)
 Assignment operator that replaces the current set of properties with the properties of bond;. More...
 
- Public Member Functions inherited from CDPL::Chem::Bond
Bondoperator= (const Bond &bond)
 Assignment operator that replaces the current set of properties with the properties of bond;. More...
 
ConstAtomIterator getAtomsBegin () const
 Returns a constant iterator pointing to the beginning of the stored const Chem::Atom objects. More...
 
AtomIterator getAtomsBegin ()
 Returns a mutable iterator pointing to the beginning of the stored Chem::Atom objects. More...
 
ConstAtomIterator getAtomsEnd () const
 Returns a constant iterator pointing to the end of the stored const Chem::Atom objects. More...
 
AtomIterator getAtomsEnd ()
 Returns a mutable iterator pointing to the end of the stored Chem::Atom objects. More...
 
- Public Member Functions inherited from CDPL::Chem::AtomContainer
ConstAtomIterator getAtomsBegin () const
 Returns a constant iterator pointing to the beginning of the stored const Chem::Atom objects. More...
 
ConstAtomIterator getAtomsEnd () const
 Returns a constant iterator pointing to the end of the stored const Chem::Atom objects. More...
 
AtomIterator getAtomsBegin ()
 Returns a mutable iterator pointing to the beginning of the stored Chem::Atom objects. More...
 
AtomIterator getAtomsEnd ()
 Returns a mutable iterator pointing to the end of the stored Chem::Atom objects. More...
 
ConstAtomIterator begin () const
 Returns a constant iterator pointing to the beginning of the stored const Chem::Atom objects. More...
 
ConstAtomIterator end () const
 Returns a constant iterator pointing to the end of the stored const Chem::Atom objects. More...
 
AtomIterator begin ()
 Returns a mutable iterator pointing to the beginning of the stored Chem::Atom objects. More...
 
AtomIterator end ()
 Returns a mutable iterator pointing to the end of the stored Chem::Atom objects. More...
 
virtual std::size_t getNumEntities () const
 Returns the number of stored Chem::Entity3D objects (equivalent to getNumAtoms()). More...
 
virtual const Entity3DgetEntity (std::size_t idx) const
 Returns a const reference to the Chem::Entity3D instance at index idx (equivalent to getAtom(idx)). More...
 
virtual Entity3DgetEntity (std::size_t idx)
 Returns a non-const reference to the Chem::Entity3D instance at index idx (equivalent to getAtom(idx)). More...
 
const AtomContainergetAtoms () const
 Returns a const reference to itself. More...
 
AtomContainergetAtoms ()
 Returns a reference to itself. More...
 
- Public Member Functions inherited from CDPL::Chem::Entity3DContainer
ConstEntityIterator getEntitiesBegin () const
 Returns a constant iterator pointing to the beginning of the stored const Chem::Entity3D objects. More...
 
ConstEntityIterator getEntitiesEnd () const
 Returns a constant iterator pointing to the end of the stored const Chem::Entity3D objects. More...
 
EntityIterator getEntitiesBegin ()
 Returns a mutable iterator pointing to the beginning of the stored Chem::Entity3D objects. More...
 
EntityIterator getEntitiesEnd ()
 Returns a mutable iterator pointing to the end of the stored Chem::Entity3D objects. More...
 
ConstEntityIterator begin () const
 Returns a constant iterator pointing to the beginning of the stored const Chem::Entity3D objects. More...
 
ConstEntityIterator end () const
 Returns a constant iterator pointing to the end of the stored const Chem::Entity3D objects. More...
 
EntityIterator begin ()
 Returns a mutable iterator pointing to the beginning of the stored Chem::Entity3D objects. More...
 
EntityIterator end ()
 Returns a mutable iterator pointing to the end of the stored Chem::Entity3D objects. More...
 
const Entity3DContainergetEntities () const
 Returns a const reference to itself. More...
 
Entity3DContainergetEntities ()
 Returns a reference to itself. More...
 
- Public Member Functions inherited from CDPL::Base::PropertyContainer
std::size_t getNumProperties () const
 Returns the number of property entries. More...
 
template<typename T >
void setProperty (const LookupKey &key, T &&val)
 Sets the value of the property specified by key to val. More...
 
template<typename T >
const T & getProperty (const LookupKey &key) const
 Returns the value of the property specified by key as a const reference to an object of type T. More...
 
template<typename T >
const T & getPropertyOrDefault (const LookupKey &key, const T &def_val) const
 Returns the value of the property specified by key as a const reference to an object of type T, or the default value def_val if a stored value does not exist. More...
 
const AnygetProperty (const LookupKey &key, bool throw_=false) const
 Returns the value of the property specified by key. More...
 
bool isPropertySet (const LookupKey &key) const
 Tells whether or not a value has been assigned to the property specified by key. More...
 
ConstPropertyIterator getPropertiesBegin () const
 Returns a constant iterator pointing to the beginning of the property entries. More...
 
ConstPropertyIterator getPropertiesEnd () const
 Returns a constant iterator pointing to the end of the property entries. More...
 
ConstPropertyIterator begin () const
 Returns a constant iterator pointing to the beginning of the property entries. More...
 
ConstPropertyIterator end () const
 Returns a constant iterator pointing to the end of the property entries. More...
 
bool removeProperty (const LookupKey &key)
 Clears the value of the property specified by key. More...
 
void clearProperties ()
 Clears all property values. More...
 
void addProperties (const PropertyContainer &cntnr)
 Adds the property value entries in the PropertyContainer instance cntnr. More...
 
void copyProperties (const PropertyContainer &cntnr)
 Replaces the current set of properties by a copy of the entries in cntnr. More...
 
void swap (PropertyContainer &cntnr)
 Exchanges the properties of this container with the properties of the container cntnr. More...
 
const PropertyContainergetProperties () const
 Returns a const reference to itself. More...
 

Friends

class BasicMolecule
 
class BasicAtom
 

Additional Inherited Members

- Public Types inherited from CDPL::Chem::Bond
typedef AtomContainer::AtomIterator AtomIterator
 A mutable random access iterator used to iterate over the connected atoms. More...
 
typedef AtomContainer::ConstAtomIterator ConstAtomIterator
 A constant random access iterator used to iterate over the connected atoms. More...
 
- Public Types inherited from CDPL::Chem::AtomContainer
typedef Util::IndexedElementIterator< const Atom, ConstAtomAccessor > ConstAtomIterator
 A constant random access iterator used to iterate over the stored const Chem::Atom objects. More...
 
typedef Util::IndexedElementIterator< Atom, AtomAccessor > AtomIterator
 A mutable random access iterator used to iterate over the stored Chem::Atom objects. More...
 
- Public Types inherited from CDPL::Chem::Entity3DContainer
typedef Util::IndexedElementIterator< const Entity3D, ConstEntityAccessor > ConstEntityIterator
 A constant random access iterator used to iterate over the stored const Chem::Entity3D objects. More...
 
typedef Util::IndexedElementIterator< Entity3D, EntityAccessor > EntityIterator
 A mutable random access iterator used to iterate over the stored Chem::Entity3D objects. More...
 
- Public Types inherited from CDPL::Base::PropertyContainer
typedef PropertyMap::value_type PropertyEntry
 A Base::LookupKey / Base::Any pair that stores the property value for a given property key. More...
 
typedef PropertyMap::const_iterator ConstPropertyIterator
 A constant iterator used to iterate over the property entries. More...
 
- Protected Member Functions inherited from CDPL::Chem::Bond
virtual ~Bond ()
 Virtual destructor. More...
 
- Protected Member Functions inherited from CDPL::Chem::AtomContainer
virtual ~AtomContainer ()
 Virtual destructor. More...
 
AtomContaineroperator= (const AtomContainer &cntnr)
 Assignment operator. More...
 
- Protected Member Functions inherited from CDPL::Chem::Entity3DContainer
virtual ~Entity3DContainer ()
 Virtual destructor. More...
 
Entity3DContaineroperator= (const Entity3DContainer &cntnr)
 Assignment operator. More...
 
- Protected Member Functions inherited from CDPL::Base::PropertyContainer
 PropertyContainer ()
 Constructs an empty PropertyContainer instance. More...
 
 PropertyContainer (const PropertyContainer &cntnr)
 Constructs a copy of the PropertyContainer instance cntnr. More...
 
virtual ~PropertyContainer ()
 Virtual destructor. More...
 
PropertyContaineroperator= (const PropertyContainer &cntnr)
 Assignment operator. More...
 

Detailed Description

Default implementation of the Chem::Bond interface.

Instances of BasicBond are owned and constructed exclusively by a Chem::BasicMolecule instance and reference two Chem::BasicAtom instances that represent the bonded atoms.

Member Function Documentation

◆ getNumAtoms()

std::size_t CDPL::Chem::BasicBond::getNumAtoms ( ) const
virtual

Returns the number of atoms incident to this bond (always 2).

Returns
The atom count (2).

Implements CDPL::Chem::Bond.

◆ getMolecule() [1/2]

const Molecule& CDPL::Chem::BasicBond::getMolecule ( ) const
virtual

Returns the parent molecule.

Returns
A const reference to the parent molecule.

Implements CDPL::Chem::Bond.

◆ getMolecule() [2/2]

Molecule& CDPL::Chem::BasicBond::getMolecule ( )
virtual

Returns the parent molecule.

Returns
A reference to the parent molecule.

Implements CDPL::Chem::Bond.

◆ getBegin() [1/2]

const Atom& CDPL::Chem::BasicBond::getBegin ( ) const
virtual

Returns the first atom of the bond.

Returns
A const reference to the first atom.

Implements CDPL::Chem::Bond.

◆ getBegin() [2/2]

Atom& CDPL::Chem::BasicBond::getBegin ( )
virtual

Returns the first atom of the bond.

Returns
A reference to the first atom.

Implements CDPL::Chem::Bond.

◆ getEnd() [1/2]

const Atom& CDPL::Chem::BasicBond::getEnd ( ) const
virtual

Returns the second atom of the bond.

Returns
A const reference to the second atom.

Implements CDPL::Chem::Bond.

◆ getEnd() [2/2]

Atom& CDPL::Chem::BasicBond::getEnd ( )
virtual

Returns the second atom of the bond.

Returns
A reference to the second atom.

Implements CDPL::Chem::Bond.

◆ getAtom() [1/2]

const Atom& CDPL::Chem::BasicBond::getAtom ( std::size_t  idx) const
virtual

Returns the bond atom at index idx.

Parameters
idxThe zero-based atom index (0 = begin, 1 = end).
Returns
A const reference to the atom.
Exceptions
Base::IndexErrorif idx is not in the range [0, 1].

Implements CDPL::Chem::Bond.

◆ getAtom() [2/2]

Atom& CDPL::Chem::BasicBond::getAtom ( std::size_t  idx)
virtual

Returns the bond atom at index idx.

Parameters
idxThe zero-based atom index (0 = begin, 1 = end).
Returns
A reference to the atom.
Exceptions
Base::IndexErrorif idx is not in the range [0, 1].

Implements CDPL::Chem::Bond.

◆ containsAtom()

bool CDPL::Chem::BasicBond::containsAtom ( const Atom atom) const
virtual

Tells whether atom is one of the two bonded atoms.

Parameters
atomThe atom to test.
Returns
true if atom is incident to this bond, and false otherwise.

Implements CDPL::Chem::Bond.

◆ getAtomIndex()

std::size_t CDPL::Chem::BasicBond::getAtomIndex ( const Atom atom) const
virtual

Returns the index of atom within this bond.

Parameters
atomThe atom whose index is requested.
Returns
The atom index (0 for the begin atom, 1 for the end atom).
Exceptions
Base::ItemNotFoundif atom is not incident to this bond.

Implements CDPL::Chem::Bond.

◆ getNeighbor() [1/2]

const Atom& CDPL::Chem::BasicBond::getNeighbor ( const Atom atom) const
virtual

Returns the atom on the opposite side of atom.

Parameters
atomOne of the two bonded atoms.
Returns
A const reference to the other bonded atom.
Exceptions
Base::ItemNotFoundif atom is not incident to this bond.

Implements CDPL::Chem::Bond.

◆ getNeighbor() [2/2]

Atom& CDPL::Chem::BasicBond::getNeighbor ( const Atom atom)
virtual

Returns the atom on the opposite side of atom.

Parameters
atomOne of the two bonded atoms.
Returns
A reference to the other bonded atom.
Exceptions
Base::ItemNotFoundif atom is not incident to this bond.

Implements CDPL::Chem::Bond.

◆ getIndex()

std::size_t CDPL::Chem::BasicBond::getIndex ( ) const
virtual

Returns the zero-based index of this bond within the parent molecule.

Returns
The bond index.

Implements CDPL::Chem::Bond.

◆ orderAtoms()

void CDPL::Chem::BasicBond::orderAtoms ( const AtomCompareFunction func)
virtual

Reorders the begin/end atoms of this bond according to the comparison function func.

Parameters
funcThe comparison function defining the desired order.

Implements CDPL::Chem::AtomContainer.

◆ operator=() [1/2]

BasicBond& CDPL::Chem::BasicBond::operator= ( const BasicBond bond)

Assignment operator that replaces the current set of properties with the properties of bond;.

Parameters
bondThe bond whose properties get copied.
Returns
A reference to itself.

◆ operator=() [2/2]

Bond& CDPL::Chem::Bond::operator=

Assignment operator that replaces the current set of properties with the properties of bond;.

Parameters
bondThe bond whose properties get copied.
Returns
A reference to itself.

Friends And Related Function Documentation

◆ BasicMolecule

friend class BasicMolecule
friend

◆ BasicAtom

friend class BasicAtom
friend

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