The Gnome Chemistry Utils
0.13.6
|
00001 // -*- C++ -*- 00002 00003 /* 00004 * Gnome Chemistry Utils 00005 * libs/gcu/molecule.h 00006 * 00007 * Copyright (C) 2001-2012 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 #include "structs.h" 00030 00032 namespace gcu { 00033 00034 class Atom; 00035 class Bond; 00036 class Chain; 00037 class Cycle; 00038 class Formula; 00039 00043 class Molecule: public Object 00044 { 00045 friend class Chain; 00046 public: 00055 Molecule (TypeId Type = MoleculeType, ContentType ct = ContentType3D); 00064 Molecule (Atom* pAtom, ContentType ct = ContentType3D); 00068 virtual ~Molecule (); 00069 00075 void AddChild (Object* object); 00081 virtual void AddAtom (Atom* pAtom); 00087 virtual void AddBond (Bond* pBond); 00093 virtual void Remove (gcu::Object* pObject); 00099 void UpdateCycles (Bond* pBond); 00103 void UpdateCycles (); 00109 bool operator== (Molecule const& molecule) const; 00113 virtual unsigned GetAtomsNumber () const {return m_Atoms.size ();} 00124 static Molecule *MoleculeFromFormula (Document *Doc, Formula const &formula, bool add_pseudo = true); 00125 00129 void Clear (); 00135 Atom const *GetFirstAtom (std::list<Atom*>::const_iterator &i) const; 00141 Atom const *GetNextAtom (std::list<Atom*>::const_iterator &i) const; 00147 Bond const *GetFirstBond (std::list<Bond*>::const_iterator &i) const; 00153 Bond const *GetNextBond(std::list<Bond*>::const_iterator &i) const; 00164 void SetName (char const *name, char const *convention); 00170 char const *GetName (char const *convention = NULL); 00174 std::string Name (); 00175 00179 void ResetIndentifiers (); 00180 00184 std::string const &GetCML (); 00185 00189 void ClearCycles (); 00190 00194 std::string const &GetInChI (); 00195 00199 std::string const &GetInChIKey (); 00200 00204 std::string const &GetSMILES (); 00208 virtual std::string GetRawFormula () const; 00209 00210 protected: 00214 std::list<Cycle*> m_Cycles; 00218 std::list<Chain*> m_Chains; 00222 std::list<Atom*> m_Atoms; 00226 std::list<Bond*> m_Bonds; 00227 00228 private: 00229 std::map <std::string, std::string> m_Names; 00230 std::string m_CML; 00231 std::string m_InChI; 00232 std::string m_InChIKey; 00233 std::string m_SMILES; 00234 ContentType m_Content; 00235 }; 00236 00237 } // namespace gcu 00238 00239 #endif // GCU_MOLECULE_H