The Gnome Chemistry Utils  0.14.0
chain.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 
3 /*
4  * Gnome Chemistry Utils
5  * libs/gcu/chain.h
6  *
7  * Copyright (C) 2001-2011 Jean Bréfort <jean.brefort@normalesup.org>
8  *
9  * This program is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License as
11  * published by the Free Software Foundation; either version 3 of the
12  * License, or (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
22  * USA
23  */
24 
25 #ifndef GCU_CHAIN_H
26 #define GCU_CHAIN_H
27 
28 #include "object.h"
29 #include <map>
30 
32 namespace gcu {
33 
34 class Atom;
35 class Bond;
36 class Molecule;
37 
43 typedef struct
44 {
53 } ChainElt;
54 
59 class Chain: public Object
60 {
61 public:
72  Chain (Bond* pBond, Atom* pAtom = NULL, TypeId Type = ChainType);
81  Chain (Molecule* molecule, Bond* pBond, TypeId Type = ChainType);
90  Chain (Molecule* molecule, Atom* pAtom, TypeId Type = ChainType);
94  virtual ~Chain();
95 
102  void FindCycles (Atom* pAtom);
112  bool FindCycle (Atom* pAtom, Bond* pBond);
119  virtual void Erase (Atom* pAtom1, Atom* pAtom2);
127  virtual void Insert (Atom* pAtom1, Atom* pAtom2, Chain& chain);
135  void Extract (Atom* pAtom1, Atom* pAtom2, Chain& chain);
139  void Reverse ();
140  void Append (Chain& chain);
147  void AddBond (Atom* start, Atom* end);
151  unsigned GetUnsaturations ();
155  unsigned GetHeteroatoms ();
161  bool Contains (Atom* pAtom);
167  bool Contains (Bond* pBond);
171  unsigned GetLength ();
175  double GetMeanBondLength ();
180  Atom* GetNextAtom (Atom* pAtom);
181 
185  std::string Name ();
186 
195  unsigned BuildLength (unsigned *cycle_size = NULL, unsigned *cycle_pos = NULL);
196 
197 protected:
201  std::map<Atom*, ChainElt> m_Bonds;
206 };
207 
208 } // namespace gcu
209 
210 #endif // GCHEMPAINT_CHAIN_H