gcu/molecule.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 
00003 /* 
00004  * Gnome Chemistry Utils
00005  * libs/gcu/molecule.h 
00006  *
00007  * Copyright (C) 2001-2010 Jean Bréfort <jean.brefort@normalesup.org>
00008  *
00009  * This program is free software; you can redistribute it and/or 
00010  * modify it under the terms of the GNU General Public License as 
00011  * published by the Free Software Foundation; either version 2 of the
00012  * License, or (at your option) any later version.
00013  *
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software
00021  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301
00022  * USA
00023  */
00024 
00025 #ifndef GCU_MOLECULE_H
00026 #define GCU_MOLECULE_H
00027 
00028 #include "object.h"
00029 
00031 namespace gcu {
00032 
00033 class Atom;
00034 class Bond;
00035 class Chain;
00036 class Cycle;
00037 class Formula;
00038 
00042 class Molecule: public Object
00043 {
00044 friend class Chain;
00045 public:
00052         Molecule (TypeId Type = MoleculeType);
00059         Molecule (Atom* pAtom);
00063         virtual ~Molecule ();
00064 
00070         void AddChild (Object* object);
00076         virtual void AddAtom (Atom* pAtom);
00082         virtual void AddBond (Bond* pBond);
00088         virtual void Remove (gcu::Object* pObject);
00094         void UpdateCycles (Bond* pBond);
00098         void UpdateCycles ();
00104         bool operator== (Molecule const& molecule) const;
00108         virtual unsigned GetAtomsNumber () const {return m_Atoms.size ();}
00119         static Molecule *MoleculeFromFormula (Document *Doc, Formula const &formula, bool add_pseudo = true);
00120 
00124         void Clear ();
00130         Atom const *GetFirstAtom (std::list<Atom*>::const_iterator &i) const;
00136         Atom const *GetNextAtom (std::list<Atom*>::const_iterator &i) const;
00142         Bond const *GetFirstBond (std::list<Bond*>::const_iterator &i) const;
00148         Bond const *GetNextBond(std::list<Bond*>::const_iterator &i) const;
00159         void SetName (char const *name, char const *convention);
00165         char const *GetName (char const *convention = NULL);
00169         std::string Name ();
00170 
00171 protected:
00175         std::list<Cycle*> m_Cycles;
00179         std::list<Chain*> m_Chains;
00183         std::list<Atom*> m_Atoms;
00187         std::list<Bond*> m_Bonds;
00188 
00189 private:
00190         std::map <std::string, std::string> m_Names;
00191 };
00192 
00193 }       //      namespace gcu
00194 
00195 #endif  //      GCU_MOLECULE_H

Generated on Fri Sep 24 15:58:41 2010 for The Gnome Chemistry Utils by  doxygen 1.5.9