00001 /**************************************************************************************** 00002 ring.h 00003 ---------- 00004 copyright : (C) 2006 Jean-Luc Perret - Pierre Mahé 00005 email : jean-luc.perret@unine.ch - pierre.mahe@ensmp.fr 00006 ***************************************************************************************/ 00007 00008 /**************************************************************************************** 00009 * * 00010 * This program is free software; you can redistribute it and/or * 00011 * modify it under the terms of the GNU Lesser General Public * 00012 * License as published by the Free Software Foundation; either * 00013 * version 2.1 of the License, or (at your option) any later version. * 00014 * * 00015 * This program is distributed in the hope that it will be useful, * 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00018 * Lesser General Public License for more details. * 00019 * * 00020 * You should have received a copy of the GNU Lesser General Public * 00021 * License along with this library; if not, write to the Free Software * 00022 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * 00023 * * 00024 ****************************************************************************************/ 00025 00026 00027 #ifndef RING_H 00028 #define RING_H 00029 00030 #include <vector> 00031 00032 #include <cerror.h> 00033 00034 00035 using namespace std; 00036 00037 class Atom; 00038 class Bond; 00039 00040 00046 class Ring : public std::vector<Atom*>{ 00047 public: 00048 00050 00051 00053 Ring(); 00054 00057 Ring( vector<Atom*>*, vector<Bond*>* ); 00058 00061 ~Ring(); 00062 00066 void addBond( Bond* aBond, bool silentError = false ) throw ( CError ); 00067 00070 void addAtom( Atom* anAtom, bool silentError = false ) throw ( CError ); 00071 00073 00075 00076 00079 int getID(){ return( id ); } 00080 00083 void setID( int a ){ id = a; } 00084 00087 vector<Bond*>* getBonds(){ return( &bonds ); } 00088 00090 00091 00092 00094 00095 00097 bool hasAtom( Atom* anAtom ); 00098 00101 bool hasBond( Bond* aBond ); 00102 00105 bool equals( Ring* anotherRing ); 00106 00108 00109 00111 00112 00115 string toStringShort(); 00116 00119 string toString(); 00120 00123 void describeShort(); 00124 00127 void describe(); 00128 00130 00131 00132 // ****************************** // 00133 // **** DEPRECATED FUNCTIONS **** // 00134 // ****************************** // 00135 //Ring( vector<Atom*>* ); 00136 //vector<Bond*>::iterator beginBond(){ return( bonds.begin() ) ; } 00137 //vector<Bond*>::iterator endBond(){ return( bonds.end() ) ; } 00138 00139 protected: 00140 00143 vector<Bond*> bonds; 00144 00147 int id; 00148 00149 }; 00150 00151 #endif