# 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-2008 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 public:
    00051         Molecule (TypeId Type = MoleculeType);
    00058         Molecule (Atom* pAtom);
    00062         virtual ~Molecule ();
    00063
    00069         void AddChild (Object* object);
    00075         virtual void AddAtom (Atom* pAtom);
    00081         virtual void AddBond (Bond* pBond);
    00087         virtual void Remove (gcu::Object* pObject);
    00093         void UpdateCycles (Bond* pBond);
    00097         void UpdateCycles ();
    00103         bool operator== (Molecule const& molecule) const;
    00107         virtual unsigned GetAtomsNumber () const {return m_Atoms.size ();}
    00118         static Molecule *MoleculeFromFormula (Document *Doc, Formula const &formula, bool add_pseudo = true);
    00119
    00120 protected:
    00124         std::list<Cycle*> m_Cycles;
    00128         std::list<Chain*> m_Chains;
    00132         std::list<Atom*> m_Atoms;
    00136         std::list<Bond*> m_Bonds;
    00137 };
    00138
    00139 }       //      namespace gcu
    00140
    00141 #endif  //      GCU_MOLECULE_H