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

Concrete Chem::Molecule implementation that owns Chem::BasicAtom and Chem::BasicBond instances. More...

#include <BasicMolecule.hpp>

+ Inheritance diagram for CDPL::Chem::BasicMolecule:

Public Types

typedef std::shared_ptr< BasicMoleculeSharedPointer
 A reference-counted smart pointer [SHPTR] for dynamically allocated BasicMolecule instances. More...
 
typedef boost::indirect_iterator< AtomList::iterator, BasicAtomAtomIterator
 Mutable random-access iterator over the atoms of the molecule. More...
 
typedef boost::indirect_iterator< AtomList::const_iterator, const BasicAtomConstAtomIterator
 Constant random-access iterator over the atoms of the molecule. More...
 
typedef boost::indirect_iterator< BondList::iterator, BasicBondBondIterator
 Mutable random-access iterator over the bonds of the molecule. More...
 
typedef boost::indirect_iterator< BondList::const_iterator, const BasicBondConstBondIterator
 Constant random-access iterator over the bonds of the molecule. More...
 
- Public Types inherited from CDPL::Chem::Molecule
typedef std::shared_ptr< MoleculeSharedPointer
 A reference-counted smart pointer [SHPTR] for dynamically allocated Molecule instances. More...
 
typedef AtomContainer::ConstAtomIterator ConstAtomIterator
 A constant random access iterator used to iterate over the atoms of the molecule. More...
 
typedef AtomContainer::AtomIterator AtomIterator
 A mutable random access iterator used to iterate over the atoms of the molecule. More...
 
typedef BondContainer::ConstBondIterator ConstBondIterator
 A constant random access iterator used to iterate over the bonds of the molecule. More...
 
typedef BondContainer::BondIterator BondIterator
 A mutable random access iterator used to iterate over the bonds of the molecule. More...
 
typedef std::function< void(Molecule &, const MolecularGraph &)> CopyPostprocessingFunction
 Type of a callback invoked after a molecule has been copied from a source molecular graph (first argument: the freshly populated destination molecule; second argument: the source graph). More...
 
- Public Types inherited from CDPL::Chem::MolecularGraph
typedef std::shared_ptr< MolecularGraphSharedPointer
 A reference-counted smart pointer [SHPTR] for dynamically allocated MolecularGraph instances. 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::Chem::BondContainer
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 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...
 

Public Member Functions

 BasicMolecule ()
 Constructs an empty BasicMolecule instance. More...
 
 BasicMolecule (const BasicMolecule &mol)
 Constructs a copy of the BasicMolecule instance mol. More...
 
 BasicMolecule (const Molecule &mol)
 Constructs a copy of the Chem::Molecule instance mol. More...
 
 BasicMolecule (const MolecularGraph &molgraph)
 Constructs a BasicMolecule instance with copies of the atoms and bonds of the Chem::MolecularGraph instance molgraph. More...
 
 ~BasicMolecule ()
 Destructor. More...
 
void clear ()
 Removes all atoms, bonds, and properties of the molecule. More...
 
std::size_t getNumAtoms () const
 Returns the number of atoms in the molecule. More...
 
std::size_t getNumBonds () const
 Returns the number of bonds in the molecule. More...
 
ConstAtomIterator getAtomsBegin () const
 Returns a constant iterator pointing to the beginning of the atoms. More...
 
AtomIterator getAtomsBegin ()
 Returns a mutable iterator pointing to the beginning of the atoms. More...
 
ConstAtomIterator getAtomsEnd () const
 Returns a constant iterator pointing to the end of the atoms. More...
 
AtomIterator getAtomsEnd ()
 Returns a mutable iterator pointing to the end of the atoms. More...
 
ConstBondIterator getBondsBegin () const
 Returns a constant iterator pointing to the beginning of the bonds. More...
 
BondIterator getBondsBegin ()
 Returns a mutable iterator pointing to the beginning of the bonds. More...
 
ConstBondIterator getBondsEnd () const
 Returns a constant iterator pointing to the end of the bonds. More...
 
BondIterator getBondsEnd ()
 Returns a mutable iterator pointing to the end of the bonds. More...
 
const BasicAtomgetAtom (std::size_t idx) const
 Returns a const reference to the atom at index idx. More...
 
BasicAtomgetAtom (std::size_t idx)
 Returns a mutable reference to the atom at index idx. More...
 
BasicAtomaddAtom ()
 Creates and appends a new atom and returns a reference to it. More...
 
void removeAtom (std::size_t idx)
 Removes the atom at index idx (along with any incident bonds). More...
 
AtomIterator removeAtom (const AtomIterator &it)
 Removes the atom specified by the iterator it. More...
 
const BasicBondgetBond (std::size_t idx) const
 Returns a const reference to the bond at index idx. More...
 
BasicBondgetBond (std::size_t idx)
 Returns a mutable reference to the bond at index idx. More...
 
BasicBondaddBond (std::size_t atom1_idx, std::size_t atom2_idx)
 Creates a new bond between the atoms at indices atom1_idx and atom2_idx and returns a reference to it. More...
 
void removeBond (std::size_t idx)
 Removes the bond at index idx. More...
 
BondIterator removeBond (const BondIterator &it)
 Removes the bond specified by the iterator it. More...
 
bool containsAtom (const Atom &atom) const
 Tells whether atom is part of this molecule. More...
 
bool containsBond (const Bond &bond) const
 Tells whether bond is part of this molecule. More...
 
std::size_t getAtomIndex (const Atom &atom) const
 Returns the index of atom atom in this molecule. More...
 
std::size_t getBondIndex (const Bond &bond) const
 Returns the index of bond bond in this molecule. More...
 
void orderAtoms (const AtomCompareFunction &func)
 Reorders the atom list using the binary comparator func. More...
 
void orderBonds (const BondCompareFunction &func)
 Reorders the bond list using the binary comparator func. More...
 
BasicMoleculeoperator= (const BasicMolecule &mol)
 Replaces the current set of atoms, bonds and properties by a copy of the atoms, bonds and properties of the molecule mol. More...
 
BasicMoleculeoperator+= (const BasicMolecule &mol)
 Extends the current set of atoms and bonds by a copy of the atoms and bonds in the molecule mol. More...
 
MolecularGraph::SharedPointer clone () const
 Creates a copy of the molecular graph. More...
 
void copy (const BasicMolecule &mol)
 Replaces the current set of atoms, bonds and properties by a copy of the atoms, bonds and properties of the molecule mol. More...
 
void copy (const Molecule &mol)
 Replaces the current set of atoms, bonds and properties by a copy of mol. More...
 
void copy (const MolecularGraph &molgraph)
 Replaces the current set of atoms, bonds and properties by a copy of molgraph. More...
 
void append (const BasicMolecule &mol)
 Extends the current set of atoms and bonds by a copy of the atoms and bonds in the molecule mol. More...
 
void append (const Molecule &mol)
 Extends the current set of atoms and bonds by a copy of those in mol. More...
 
void append (const MolecularGraph &molgraph)
 Extends the current set of atoms and bonds by a copy of those in molgraph. More...
 
void remove (const MolecularGraph &molgraph)
 Removes the atoms and bonds of molgraph from this molecule. More...
 
void reserveMemoryForAtoms (std::size_t num_atoms)
 Reserves storage for at least num_atoms atoms to avoid reallocations on subsequent additions. More...
 
void reserveMemoryForBonds (std::size_t num_bonds)
 Reserves storage for at least num_bonds bonds to avoid reallocations on subsequent additions. More...
 
Moleculeoperator= (const Molecule &mol)
 Replaces the current set of atoms, bonds and properties by a copy of the atoms, bonds and properties of the molecule mol. More...
 
Moleculeoperator= (const MolecularGraph &molgraph)
 Replaces the current set of atoms, bonds and properties by a copy of the atoms, bonds and properties of the molecular graph molgraph. More...
 
Moleculeoperator+= (const Molecule &mol)
 Extends the current set of atoms and bonds by a copy of the atoms and bonds in the molecule mol. More...
 
Moleculeoperator+= (const MolecularGraph &molgraph)
 Extends the current set of atoms and bonds by a copy of the atoms and bonds in the molecular graph molgraph. More...
 
- Public Member Functions inherited from CDPL::Chem::Molecule
virtual ~Molecule ()
 Virtual destructor. More...
 
AtomIterator removeAtom (const AtomIterator &it)
 Removes the atom specified by the iterator it. More...
 
BondIterator removeBond (const BondIterator &it)
 Removes the bond specified by the iterator it. More...
 
Moleculeoperator= (const Molecule &mol)
 Replaces the current set of atoms, bonds and properties by a copy of the atoms, bonds and properties of the molecule mol. More...
 
Moleculeoperator= (const MolecularGraph &molgraph)
 Replaces the current set of atoms, bonds and properties by a copy of the atoms, bonds and properties of the molecular graph molgraph. More...
 
Moleculeoperator+= (const Molecule &mol)
 Extends the current set of atoms and bonds by a copy of the atoms and bonds in the molecule mol. More...
 
Moleculeoperator+= (const MolecularGraph &molgraph)
 Extends the current set of atoms and bonds by a copy of the atoms and bonds in the molecular graph molgraph. More...
 
Moleculeoperator-= (const MolecularGraph &molgraph)
 Removes atoms and bonds referenced by the molecular graph molgraph that are part of this Molecule instance. 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...
 
ConstBondIterator getBondsBegin () const
 Returns a constant iterator pointing to the beginning 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...
 
ConstBondIterator getBondsEnd () const
 Returns a constant iterator pointing to the end of the stored const Chem::Bond objects. More...
 
BondIterator getBondsEnd ()
 Returns a mutable iterator pointing to the end of the stored Chem::Bond objects. More...
 
- Public Member Functions inherited from CDPL::Chem::MolecularGraph
virtual ~MolecularGraph ()
 Virtual destructor. 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::Chem::BondContainer
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...
 
const BondContainergetBonds () const
 Returns a const reference to itself. More...
 
BondContainergetBonds ()
 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...
 

Additional Inherited Members

- Static Public Member Functions inherited from CDPL::Chem::Molecule
static void registerCopyPostprocessingFunction (const CopyPostprocessingFunction &func)
 Registers a new copy-postprocessing function in the global registry. More...
 
- Protected Member Functions inherited from CDPL::Chem::Molecule
void invokeCopyPostprocessingFunctions (const MolecularGraph &src_molgraph)
 Invokes all registered copy-postprocessing functions on this molecule with src_molgraph as the source. More...
 
- Protected Member Functions inherited from CDPL::Chem::MolecularGraph
MolecularGraphoperator= (const MolecularGraph &molgraph)
 Assignment operator. 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::Chem::BondContainer
virtual ~BondContainer ()
 Virtual destructor. More...
 
BondContaineroperator= (const BondContainer &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

Concrete Chem::Molecule implementation that owns Chem::BasicAtom and Chem::BasicBond instances.

BasicMolecule provides the default in-memory representation of a molecular graph: atoms and bonds are allocated from internal object pools and accessed through random-access iterators. The class implements the full editing interface inherited from Chem::Molecule (addAtom, addBond, removeAtom, removeBond, copy, append, remove, reserveMemoryForAtoms, reserveMemoryForBonds) and is the standard concrete type used by readers and downstream algorithms throughout CDPKit.

Member Typedef Documentation

◆ SharedPointer

A reference-counted smart pointer [SHPTR] for dynamically allocated BasicMolecule instances.

◆ AtomIterator

typedef boost::indirect_iterator<AtomList::iterator, BasicAtom> CDPL::Chem::BasicMolecule::AtomIterator

Mutable random-access iterator over the atoms of the molecule.

◆ ConstAtomIterator

typedef boost::indirect_iterator<AtomList::const_iterator, const BasicAtom> CDPL::Chem::BasicMolecule::ConstAtomIterator

Constant random-access iterator over the atoms of the molecule.

◆ BondIterator

typedef boost::indirect_iterator<BondList::iterator, BasicBond> CDPL::Chem::BasicMolecule::BondIterator

Mutable random-access iterator over the bonds of the molecule.

◆ ConstBondIterator

typedef boost::indirect_iterator<BondList::const_iterator, const BasicBond> CDPL::Chem::BasicMolecule::ConstBondIterator

Constant random-access iterator over the bonds of the molecule.

Constructor & Destructor Documentation

◆ BasicMolecule() [1/4]

CDPL::Chem::BasicMolecule::BasicMolecule ( )

Constructs an empty BasicMolecule instance.

◆ BasicMolecule() [2/4]

CDPL::Chem::BasicMolecule::BasicMolecule ( const BasicMolecule mol)

Constructs a copy of the BasicMolecule instance mol.

Parameters
molThe other BasicMolecule instance to copy.

◆ BasicMolecule() [3/4]

CDPL::Chem::BasicMolecule::BasicMolecule ( const Molecule mol)

Constructs a copy of the Chem::Molecule instance mol.

Parameters
molThe other Chem::Molecule instance to copy.

◆ BasicMolecule() [4/4]

CDPL::Chem::BasicMolecule::BasicMolecule ( const MolecularGraph molgraph)
explicit

Constructs a BasicMolecule instance with copies of the atoms and bonds of the Chem::MolecularGraph instance molgraph.

Parameters
molgraphThe Chem::MolecularGraph instance providing the atoms and bonds to copy.

◆ ~BasicMolecule()

CDPL::Chem::BasicMolecule::~BasicMolecule ( )

Destructor.

Destroys the BasicMolecule instance and frees all allocated resources.

Member Function Documentation

◆ clear()

void CDPL::Chem::BasicMolecule::clear ( )
virtual

Removes all atoms, bonds, and properties of the molecule.

Implements CDPL::Chem::Molecule.

◆ getNumAtoms()

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

Returns the number of atoms in the molecule.

Returns
The atom count.

Implements CDPL::Chem::Molecule.

◆ getNumBonds()

std::size_t CDPL::Chem::BasicMolecule::getNumBonds ( ) const
virtual

Returns the number of bonds in the molecule.

Returns
The bond count.

Implements CDPL::Chem::Molecule.

◆ getAtomsBegin() [1/2]

ConstAtomIterator CDPL::Chem::BasicMolecule::getAtomsBegin ( ) const

Returns a constant iterator pointing to the beginning of the atoms.

Returns
A constant iterator pointing to the beginning of the atoms.

◆ getAtomsBegin() [2/2]

AtomIterator CDPL::Chem::BasicMolecule::getAtomsBegin ( )

Returns a mutable iterator pointing to the beginning of the atoms.

Returns
A mutable iterator pointing to the beginning of the atoms.

◆ getAtomsEnd() [1/2]

ConstAtomIterator CDPL::Chem::BasicMolecule::getAtomsEnd ( ) const

Returns a constant iterator pointing to the end of the atoms.

Returns
A constant iterator pointing to the end of the atoms.

◆ getAtomsEnd() [2/2]

AtomIterator CDPL::Chem::BasicMolecule::getAtomsEnd ( )

Returns a mutable iterator pointing to the end of the atoms.

Returns
A mutable iterator pointing to the end of the atoms.

◆ getBondsBegin() [1/2]

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

Returns a constant iterator pointing to the beginning of the bonds.

Returns
A constant iterator pointing to the beginning of the bonds.

◆ getBondsBegin() [2/2]

BondIterator CDPL::Chem::BasicMolecule::getBondsBegin ( )

Returns a mutable iterator pointing to the beginning of the bonds.

Returns
A mutable iterator pointing to the beginning of the bonds.

◆ getBondsEnd() [1/2]

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

Returns a constant iterator pointing to the end of the bonds.

Returns
A constant iterator pointing to the end of the bonds.

◆ getBondsEnd() [2/2]

BondIterator CDPL::Chem::BasicMolecule::getBondsEnd ( )

Returns a mutable iterator pointing to the end of the bonds.

Returns
A mutable iterator pointing to the end of the bonds.

◆ getAtom() [1/2]

const BasicAtom& CDPL::Chem::BasicMolecule::getAtom ( std::size_t  idx) const
virtual

Returns a const reference to the atom at index idx.

Parameters
idxThe zero-based atom index.
Returns
A const reference to the atom.
Exceptions
Base::IndexErrorif idx is not less than getNumAtoms().

Implements CDPL::Chem::Molecule.

◆ getAtom() [2/2]

BasicAtom& CDPL::Chem::BasicMolecule::getAtom ( std::size_t  idx)
virtual

Returns a mutable reference to the atom at index idx.

Parameters
idxThe zero-based atom index.
Returns
A mutable reference to the atom.
Exceptions
Base::IndexErrorif idx is not less than getNumAtoms().

Implements CDPL::Chem::Molecule.

◆ addAtom()

BasicAtom& CDPL::Chem::BasicMolecule::addAtom ( )
virtual

Creates and appends a new atom and returns a reference to it.

Returns
A reference to the newly added atom.

Implements CDPL::Chem::Molecule.

◆ removeAtom() [1/2]

void CDPL::Chem::BasicMolecule::removeAtom ( std::size_t  idx)
virtual

Removes the atom at index idx (along with any incident bonds).

Parameters
idxThe zero-based atom index.
Exceptions
Base::IndexErrorif idx is not less than getNumAtoms().

Implements CDPL::Chem::Molecule.

◆ removeAtom() [2/2]

AtomIterator CDPL::Chem::BasicMolecule::removeAtom ( const AtomIterator it)

Removes the atom specified by the iterator it.

If the specified atom is connected to any other atoms of the molecule, the connecting bonds will also be removed.

Parameters
itAn iterator that specifies the atom to remove.
Returns
A mutable iterator pointing to the next atom in the list.
Exceptions
Base::RangeErrorif the number of atoms is zero or it is not in the range [getAtomsBegin(), getAtomsEnd() - 1].

◆ getBond() [1/2]

const BasicBond& CDPL::Chem::BasicMolecule::getBond ( std::size_t  idx) const
virtual

Returns a const reference to the bond at index idx.

Parameters
idxThe zero-based bond index.
Returns
A const reference to the bond.
Exceptions
Base::IndexErrorif idx is not less than getNumBonds().

Implements CDPL::Chem::Molecule.

◆ getBond() [2/2]

BasicBond& CDPL::Chem::BasicMolecule::getBond ( std::size_t  idx)
virtual

Returns a mutable reference to the bond at index idx.

Parameters
idxThe zero-based bond index.
Returns
A mutable reference to the bond.
Exceptions
Base::IndexErrorif idx is not less than getNumBonds().

Implements CDPL::Chem::Molecule.

◆ addBond()

BasicBond& CDPL::Chem::BasicMolecule::addBond ( std::size_t  atom1_idx,
std::size_t  atom2_idx 
)
virtual

Creates a new bond between the atoms at indices atom1_idx and atom2_idx and returns a reference to it.

Parameters
atom1_idxThe zero-based index of the first end atom.
atom2_idxThe zero-based index of the second end atom.
Returns
A reference to the newly added bond.
Exceptions
Base::IndexErrorif either index is not less than getNumAtoms().

Implements CDPL::Chem::Molecule.

◆ removeBond() [1/2]

void CDPL::Chem::BasicMolecule::removeBond ( std::size_t  idx)
virtual

Removes the bond at index idx.

Parameters
idxThe zero-based bond index.
Exceptions
Base::IndexErrorif idx is not less than getNumBonds().

Implements CDPL::Chem::Molecule.

◆ removeBond() [2/2]

BondIterator CDPL::Chem::BasicMolecule::removeBond ( const BondIterator it)

Removes the bond specified by the iterator it.

Parameters
itAn iterator that specifies the bond to remove.
Returns
A mutable iterator pointing to the next bond in the list.
Exceptions
Base::RangeErrorif the number of bonds is zero or it is not in the range [getBondsBegin(), getBondsEnd() - 1].

◆ containsAtom()

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

Tells whether atom is part of this molecule.

Parameters
atomThe atom to look up.
Returns
true if atom is in the molecule, and false otherwise.

Implements CDPL::Chem::Molecule.

◆ containsBond()

bool CDPL::Chem::BasicMolecule::containsBond ( const Bond bond) const
virtual

Tells whether bond is part of this molecule.

Parameters
bondThe bond to look up.
Returns
true if bond is in the molecule, and false otherwise.

Implements CDPL::Chem::Molecule.

◆ getAtomIndex()

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

Returns the index of atom atom in this molecule.

Parameters
atomThe atom to look up.
Returns
The zero-based atom index.
Exceptions
Base::ItemNotFoundif atom is not part of the molecule.

Implements CDPL::Chem::Molecule.

◆ getBondIndex()

std::size_t CDPL::Chem::BasicMolecule::getBondIndex ( const Bond bond) const
virtual

Returns the index of bond bond in this molecule.

Parameters
bondThe bond to look up.
Returns
The zero-based bond index.
Exceptions
Base::ItemNotFoundif bond is not part of the molecule.

Implements CDPL::Chem::Molecule.

◆ orderAtoms()

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

Reorders the atom list using the binary comparator func.

Parameters
funcThe strict-weak-ordering comparator used to sort the atoms.

Implements CDPL::Chem::AtomContainer.

◆ orderBonds()

void CDPL::Chem::BasicMolecule::orderBonds ( const BondCompareFunction func)
virtual

Reorders the bond list using the binary comparator func.

Parameters
funcThe strict-weak-ordering comparator used to sort the bonds.

Implements CDPL::Chem::BondContainer.

◆ operator=() [1/3]

BasicMolecule& CDPL::Chem::BasicMolecule::operator= ( const BasicMolecule mol)

Replaces the current set of atoms, bonds and properties by a copy of the atoms, bonds and properties of the molecule mol.

Internally calls copy() to perform the actual work.

Parameters
molThe molecule to copy.
Returns
A reference to itself.

◆ operator+=() [1/3]

BasicMolecule& CDPL::Chem::BasicMolecule::operator+= ( const BasicMolecule mol)

Extends the current set of atoms and bonds by a copy of the atoms and bonds in the molecule mol.

Internally calls append() to perform the actual work.

Parameters
molThe molecule providing the atoms and bonds to append.
Returns
A reference to itself.

◆ clone()

MolecularGraph::SharedPointer CDPL::Chem::BasicMolecule::clone ( ) const
virtual

Creates a copy of the molecular graph.

Returns
A smart pointer to the copy of the molecular graph.

Implements CDPL::Chem::MolecularGraph.

◆ copy() [1/3]

void CDPL::Chem::BasicMolecule::copy ( const BasicMolecule mol)

Replaces the current set of atoms, bonds and properties by a copy of the atoms, bonds and properties of the molecule mol.

Parameters
molThe molecule to copy.

◆ copy() [2/3]

void CDPL::Chem::BasicMolecule::copy ( const Molecule mol)
virtual

Replaces the current set of atoms, bonds and properties by a copy of mol.

Parameters
molThe source molecule.

Implements CDPL::Chem::Molecule.

◆ copy() [3/3]

void CDPL::Chem::BasicMolecule::copy ( const MolecularGraph molgraph)
virtual

Replaces the current set of atoms, bonds and properties by a copy of molgraph.

Parameters
molgraphThe source molecular graph.

Implements CDPL::Chem::Molecule.

◆ append() [1/3]

void CDPL::Chem::BasicMolecule::append ( const BasicMolecule mol)

Extends the current set of atoms and bonds by a copy of the atoms and bonds in the molecule mol.

Parameters
molThe molecule providing the atoms and bonds to append.
Note
Does not affect any properties.

◆ append() [2/3]

void CDPL::Chem::BasicMolecule::append ( const Molecule mol)
virtual

Extends the current set of atoms and bonds by a copy of those in mol.

Parameters
molThe source molecule.
Note
Does not affect any properties.

Implements CDPL::Chem::Molecule.

◆ append() [3/3]

void CDPL::Chem::BasicMolecule::append ( const MolecularGraph molgraph)
virtual

Extends the current set of atoms and bonds by a copy of those in molgraph.

Parameters
molgraphThe source molecular graph.
Note
Does not affect any properties.

Implements CDPL::Chem::Molecule.

◆ remove()

void CDPL::Chem::BasicMolecule::remove ( const MolecularGraph molgraph)
virtual

Removes the atoms and bonds of molgraph from this molecule.

Parameters
molgraphThe molecular graph specifying the atoms and bonds to remove.

Implements CDPL::Chem::Molecule.

◆ reserveMemoryForAtoms()

void CDPL::Chem::BasicMolecule::reserveMemoryForAtoms ( std::size_t  num_atoms)
virtual

Reserves storage for at least num_atoms atoms to avoid reallocations on subsequent additions.

Parameters
num_atomsThe minimum number of atoms to accommodate.

Reimplemented from CDPL::Chem::Molecule.

◆ reserveMemoryForBonds()

void CDPL::Chem::BasicMolecule::reserveMemoryForBonds ( std::size_t  num_bonds)
virtual

Reserves storage for at least num_bonds bonds to avoid reallocations on subsequent additions.

Parameters
num_bondsThe minimum number of bonds to accommodate.

Reimplemented from CDPL::Chem::Molecule.

◆ operator=() [2/3]

Molecule& CDPL::Chem::Molecule::operator=

Replaces the current set of atoms, bonds and properties by a copy of the atoms, bonds and properties of the molecule mol.

Internally calls copy() to perform the actual work.

Parameters
molThe molecule to copy.
Returns
A reference to itself.

◆ operator=() [3/3]

Molecule& CDPL::Chem::Molecule::operator=

Replaces the current set of atoms, bonds and properties by a copy of the atoms, bonds and properties of the molecular graph molgraph.

Internally calls copy() to perform the actual work.

Parameters
molgraphThe Chem::MolecularGraph instance providing the atoms and bonds to copy.
Returns
A reference to itself.

◆ operator+=() [2/3]

Molecule& CDPL::Chem::Molecule::operator+=

Extends the current set of atoms and bonds by a copy of the atoms and bonds in the molecule mol.

Internally calls append() to perform the actual work.

Parameters
molThe molecule providing the atoms and bonds to append.
Returns
A reference to itself.

◆ operator+=() [3/3]

Molecule& CDPL::Chem::Molecule::operator+=

Extends the current set of atoms and bonds by a copy of the atoms and bonds in the molecular graph molgraph.

Internally calls append() to perform the actual work.

Parameters
molgraphThe Chem::MolecularGraph instance providing the atoms and bonds to append.
Returns
A reference to itself.

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