Chemical Data Processing Library C++ API - Version 1.1.1
BasicBond.hpp
Go to the documentation of this file.
1 /*
2  * BasicBond.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_BASICBOND_HPP
30 #define CDPL_CHEM_BASICBOND_HPP
31 
32 #include "CDPL/Chem/APIPrefix.hpp"
33 #include "CDPL/Chem/Bond.hpp"
34 
35 
36 namespace CDPL
37 {
38 
39  namespace Chem
40  {
41 
42  class BasicMolecule;
43  class BasicAtom;
44 
48  class CDPL_CHEM_API BasicBond : public Bond
49  {
50 
51  friend class BasicMolecule;
52  friend class BasicAtom;
53 
54  public:
55  std::size_t getNumAtoms() const;
56 
57  const Molecule& getMolecule() const;
58 
60 
61  const Atom& getBegin() const;
62 
64 
65  const Atom& getEnd() const;
66 
68 
69  const Atom& getAtom(std::size_t idx) const;
70 
71  Atom& getAtom(std::size_t idx);
72 
73  bool containsAtom(const Atom& atom) const;
74 
75  std::size_t getAtomIndex(const Atom& atom) const;
76 
77  const Atom& getNeighbor(const Atom& atom) const;
78 
79  Atom& getNeighbor(const Atom& atom);
80 
81  std::size_t getIndex() const;
82 
83  void orderAtoms(const AtomCompareFunction& func);
84 
90  BasicBond& operator=(const BasicBond& bond);
91 
92  using Bond::operator=;
93 
94  private:
96 
97  BasicBond(const BasicBond& bond);
98 
99  ~BasicBond();
100 
101  void setIndex(std::size_t idx);
102 
103  void setBegin(BasicAtom& atom);
104  void setEnd(BasicAtom& atom);
105 
106  BasicMolecule* molecule;
107  std::size_t index;
108  BasicAtom* atoms[2];
109  };
110  } // namespace Chem
111 } // namespace CDPL
112 
113 #endif // CDPL_CHEM_BASICBOND_HPP
CDPL::Chem::BasicAtom
BasicAtom.
Definition: BasicAtom.hpp:54
CDPL::Chem::AtomCompareFunction
std::function< bool(const Chem::Atom &, const Chem::Atom &)> AtomCompareFunction
A generic wrapper class used to store a user-defined atom compare function.
Definition: AtomCompareFunction.hpp:41
APIPrefix.hpp
Definition of the preprocessor macro CDPL_CHEM_API.
CDPL::Chem::BasicBond::operator=
BasicBond & operator=(const BasicBond &bond)
Assignment operator that replaces the current set of properties with the properties of bond;.
CDPL::Chem::BasicBond::getAtom
const Atom & getAtom(std::size_t idx) const
Returns a const reference to the atom at index idx.
CDPL_CHEM_API
#define CDPL_CHEM_API
Tells the compiler/linker which classes, functions and variables are part of the library API.
CDPL::Chem::BasicBond::containsAtom
bool containsAtom(const Atom &atom) const
Tells whether the bond is incident to the specified atom.
CDPL::Chem::Bond
Bond.
Definition: Bond.hpp:50
CDPL::Chem::BasicBond::getNeighbor
Atom & getNeighbor(const Atom &atom)
Returns a non-const reference to the connected neighbor of the argument atom.
CDPL::Chem::BasicMolecule
BasicMolecule.
Definition: BasicMolecule.hpp:54
CDPL::Chem::BasicBond::getMolecule
Molecule & getMolecule()
Returns a non-const reference to the parent molecule.
CDPL::Chem::Atom
Atom.
Definition: Atom.hpp:52
CDPL::Chem::BasicBond::getBegin
const Atom & getBegin() const
Returns a const reference to the start atom of the bond.
CDPL::Chem::BasicBond
BasicBond.
Definition: BasicBond.hpp:49
CDPL::Chem::BasicBond::getNeighbor
const Atom & getNeighbor(const Atom &atom) const
Returns a const reference to the connected neighbor of the argument atom.
CDPL::Chem::Molecule
Molecule.
Definition: Molecule.hpp:49
CDPL::Chem::BasicBond::getIndex
std::size_t getIndex() const
Returns the index of the bond in its parent molecule.
CDPL::Chem::BasicBond::getEnd
Atom & getEnd()
Returns a non-const reference to the end atom of the bond.
CDPL::Chem::BasicBond::getMolecule
const Molecule & getMolecule() const
Returns a const reference to the parent molecule.
CDPL::Chem::BasicBond::getBegin
Atom & getBegin()
Returns a non-const reference to the start atom of the bond.
CDPL::Chem::BasicBond::getAtomIndex
std::size_t getAtomIndex(const Atom &atom) const
Returns the index of the specified atom.
CDPL
The namespace of the Chemical Data Processing Library.
CDPL::Chem::BasicBond::orderAtoms
void orderAtoms(const AtomCompareFunction &func)
Orders the stored atoms according to criteria implemented by the provided atom comparison function.
CDPL::Chem::BasicBond::getAtom
Atom & getAtom(std::size_t idx)
Returns a non-const reference to the atom at index idx.
CDPL::Chem::BasicBond::getEnd
const Atom & getEnd() const
Returns a const reference to the end atom of the bond.
CDPL::Chem::BasicBond::getNumAtoms
std::size_t getNumAtoms() const
Returns the number of atoms connected by the bond.
Bond.hpp
Definition of the class CDPL::Chem::Bond.