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

BasicMolecule. 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
 
typedef boost::indirect_iterator< AtomList::const_iterator, const BasicAtomConstAtomIterator
 
typedef boost::indirect_iterator< BondList::iterator, BasicBondBondIterator
 
typedef boost::indirect_iterator< BondList::const_iterator, const BasicBondConstBondIterator
 
- 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
 
- 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 and bonds and clears all properties of the molecule. More...
 
std::size_t getNumAtoms () const
 Returns the number of explicit atoms. More...
 
std::size_t getNumBonds () const
 Returns the number of explicit bonds. 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 non-const reference to the atom at index idx. More...
 
BasicAtomaddAtom ()
 Creates a new atom and adds it to the molecule. More...
 
void removeAtom (std::size_t idx)
 Removes the atom at the specified index. 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 non-const reference to the bond at index idx. More...
 
BasicBondaddBond (std::size_t atom1_idx, std::size_t atom2_idx)
 Creates a new or returns an already existing bond between the atoms specified by atom1_idx and atom2_idx. More...
 
void removeBond (std::size_t idx)
 Removes the bond at the specified index. More...
 
BondIterator removeBond (const BondIterator &it)
 Removes the bond specified by the iterator it. More...
 
bool containsAtom (const Atom &atom) const
 Tells whether the specified atom is part of this molecule. More...
 
bool containsBond (const Bond &bond) const
 Tells whether the specified bond is part of this molecule. More...
 
std::size_t getAtomIndex (const Atom &atom) const
 Returns the index of the specified atom. More...
 
std::size_t getBondIndex (const Bond &bond) const
 Returns the index of the specified bond. More...
 
void orderAtoms (const AtomCompareFunction &func)
 Orders the stored atoms according to criteria implemented by the provided atom comparison function. More...
 
void orderBonds (const BondCompareFunction &func)
 Orders the stored bonds according to criteria implemented by the provided bond comparison function. 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 the atoms, bonds and properties of the molecule mol. More...
 
void copy (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...
 
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 the atoms and bonds in the molecule mol. More...
 
void append (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...
 
void remove (const MolecularGraph &molgraph)
 Removes atoms and bonds referenced by the molecular graph molgraph that are part of this Molecule instance. More...
 
void reserveMemoryForAtoms (std::size_t num_atoms)
 Reserves memory for num_atoms atoms. More...
 
void reserveMemoryForBonds (std::size_t num_bonds)
 Reserves memory for num_bonds bonds. 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. More...
 
virtual const Entity3DgetEntity (std::size_t idx) const
 Returns a const reference to the Chem::Entity3D instance at index idx. More...
 
virtual Entity3DgetEntity (std::size_t idx)
 Returns a non-const reference to the entity at index 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)
 
- Protected Member Functions inherited from CDPL::Chem::Molecule
void invokeCopyPostprocessingFunctions (const MolecularGraph &src_molgraph)
 
- 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

BasicMolecule.

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

◆ ConstAtomIterator

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

◆ BondIterator

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

◆ ConstBondIterator

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

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 and bonds and clears all properties of the molecule.

Implements CDPL::Chem::Molecule.

◆ getNumAtoms()

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

Returns the number of explicit atoms.

Returns
The number of explicit atoms.

Implements CDPL::Chem::Molecule.

◆ getNumBonds()

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

Returns the number of explicit bonds.

Returns
The number of explicit bonds.

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 index of the atom to return.
Returns
A const reference to the atom at the specified index.
Exceptions
Base::IndexErrorif the number of atoms is zero or idx is not in the range [0, getNumAtoms() - 1].

Implements CDPL::Chem::Molecule.

◆ getAtom() [2/2]

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

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

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

Implements CDPL::Chem::Molecule.

◆ addAtom()

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

Creates a new atom and adds it to the molecule.

Note that this method does not create any bonds - the returned atom is always unconnected.

Returns
A reference to the newly created atom.

Implements CDPL::Chem::Molecule.

◆ removeAtom() [1/2]

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

Removes the atom at the specified index.

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

Parameters
idxThe index of the atom to remove.
Exceptions
Base::IndexErrorif the number of atoms is zero or idx is not in the range [0, getNumAtoms() - 1].

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 index of the bond to return.
Returns
A 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].

Implements CDPL::Chem::Molecule.

◆ getBond() [2/2]

BasicBond& CDPL::Chem::BasicMolecule::getBond ( std::size_t  idx)
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 the number of bonds is zero or idx is not in the range [0, getNumBonds() - 1].

Implements CDPL::Chem::Molecule.

◆ addBond()

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

Creates a new or returns an already existing bond between the atoms specified by atom1_idx and atom2_idx.

If a bond between the specified atoms already exists, then the existing bond will be returned. If a bond does not yet exist, a new bond will be created. The atom specified by atom1_idx becomes the start atom and the atom specified by atom2_idx the end atom of the newly created bond.

Parameters
atom1_idxThe zero-based index of the first atom of the bond.
atom2_idxThe zero-based index of the second atom of the bond.
Returns
A reference to the newly created or already existing bond between the specified atoms.
Exceptions
Base::IndexErrorif the number of atoms is zero or atom1_idx and/or atom2_idx is not in the range [0, getNumAtoms() - 1].

Implements CDPL::Chem::Molecule.

◆ removeBond() [1/2]

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

Removes the bond at the specified index.

Parameters
idxThe zero-based index of the bond to remove.
Exceptions
Base::IndexErrorif the number of bonds is zero or idx is not in the range [0, getNumBonds() - 1].

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 the specified atom is part of this molecule.

Parameters
atomThe atom to look for.
Returns
true if atom is part of the molecule, and false otherwise.

Implements CDPL::Chem::Molecule.

◆ containsBond()

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

Tells whether the specified bond is part of this molecule.

Parameters
bondThe bond to look for.
Returns
true if bond is part of 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 the specified atom.

Parameters
atomThe atom for which to return the index.
Returns
The zero-based index of the specified atom.
Exceptions
Base::ItemNotFoundif the specified 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 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 is not part of the molecule.

Implements CDPL::Chem::Molecule.

◆ orderAtoms()

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

Orders the stored atoms according to criteria implemented by the provided atom comparison function.

Parameters
funcThe atom comparison function implementing the applied ordering criteria.

Implements CDPL::Chem::AtomContainer.

◆ orderBonds()

void CDPL::Chem::BasicMolecule::orderBonds ( const BondCompareFunction func)
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.

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 the atoms, bonds and properties of the molecule mol.

Parameters
molThe molecule to copy.

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 the atoms, bonds and properties of the molecular graph molgraph.

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

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 the atoms and bonds in the molecule mol.

Parameters
molThe molecule providing the atoms and bonds to append.
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 the atoms and bonds in the molecular graph molgraph.

Parameters
molgraphThe Chem::MolecularGraph instance providing the atoms and bonds to append.
Note
Does not affect any properties.

Implements CDPL::Chem::Molecule.

◆ remove()

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

Removes atoms and bonds referenced by the molecular graph molgraph that are part of this Molecule instance.

Parameters
molgraphThe Chem::MolecularGraph instance specifying the atoms and bonds to remove.
Note
Does not affect any properties if this != &molgraph.

Implements CDPL::Chem::Molecule.

◆ reserveMemoryForAtoms()

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

Reserves memory for num_atoms atoms.

Allows implementors to speed up the creation of molecules with a known large number of atoms.

Parameters
num_atomsThe expected number of atoms for which memory shall be allocated in advance.

Reimplemented from CDPL::Chem::Molecule.

◆ reserveMemoryForBonds()

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

Reserves memory for num_bonds bonds.

Allows implementors to speed up the creation of molecules with a known large number of bonds.

Parameters
num_bondsThe expected number of bonds for which memory shall be allocated in advance.

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: