![]() |
Chemical Data Processing Library C++ API - Version 1.1.1
|
#include <Fragment.hpp>
Public Types | |
typedef std::shared_ptr< Fragment > | SharedPointer |
A reference-counted smart pointer [SHPTR] for dynamically allocated Fragment instances. More... | |
typedef boost::indirect_iterator< AtomList::const_iterator, const Atom > | ConstAtomIterator |
A constant random access iterator used to iterate over the stored const Chem::Atom objects. More... | |
typedef boost::indirect_iterator< AtomList::iterator, Atom > | AtomIterator |
A mutable random access iterator used to iterate over the stored const Chem::Atom objects. More... | |
typedef boost::indirect_iterator< BondList::const_iterator, const Bond > | ConstBondIterator |
A constant random access iterator used to iterate over the stored const Chem::Bond objects. More... | |
typedef boost::indirect_iterator< BondList::iterator, Bond > | BondIterator |
A mutable random access iterator used to iterate over the stored const Chem::Bond objects. More... | |
![]() | |
typedef std::shared_ptr< MolecularGraph > | SharedPointer |
A reference-counted smart pointer [SHPTR] for dynamically allocated MolecularGraph instances. More... | |
![]() | |
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... | |
![]() | |
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... | |
![]() | |
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... | |
![]() | |
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 | |
Fragment () | |
Constructs an empty Fragment instance. More... | |
Fragment (const Fragment &frag) | |
Constructs a copy of the Fragment instance frag. More... | |
Fragment (const MolecularGraph &molgraph) | |
Constructs a Fragment instance storing the atoms, bonds and properties of the molecular graph molgraph. More... | |
~Fragment () | |
Destructor. More... | |
std::size_t | getNumAtoms () const |
Returns the number of atoms. More... | |
std::size_t | getNumBonds () const |
Returns the number of bonds. More... | |
bool | containsAtom (const Atom &atom) const |
Tells whether the specified atom is part of this fragment. More... | |
bool | containsBond (const Bond &bond) const |
Tells whether the specified bond is part of this fragment. 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... | |
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 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 | getAtomsEnd () |
Returns a mutable iterator pointing to the end of the stored const 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 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 | getBondsEnd () |
Returns a mutable iterator pointing to the end of the stored const Chem::Bond objects. More... | |
const Atom & | getAtom (std::size_t idx) const |
Returns a const reference to the atom at index idx. More... | |
Atom & | getAtom (std::size_t idx) |
Returns a non-const reference to the atom at index idx. More... | |
const Bond & | getBond (std::size_t idx) const |
Returns a const reference to the bond at index idx. More... | |
Bond & | getBond (std::size_t idx) |
Returns a non-const reference to the bond at index idx. More... | |
bool | addAtom (const Atom &atom) |
Extends the fragment by the specified atom. More... | |
bool | addBond (const Bond &bond) |
Extends the fragment by the specified bond. 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... | |
bool | removeAtom (const Atom &atom) |
Removes the specified atom. 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 | removeBond (const Bond &bond) |
Removes the specified bond. More... | |
void | clear () |
Removes all atoms and bonds. More... | |
void | swap (Fragment &frag) |
Exchanges the atoms, bonds and properties of this fragment with the atoms, bonds and properties of the fragment frag. 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... | |
Fragment & | operator= (const Fragment &frag) |
Replaces the current set of atoms, bonds and properties by the atoms, bonds and properties of the fragment frag. More... | |
Fragment & | operator= (const MolecularGraph &molgraph) |
Replaces the current set of atoms, bonds and properties by the atoms, bonds and properties of the molecular graph molgraph. More... | |
Fragment & | operator+= (const MolecularGraph &molgraph) |
Extends the current set of atoms and bonds by the atoms and bonds in the molecular graph molgraph. More... | |
Fragment & | operator-= (const MolecularGraph &molgraph) |
Removes the atoms and bonds referenced by the molecular graph molgraph from this Fragment instance. More... | |
MolecularGraph::SharedPointer | clone () const |
Creates a copy of the molecular graph. More... | |
void | reserveMemoryForAtoms (std::size_t num_atoms) |
void | reserveMemoryForBonds (std::size_t num_bonds) |
![]() | |
virtual | ~MolecularGraph () |
Virtual destructor. More... | |
![]() | |
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 Entity3D & | getEntity (std::size_t idx) const |
Returns a const reference to the Chem::Entity3D instance at index idx. More... | |
virtual Entity3D & | getEntity (std::size_t idx) |
Returns a non-const reference to the entity at index idx. More... | |
const AtomContainer & | getAtoms () const |
Returns a const reference to itself. More... | |
AtomContainer & | getAtoms () |
Returns a reference to itself. More... | |
![]() | |
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 Entity3DContainer & | getEntities () const |
Returns a const reference to itself. More... | |
Entity3DContainer & | getEntities () |
Returns a reference to itself. More... | |
![]() | |
ConstBondIterator | getBondsBegin () const |
Returns a constant iterator pointing to the beginning of the stored const Chem::Bond objects. More... | |
ConstBondIterator | getBondsEnd () const |
Returns a constant iterator pointing to the end of the stored const Chem::Bond objects. More... | |
BondIterator | getBondsBegin () |
Returns a mutable iterator pointing to the beginning of the stored Chem::Bond objects. More... | |
BondIterator | getBondsEnd () |
Returns a mutable iterator pointing to the end of the stored Chem::Bond objects. More... | |
ConstBondIterator | begin () const |
Returns a constant iterator pointing to the beginning of the stored const Chem::Bond objects. More... | |
ConstBondIterator | end () const |
Returns a constant iterator pointing to the end of the stored const Chem::Bond objects. More... | |
BondIterator | begin () |
Returns a mutable iterator pointing to the beginning of the stored Chem::Bond objects. More... | |
BondIterator | end () |
Returns a mutable iterator pointing to the end of the stored Chem::Bond objects. More... | |
const BondContainer & | getBonds () const |
Returns a const reference to itself. More... | |
BondContainer & | getBonds () |
Returns a reference to itself. More... | |
![]() | |
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 Any & | getProperty (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 PropertyContainer & | getProperties () const |
Returns a const reference to itself. More... | |
Additional Inherited Members | |
![]() | |
MolecularGraph & | operator= (const MolecularGraph &molgraph) |
Assignment operator. More... | |
![]() | |
virtual | ~AtomContainer () |
Virtual destructor. More... | |
AtomContainer & | operator= (const AtomContainer &cntnr) |
Assignment operator. More... | |
![]() | |
virtual | ~Entity3DContainer () |
Virtual destructor. More... | |
Entity3DContainer & | operator= (const Entity3DContainer &cntnr) |
Assignment operator. More... | |
![]() | |
virtual | ~BondContainer () |
Virtual destructor. More... | |
BondContainer & | operator= (const BondContainer &cntnr) |
Assignment operator. More... | |
![]() | |
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... | |
PropertyContainer & | operator= (const PropertyContainer &cntnr) |
Assignment operator. More... | |
typedef std::shared_ptr<Fragment> CDPL::Chem::Fragment::SharedPointer |
A reference-counted smart pointer [SHPTR] for dynamically allocated Fragment
instances.
typedef boost::indirect_iterator<AtomList::const_iterator, const Atom> CDPL::Chem::Fragment::ConstAtomIterator |
A constant random access iterator used to iterate over the stored const
Chem::Atom objects.
typedef boost::indirect_iterator<AtomList::iterator, Atom> CDPL::Chem::Fragment::AtomIterator |
A mutable random access iterator used to iterate over the stored const
Chem::Atom objects.
typedef boost::indirect_iterator<BondList::const_iterator, const Bond> CDPL::Chem::Fragment::ConstBondIterator |
A constant random access iterator used to iterate over the stored const
Chem::Bond objects.
typedef boost::indirect_iterator<BondList::iterator, Bond> CDPL::Chem::Fragment::BondIterator |
A mutable random access iterator used to iterate over the stored const
Chem::Bond objects.
CDPL::Chem::Fragment::Fragment | ( | ) |
Constructs an empty Fragment
instance.
CDPL::Chem::Fragment::Fragment | ( | const Fragment & | frag | ) |
Constructs a copy of the Fragment
instance frag.
frag | The other Fragment instance to copy. |
|
explicit |
Constructs a Fragment
instance storing the atoms, bonds and properties of the molecular graph molgraph.
molgraph | The Chem::MolecularGraph instance providing the atoms, bonds and properties to store. |
CDPL::Chem::Fragment::~Fragment | ( | ) |
Destructor.
Destroys the Fragment
instance and frees all allocated resources.
|
virtual |
|
virtual |
Tells whether the specified atom is part of this fragment.
atom | The atom to look for. |
true
if atom is part of this fragment, and false
otherwise. Implements CDPL::Chem::AtomContainer.
Tells whether the specified bond is part of this fragment.
bond | The bond to look for. |
true
if bond is part of this fragment, and false
otherwise. Implements CDPL::Chem::BondContainer.
|
virtual |
Returns the index of the specified atom.
atom | The atom for which to return the index. |
Base::ItemNotFound | if the specified atom is not part of the fragment. |
Implements CDPL::Chem::AtomContainer.
|
virtual |
Returns the index of the specified bond.
bond | The bond for which to return the index. |
Base::ItemNotFound | if the specified bond is not part of the fragment. |
Implements CDPL::Chem::BondContainer.
ConstAtomIterator CDPL::Chem::Fragment::getAtomsBegin | ( | ) | const |
Returns a constant iterator pointing to the beginning of the stored const
Chem::Atom objects.
const
Chem::Atom objects. AtomIterator CDPL::Chem::Fragment::getAtomsBegin | ( | ) |
Returns a mutable iterator pointing to the beginning of the stored const
Chem::Atom objects.
const
Chem::Atom objects. ConstAtomIterator CDPL::Chem::Fragment::getAtomsEnd | ( | ) | const |
Returns a constant iterator pointing to the end of the stored const
Chem::Atom objects.
const
Chem::Atom objects. AtomIterator CDPL::Chem::Fragment::getAtomsEnd | ( | ) |
Returns a mutable iterator pointing to the end of the stored const
Chem::Atom objects.
const
Chem::Atom objects. ConstBondIterator CDPL::Chem::Fragment::getBondsBegin | ( | ) | const |
Returns a constant iterator pointing to the beginning of the stored const
Chem::Bond objects.
const
Chem::Bond objects. BondIterator CDPL::Chem::Fragment::getBondsBegin | ( | ) |
Returns a mutable iterator pointing to the beginning of the stored const
Chem::Bond objects.
const
Chem::Bond objects. ConstBondIterator CDPL::Chem::Fragment::getBondsEnd | ( | ) | const |
Returns a constant iterator pointing to the end of the stored const
Chem::Bond objects.
const
Chem::Bond objects. BondIterator CDPL::Chem::Fragment::getBondsEnd | ( | ) |
Returns a mutable iterator pointing to the end of the stored const
Chem::Bond objects.
const
Chem::Bond objects.
|
virtual |
Returns a const
reference to the atom at index idx.
idx | The zero-based index of the atom to return. |
const
reference to the atom at the specified index. Base::IndexError | if the number of atoms is zero or idx is not in the range [0, getNumAtoms() - 1]. |
Implements CDPL::Chem::AtomContainer.
|
virtual |
Returns a non-const
reference to the atom at index idx.
idx | The zero-based index of the atom to return. |
non-const
reference to the atom at the specified index. Base::IndexError | if the number of atoms is zero or idx is not in the range [0, getNumAtoms() - 1]. |
Implements CDPL::Chem::AtomContainer.
|
virtual |
Returns a const
reference to the bond at index idx.
idx | The zero-based index of the bond to return. |
const
reference to the bond at the specified index. Base::IndexError | if the number of bonds is zero or idx is not in the range [0, getNumBonds() - 1]. |
Implements CDPL::Chem::BondContainer.
|
virtual |
Returns a non-const
reference to the bond at index idx.
idx | The zero-based index of the bond to return. |
non-const
reference to the bond at the specified index. Base::IndexError | if the number of bonds is zero or idx is not in the range [0, getNumBonds() - 1]. |
Implements CDPL::Chem::BondContainer.
Extends the fragment by the specified atom.
atom | The atom to add. |
true
if the atom was not already a part of the fragment, and false
otherwise. Extends the fragment by the specified bond.
If the atoms of the bond are not already part of the fragment, they will be added automatically.
bond | The bond to add. |
true
if the bond was not already a part of the fragment, and false
otherwise. void CDPL::Chem::Fragment::removeAtom | ( | std::size_t | idx | ) |
Removes the atom at the specified index.
If the specified atom is connected to any other atoms of the fragment, the connecting bonds will also be removed.
idx | The zero-based index of the atom to remove. |
Base::IndexError | if the number of atoms is zero or idx is not in the range [0, getNumAtoms() - 1]. |
AtomIterator CDPL::Chem::Fragment::removeAtom | ( | const AtomIterator & | it | ) |
Removes the atom specified by the iterator it.
If the specified atom is connected to any other atoms of the fragment, the connecting bonds will also be removed.
it | An iterator that specifies the atom to remove. |
Base::RangeError | if the number of atoms is zero or it is not in the range [getAtomsBegin(), getAtomsEnd() - 1]. |
Removes the specified atom.
If the specified atom is connected to any other atoms of the fragment, the connecting bonds will also be removed.
atom | The atom to remove. |
true
if the atom was part of the fragment and has been removed, and false
otherwise. void CDPL::Chem::Fragment::removeBond | ( | std::size_t | idx | ) |
Removes the bond at the specified index.
idx | The zero-based index of the bond to remove. |
Base::IndexError | if the number of bonds is zero or idx is not in the range [0, getNumBonds() - 1]. |
BondIterator CDPL::Chem::Fragment::removeBond | ( | const BondIterator & | it | ) |
Removes the bond specified by the iterator it.
it | An iterator that specifies the bond to remove. |
Base::RangeError | if the number of bonds is zero or it is not in the range [getBondsBegin(), getBondsEnd() - 1]. |
Removes the specified bond.
bond | The bond to remove. |
true
if the bond was removed, and false
otherwise. void CDPL::Chem::Fragment::clear | ( | ) |
Removes all atoms and bonds.
void CDPL::Chem::Fragment::swap | ( | Fragment & | frag | ) |
Exchanges the atoms, bonds and properties of this fragment with the atoms, bonds and properties of the fragment frag.
frag | The fragment the atoms, bonds and properties get exchanged with. |
|
virtual |
Orders the stored atoms according to criteria implemented by the provided atom comparison function.
func | The atom comparison function implementing the applied ordering criteria. |
Implements CDPL::Chem::AtomContainer.
|
virtual |
Orders the stored bonds according to criteria implemented by the provided bond comparison function.
func | The bond comparison function implementing the applied ordering criteria. |
Implements CDPL::Chem::BondContainer.
Replaces the current set of atoms, bonds and properties by the atoms, bonds and properties of the fragment frag.
frag | The fragment to copy. |
Fragment& CDPL::Chem::Fragment::operator= | ( | const MolecularGraph & | molgraph | ) |
Replaces the current set of atoms, bonds and properties by the atoms, bonds and properties of the molecular graph molgraph.
molgraph | The Chem::MolecularGraph instance providing the atoms, bonds and properties to copy. |
Fragment& CDPL::Chem::Fragment::operator+= | ( | const MolecularGraph & | molgraph | ) |
Extends the current set of atoms and bonds by the atoms and bonds in the molecular graph molgraph.
molgraph | The Chem::MolecularGraph instance providing the atoms and bonds to add. |
Fragment& CDPL::Chem::Fragment::operator-= | ( | const MolecularGraph & | molgraph | ) |
Removes the atoms and bonds referenced by the molecular graph molgraph from this Fragment
instance.
molgraph | The Chem::MolecularGraph instance specifying the atoms and bonds to remove. |
this != &molgraph
.
|
virtual |
Creates a copy of the molecular graph.
Implements CDPL::Chem::MolecularGraph.
void CDPL::Chem::Fragment::reserveMemoryForAtoms | ( | std::size_t | num_atoms | ) |
void CDPL::Chem::Fragment::reserveMemoryForBonds | ( | std::size_t | num_bonds | ) |