Chemical Data Processing Library C++ API - Version 1.4.0
Atom.hpp
Go to the documentation of this file.
1 /*
2  * Atom.hpp
3  *
4  * This file is part of the Chemical Data Processing Toolkit
5  *
6  * Copyright (C) 2003 Thomas Seidel <thomas.seidel@univie.ac.at>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with this library; see the file COPYING. If not, write to
20  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  */
23 
29 #ifndef CDPL_CHEM_ATOM_HPP
30 #define CDPL_CHEM_ATOM_HPP
31 
32 #include "CDPL/Chem/APIPrefix.hpp"
35 #include "CDPL/Chem/Entity3D.hpp"
36 
37 
38 namespace CDPL
39 {
40 
41  namespace Chem
42  {
43 
44  class Molecule;
45 
55  public BondContainer,
56  public Entity3D
57  {
58 
59  public:
64 
69 
74 
79 
82 
85 
90  virtual const Molecule& getMolecule() const = 0;
91 
96  virtual Molecule& getMolecule() = 0;
97 
104  virtual const Bond& getBondToAtom(const Atom& atom) const = 0;
105 
112  virtual Bond& getBondToAtom(const Atom& atom) = 0;
113 
120  virtual const Bond* findBondToAtom(const Atom& atom) const = 0;
121 
128  virtual Bond* findBondToAtom(const Atom& atom) = 0;
129 
134  virtual std::size_t getIndex() const = 0;
135 
143  virtual std::size_t getNumAtoms() const = 0;
144 
152  virtual std::size_t getNumBonds() const = 0;
153 
161  virtual const Bond& getBond(std::size_t idx) const = 0;
162 
170  virtual Bond& getBond(std::size_t idx) = 0;
171 
179  virtual const Atom& getAtom(std::size_t idx) const = 0;
180 
188  virtual Atom& getAtom(std::size_t idx) = 0;
189 
195  virtual bool containsAtom(const Atom& atom) const = 0;
196 
202  virtual bool containsBond(const Bond& bond) const = 0;
203 
210  virtual std::size_t getAtomIndex(const Atom& atom) const = 0;
211 
218  virtual std::size_t getBondIndex(const Bond& bond) const = 0;
219 
225  Atom& operator=(const Atom& atom);
226 
227  protected:
231  virtual ~Atom() {}
232  };
233  } // namespace Chem
234 } // namespace CDPL
235 
236 #endif // CDPL_CHEM_ATOM_HPP
Definition of class CDPL::Chem::AtomContainer.
Definition of class CDPL::Chem::BondContainer.
Definition of the preprocessor macro CDPL_CHEM_API.
#define CDPL_CHEM_API
Tells the compiler/linker which classes, functions and variables are part of the library API.
Definition of class CDPL::Chem::Entity3D.
Common interface for data structures that support a random access to stored Chem::Atom instances.
Definition: AtomContainer.hpp:55
ConstAtomIterator getAtomsBegin() const
Returns a constant iterator pointing to the beginning of the stored const Chem::Atom objects.
ConstAtomIterator getAtomsEnd() const
Returns a constant iterator pointing to the end of the stored const Chem::Atom objects.
Abstract base class representing a chemical atom and its bonded neighborhood.
Definition: Atom.hpp:57
virtual Bond & getBond(std::size_t idx)=0
Returns a non-const reference to the incident bond at index idx.
virtual std::size_t getNumBonds() const =0
Returns the number of incident bonds.
Atom & operator=(const Atom &atom)
Assignment operator that replaces the current set of properties with the properties of atom;.
virtual const Bond * findBondToAtom(const Atom &atom) const =0
Returns a pointer to the const Chem::Bond object that connects this atom to the argument atom.
virtual std::size_t getNumAtoms() const =0
Returns the number of connected atoms.
BondContainer::ConstBondIterator ConstBondIterator
A constant random access iterator used to iterate over the incident bonds.
Definition: Atom.hpp:78
virtual Atom & getAtom(std::size_t idx)=0
Returns a non-const reference to the connected atom at index idx.
virtual std::size_t getIndex() const =0
Returns the index of the atom in its parent molecule.
virtual const Bond & getBondToAtom(const Atom &atom) const =0
Returns a const reference to the Chem::Bond object that connects this atom to the argument atom.
virtual const Bond & getBond(std::size_t idx) const =0
Returns a const reference to the incident bond at index idx.
virtual Bond * findBondToAtom(const Atom &atom)=0
Returns a pointer to the non-const Chem::Bond object that connects this atom to the argument atom.
virtual bool containsAtom(const Atom &atom) const =0
Tells whether this atom and the argument atom are connected by a bond.
virtual const Molecule & getMolecule() const =0
Returns a const reference to the parent molecule.
BondContainer::BondIterator BondIterator
A mutable random access iterator used to iterate over the incident bonds.
Definition: Atom.hpp:73
virtual std::size_t getAtomIndex(const Atom &atom) const =0
Returns the index of the specified connected atom.
virtual Bond & getBondToAtom(const Atom &atom)=0
Returns a non-const reference to the Chem::Bond object that connects this atom to the argument atom.
AtomContainer::AtomIterator AtomIterator
A mutable random access iterator used to iterate over the connected atoms.
Definition: Atom.hpp:63
AtomContainer::ConstAtomIterator ConstAtomIterator
A constant random access iterator used to iterate over the connected atoms.
Definition: Atom.hpp:68
virtual std::size_t getBondIndex(const Bond &bond) const =0
Returns the index of the specified incident bond.
virtual const Atom & getAtom(std::size_t idx) const =0
Returns a const reference to the connected atom at index idx.
virtual Molecule & getMolecule()=0
Returns a non-const reference to the parent molecule.
virtual ~Atom()
Virtual destructor.
Definition: Atom.hpp:231
virtual bool containsBond(const Bond &bond) const =0
Tells whether the specified bond is incident to this atom.
Common interface for data structures that support a random access to stored Chem::Bond instances.
Definition: BondContainer.hpp:54
ConstBondIterator getBondsEnd() const
Returns a constant iterator pointing to the end of the stored const Chem::Bond objects.
ConstBondIterator getBondsBegin() const
Returns a constant iterator pointing to the beginning of the stored const Chem::Bond objects.
Abstract base class representing a chemical bond between two Chem::Atom instances.
Definition: Bond.hpp:54
Base class for objects that have a position in 3D space (e.g. Chem::Atom and Chem::Feature).
Definition: Entity3D.hpp:46
Abstract base class representing a mutable molecular graph that owns its atoms and bonds.
Definition: Molecule.hpp:53
STL compatible random access iterator for container elements accessible by index.
Definition: IndexedElementIterator.hpp:125
The namespace of the Chemical Data Processing Library.