BondIterators.h

Go to the documentation of this file.
00001 //
00002 //  Copyright (C) 2002-2006 Greg Landrum and Rational Discovery LLC
00003 //
00004 //   @@ All Rights Reserved  @@
00005 //
00006 /*! \file BondIterators.h
00007 
00008   \brief various tools for iterating over a molecule's Bonds
00009 
00010    <b>WARNING:</b> If you go changing the molecule underneath one of
00011    these iterators you will be sad...
00012 */  
00013 #ifndef _RD_BOND_ITERATORS_H
00014 #define _RD_BOND_ITERATORS_H
00015 
00016 #include "ROMol.h"
00017 
00018 namespace RDKit{
00019 
00020   //! \brief iterator for a molecule's bonds, currently BiDirectional,
00021   //! but it theoretically ought to be RandomAccess.
00022   class BondIterator_ {
00023     //FIX: I'm not pleased with the lack of internal testing code
00024     //  (PREs and the like) in here
00025   public:
00026     BondIterator_() : _mol(NULL) {}; 
00027     BondIterator_(ROMol *mol);
00028     BondIterator_(ROMol *mol,ROMol::EDGE_ITER pos);
00029     BondIterator_(const BondIterator_ &other);
00030     BondIterator_ &operator=(const BondIterator_ &other);
00031     bool operator==(const BondIterator_ &other);
00032     bool operator!=(const BondIterator_ &other);
00033     Bond *operator*();
00034     // pre-increment
00035     BondIterator_ &operator++();
00036     BondIterator_ operator++(int);
00037     // pre-decrement
00038     BondIterator_ &operator--();
00039     BondIterator_ operator--(int);
00040   private:
00041     ROMol::EDGE_ITER _beg,_end,_pos;
00042     ROMol *_mol;
00043   };
00044   //! \brief const iterator for a molecule's bonds, currently BiDirectional,
00045   //! but it theoretically ought to be RandomAccess.
00046   class ConstBondIterator_ {
00047   public:
00048     ConstBondIterator_() : _mol(NULL) {}; 
00049     ConstBondIterator_(ROMol const *mol);
00050     ConstBondIterator_(ROMol const *mol,ROMol::EDGE_ITER pos);
00051     ConstBondIterator_(const ConstBondIterator_ &other);
00052     ConstBondIterator_ &operator=(const ConstBondIterator_ &other);
00053     bool operator==(const ConstBondIterator_ &other);
00054     bool operator!=(const ConstBondIterator_ &other);
00055     Bond const *operator*();
00056     // pre-increment
00057     ConstBondIterator_ &operator++();
00058     ConstBondIterator_ operator++(int);
00059     // pre-decrement
00060     ConstBondIterator_ &operator--();
00061     ConstBondIterator_ operator--(int);
00062   private:
00063     ROMol::EDGE_ITER _beg,_end,_pos;
00064     ROMol const *_mol;
00065   };
00066 
00067 }  
00068 
00069 
00070 #endif

Generated on Fri Apr 3 06:03:01 2009 for RDCode by  doxygen 1.5.6