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 #include <RDGeneral/export.h>
18 #ifndef _RD_BOND_ITERATORS_H
19 #define _RD_BOND_ITERATORS_H
20 
21 #include "ROMol.h"
22 
23 namespace RDKit {
24 
25 //! \brief iterator for a molecule's bonds, currently BiDirectional,
26 //! but it theoretically ought to be RandomAccess.
28  // FIX: I'm not pleased with the lack of internal testing code
29  // (PREs and the like) in here
30  public:
31  BondIterator_() : _mol(NULL){};
32  BondIterator_(ROMol *mol);
33  BondIterator_(ROMol *mol, ROMol::EDGE_ITER pos);
34  BondIterator_(const BondIterator_ &other);
35  BondIterator_ &operator=(const BondIterator_ &other);
36  bool operator==(const BondIterator_ &other) const;
37  bool operator!=(const BondIterator_ &other) const;
38  Bond *operator*() const;
39  // pre-increment
40  BondIterator_ &operator++();
41  BondIterator_ operator++(int);
42  // pre-decrement
43  BondIterator_ &operator--();
44  BondIterator_ operator--(int);
45 
46  private:
47  ROMol::EDGE_ITER _beg, _end, _pos;
48  ROMol *_mol;
49 };
50 //! \brief const iterator for a molecule's bonds, currently BiDirectional,
51 //! but it theoretically ought to be RandomAccess.
53  public:
54  ConstBondIterator_() : _mol(NULL){};
55  ConstBondIterator_(ROMol const *mol);
56  ConstBondIterator_(ROMol const *mol, ROMol::EDGE_ITER pos);
58  ConstBondIterator_ &operator=(const ConstBondIterator_ &other);
59  bool operator==(const ConstBondIterator_ &other) const;
60  bool operator!=(const ConstBondIterator_ &other) const;
61  Bond const *operator*() const;
62  // pre-increment
63  ConstBondIterator_ &operator++();
64  ConstBondIterator_ operator++(int);
65  // pre-decrement
66  ConstBondIterator_ &operator--();
67  ConstBondIterator_ operator--(int);
68 
69  private:
70  ROMol::EDGE_ITER _beg, _end, _pos;
71  ROMol const *_mol;
72 };
73 } // namespace RDKit
74 
75 #endif
ROMol.h
Defines the primary molecule class ROMol as well as associated typedefs.
RDKit::Bond
class for representing a bond
Definition: Bond.h:47
RDKit::BondIterator_::BondIterator_
BondIterator_()
Definition: BondIterators.h:31
RDKit::ROMol
Definition: ROMol.h:171
RDKit::ConstBondIterator_
const iterator for a molecule's bonds, currently BiDirectional, but it theoretically ought to be Rand...
Definition: BondIterators.h:52
RDKIT_GRAPHMOL_EXPORT
#define RDKIT_GRAPHMOL_EXPORT
Definition: export.h:307
RDKit::BondIterator_
iterator for a molecule's bonds, currently BiDirectional, but it theoretically ought to be RandomAcce...
Definition: BondIterators.h:27
RDKit
Std stuff.
Definition: Atom.h:30
RDGeom::operator*
RDKIT_RDGEOMETRYLIB_EXPORT RDGeom::Point3D operator*(const RDGeom::Point3D &p1, double v)
RDKit::ConstBondIterator_::ConstBondIterator_
ConstBondIterator_()
Definition: BondIterators.h:54
export.h