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.
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 
45  private:
46  ROMol::EDGE_ITER _beg, _end, _pos;
47  ROMol *_mol;
48 };
49 //! \brief const iterator for a molecule's bonds, currently BiDirectional,
50 //! but it theoretically ought to be RandomAccess.
52  public:
53  ConstBondIterator_() : _mol(NULL){};
54  ConstBondIterator_(ROMol const *mol);
55  ConstBondIterator_(ROMol const *mol, ROMol::EDGE_ITER pos);
58  bool operator==(const ConstBondIterator_ &other) const;
59  bool operator!=(const ConstBondIterator_ &other) const;
60  Bond const *operator*() const;
61  // pre-increment
64  // pre-decrement
67 
68  private:
69  ROMol::EDGE_ITER _beg, _end, _pos;
70  ROMol const *_mol;
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:103
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:51
Std stuff.
Definition: Atom.h:29
bool operator==(const BondIterator_ &other) const
class for representing a bond
Definition: Bond.h:47
BondIterator_ & operator--()
BondIterator_ & operator++()