bond.h

00001 /****************************************************************************************
00002                                           bond.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 
00028 #ifndef BOND_H
00029 #define BOND_H
00030 
00031 //#include<sstream>
00032 
00033 #include "constant.h"
00034 #include "datacontainer.h"
00035 #include "atom.h"
00036 
00037 #include <ring.h>
00038 
00039 
00040 class Atom;
00041 
00075 class Bond { //: public DataContainer  {  // bonds do not need to be a DataContainer
00076 
00082 public:
00083 
00085 
00086 
00088         Bond();
00089 
00092         Bond(Atom* aSource, Atom* aTarget, int aLabel, int aPerretLabel = NAVALUE, int aBondStereo = 0,  int aBondNotUsed = 0, int aBondTopology = 0, int aBondReactionCenter = 0 );
00093 
00096         ~Bond();
00097 
00099 
00100 
00101 
00103 
00104 
00107         Atom* getTarget() throw( CError );
00108 
00111         bool hasTarget(){ if( target == NULL ){ return( false ); }else{ return( true ); }}
00112 
00115         Atom* getSource() throw( CError );
00116 
00119         bool hasSource(){ if( source == NULL ){ return( false ); }else{ return( true ); }}
00120 
00123         int getLabel(){ return(label);}
00124 
00128         int getPerretLabel(){
00129                 return( perretLabel );
00130         }
00131 
00134         void setPerretLabel();
00135 
00136 
00142         void setKashimaPT(double aPt){ pt = aPt; }
00143 
00146         double getKashimaPT(){ return( pt ); }
00147 
00151         bool hasFlag(){ return flag; }
00152 
00155         void setFlag(){ flag = true; }
00156 
00159         void unsetFlag(){ flag = false; }
00160 
00164         bool hasFlagOriginal(){ return flagOriginal; }
00165         
00168         void setFlagOriginal(){ flagOriginal = true; }
00169 
00172         void unsetFlagOriginal(){ flagOriginal = false; }
00173 
00174 
00177         void addRing( Ring* aRing ){ if( !hasRing( aRing ) ){ rings.push_back( aRing ); } }
00178 
00181         bool hasRing( Ring* aRing );
00182 
00185         bool hasRing(){ if( numRings() > 0 ){ return( true ); }else{ return( false );};}
00186         
00189         int numRings(){ return( rings.size() ); }
00190 
00193         void setStereo( int a ){ stereo = a; }
00194 
00197         int getStereo(){ return( stereo ); }
00198         
00201         void setTopology( int a ){ topology = a; }
00202 
00205         int getTopology(){ return( topology ); }
00206 
00209         void setReactionCenter( int a ){ reactionCenter = a; }
00210 
00213         int getReactionCenter(){ return( reactionCenter ); }
00214         
00217         void setNotUsed( int a ){ notUsed = a; }
00218 
00221         int getNotUsed(){ return( notUsed ); }
00222 
00224 
00225 
00227 
00228 
00230         void reverse();
00231 
00234         Bond* getReverse() throw( CError );
00235 
00238         void hideToFrom();
00239         
00242         void restoreToFrom();
00243 
00245 
00246 
00247 
00249 
00250 
00254         string toString();
00255 
00259         string toStringShort();
00260 
00263         void describe();
00264 
00267         void describeShort();
00268 
00270 
00271 
00272 
00274 
00275 
00276 
00279         vector<Ring*>::iterator beginRing(){ return( rings.begin() );}
00282         vector<Ring*>::iterator endRing(){ return( rings.end() );}
00283 
00285 
00286 
00287         // ****************************** //
00288         // **** DEPRECATED FUNCTIONS **** //
00289         // ****************************** //
00290 
00291         //string toStringBFSVector();
00292         //Ring* getRingBFS( vector<Bond*>* toVisit, Bond* init = NULL );
00293 
00294 
00295 private: // Private attributes
00296 
00299         Atom *source;
00300 
00303         Atom *target;
00304 
00307         int label;
00308 
00311         int perretLabel;
00312 
00317         int stereo;
00318 
00321         int notUsed;
00322 
00326         int topology;
00327 
00330         int reactionCenter;
00331 
00334         double pt;
00335 
00338         bool flag;
00339 
00343         bool flagOriginal;      
00344                                 
00348         //map< string, Descriptor< Atom >* > atomDescriptors;
00349 
00352         //vector<Bond*> BFSVector;
00353 
00356         vector<Ring*> rings;
00357 
00358 
00359 };
00360 
00361 #endif

Generated on Wed Nov 28 12:12:51 2007 for ChemCpp by  doxygen 1.4.6