RDKit: BondIterators.h Source File

| RDKit Open-source cheminformatics and machine learning.

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

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
39 BondIterator_ &operator++();
40 BondIterator_ operator++(int);
41 // pre-decrement
42 BondIterator_ &operator--();
43 BondIterator_ operator--(int);
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.
51 class ConstBondIterator_ {
52 public:
53 ConstBondIterator_() : _mol(NULL){};
54 ConstBondIterator_(ROMol const *mol);
55 ConstBondIterator_(ROMol const *mol, ROMol::EDGE_ITER pos);
56 ConstBondIterator_(const ConstBondIterator_ &other);
57 ConstBondIterator_ &operator=(const ConstBondIterator_ &other);
58 bool operator==(const ConstBondIterator_ &other) const;
59 bool operator!=(const ConstBondIterator_ &other) const;
60 Bond const *operator*() const;
61 // pre-increment
62 ConstBondIterator_ &operator++();
63 ConstBondIterator_ operator++(int);
64 // pre-decrement
65 ConstBondIterator_ &operator--();
66 ConstBondIterator_ operator--(int);
67
68 private:
69 ROMol::EDGE_ITER _beg, _end, _pos;
70 ROMol const *_mol;
71 };
72 }
73
74 #endif
RDKit::BondIterator_::operator!=
bool operator!=(const BondIterator_ &other) const
RDKit::BondIterator_::operator*
Bond * operator*() const
RDKit::ConstBondIterator_::ConstBondIterator_
ConstBondIterator_()
Definition: BondIterators.h:53
RDKit::BondIterator_::BondIterator_
BondIterator_()
Definition: BondIterators.h:30
ROMol.h
Defines the primary molecule class ROMol as well as associated typedefs.
RDKit::BondIterator_
iterator for a molecule&#39;s bonds, currently BiDirectional, but it theoretically ought to be RandomAcce...
Definition: BondIterators.h:26
RDKit::ROMol
ROMol is a molecule class that is intended to have a fixed topology.
Definition: ROMol.h:103
RDKit::BondIterator_::operator=
BondIterator_ & operator=(const BondIterator_ &other)
RDKit::ConstBondIterator_
const iterator for a molecule&#39;s bonds, currently BiDirectional, but it theoretically ought to be Rand...
Definition: BondIterators.h:51
RDKit
Std stuff.
Definition: Atom.h:29
RDKit::BondIterator_::operator==
bool operator==(const BondIterator_ &other) const
RDKit::Bond
class for representing a bond
Definition: Bond.h:47
RDKit::BondIterator_::operator--
BondIterator_ & operator--()
RDKit::BondIterator_::operator++
BondIterator_ & operator++()