RDKit
Open-source cheminformatics and machine learning.
BondIterators.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2002-2006 Greg Landrum and Rational Discovery LLC
3 //
4 // @@ All Rights Reserved @@
5 // This file is part of the RDKit.
6 // The contents are covered by the terms of the BSD license
7 // which is included in the file license.txt, found at the root
8 // of the RDKit source tree.
9 //
10 /*! \file BondIterators.h
11 
12  \brief various tools for iterating over a molecule's Bonds
13 
14  <b>WARNING:</b> If you go changing the molecule underneath one of
15  these iterators you will be sad...
16 */
17 #ifndef _RD_BOND_ITERATORS_H
18 #define _RD_BOND_ITERATORS_H
19 
20 #include "ROMol.h"
21 
22 namespace RDKit{
23 
24  //! \brief iterator for a molecule's bonds, currently BiDirectional,
25  //! but it theoretically ought to be RandomAccess.
26  class BondIterator_ {
27  //FIX: I'm not pleased with the lack of internal testing code
28  // (PREs and the like) in here
29  public:
30  BondIterator_() : _mol(NULL) {};
31  BondIterator_(ROMol *mol);
32  BondIterator_(ROMol *mol,ROMol::EDGE_ITER pos);
33  BondIterator_(const BondIterator_ &other);
34  BondIterator_ &operator=(const BondIterator_ &other);
35  bool operator==(const BondIterator_ &other) const;
36  bool operator!=(const BondIterator_ &other) const;
37  Bond *operator*() const;
38  // pre-increment
41  // pre-decrement
44  private:
45  ROMol::EDGE_ITER _beg,_end,_pos;
46  ROMol *_mol;
47  };
48  //! \brief const iterator for a molecule's bonds, currently BiDirectional,
49  //! but it theoretically ought to be RandomAccess.
51  public:
52  ConstBondIterator_() : _mol(NULL) {};
53  ConstBondIterator_(ROMol const *mol);
54  ConstBondIterator_(ROMol const *mol,ROMol::EDGE_ITER pos);
57  bool operator==(const ConstBondIterator_ &other) const;
58  bool operator!=(const ConstBondIterator_ &other) const;
59  Bond const *operator*() const;
60  // pre-increment
63  // pre-decrement
66  private:
67  ROMol::EDGE_ITER _beg,_end,_pos;
68  ROMol const *_mol;
69  };
70 
71 }
72 
73 
74 #endif
bool operator!=(const BondIterator_ &other) const
Bond * operator*() const
Defines the primary molecule class ROMol as well as associated typedefs.
iterator for a molecule&#39;s bonds, currently BiDirectional, but it theoretically ought to be RandomAcce...
Definition: BondIterators.h:26
ROMol is a molecule class that is intended to have a fixed topology.
Definition: ROMol.h:105
BondIterator_ & operator=(const BondIterator_ &other)
const iterator for a molecule&#39;s bonds, currently BiDirectional, but it theoretically ought to be Rand...
Definition: BondIterators.h:50
Includes a bunch of functionality for handling Atom and Bond queries.
Definition: Atom.h:28
bool operator==(const BondIterator_ &other) const
class for representing a bond
Definition: Bond.h:46
BondIterator_ & operator--()
BondIterator_ & operator++()