Chemical Data Processing Library C++ API - Version 1.2.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 
50  public BondContainer,
51  public Entity3D
52  {
53 
54  public:
59 
64 
69 
74 
77 
80 
85  virtual const Molecule& getMolecule() const = 0;
86 
91  virtual Molecule& getMolecule() = 0;
92 
99  virtual const Bond& getBondToAtom(const Atom& atom) const = 0;
100 
107  virtual Bond& getBondToAtom(const Atom& atom) = 0;
108 
115  virtual const Bond* findBondToAtom(const Atom& atom) const = 0;
116 
123  virtual Bond* findBondToAtom(const Atom& atom) = 0;
124 
129  virtual std::size_t getIndex() const = 0;
130 
138  virtual std::size_t getNumAtoms() const = 0;
139 
147  virtual std::size_t getNumBonds() const = 0;
148 
156  virtual const Bond& getBond(std::size_t idx) const = 0;
157 
165  virtual Bond& getBond(std::size_t idx) = 0;
166 
174  virtual const Atom& getAtom(std::size_t idx) const = 0;
175 
183  virtual Atom& getAtom(std::size_t idx) = 0;
184 
190  virtual bool containsAtom(const Atom& atom) const = 0;
191 
197  virtual bool containsBond(const Bond& bond) const = 0;
198 
205  virtual std::size_t getAtomIndex(const Atom& atom) const = 0;
206 
213  virtual std::size_t getBondIndex(const Bond& bond) const = 0;
214 
220  Atom& operator=(const Atom& atom);
221 
222  protected:
226  virtual ~Atom() {}
227  };
228  } // namespace Chem
229 } // namespace CDPL
230 
231 #endif // CDPL_CHEM_ATOM_HPP
Definition of the class CDPL::Chem::AtomContainer.
Definition of the 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 the class CDPL::Chem::Entity3D.
A 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.
Atom.
Definition: Atom.hpp:52
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:73
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:68
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:58
AtomContainer::ConstAtomIterator ConstAtomIterator
A constant random access iterator used to iterate over the connected atoms.
Definition: Atom.hpp:63
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:226
virtual bool containsBond(const Bond &bond) const =0
Tells whether the specified bond is incident to this atom.
A 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.
Bond.
Definition: Bond.hpp:50
Entity3D.
Definition: Entity3D.hpp:46
Molecule.
Definition: Molecule.hpp:49
A STL compatible random access iterator for container elements accessible by index.
Definition: IndexedElementIterator.hpp:125
The namespace of the Chemical Data Processing Library.