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:
33  BondIterator_(ROMol *mol, ROMol::EDGE_ITER pos);
36  bool operator==(const BondIterator_ &other) const;
37  bool operator!=(const BondIterator_ &other) const;
38  Bond *operator*() const;
39  // pre-increment
42  // pre-decrement
45 
46  private:
47  ROMol::EDGE_ITER _beg, _end, _pos;
48  ROMol *_mol{nullptr};
49 };
50 //! \brief const iterator for a molecule's bonds, currently BiDirectional,
51 //! but it theoretically ought to be RandomAccess.
53  public:
56  ConstBondIterator_(ROMol const *mol, ROMol::EDGE_ITER pos);
59  bool operator==(const ConstBondIterator_ &other) const;
60  bool operator!=(const ConstBondIterator_ &other) const;
61  Bond const *operator*() const;
62  // pre-increment
65  // pre-decrement
68 
69  private:
70  ROMol::EDGE_ITER _beg, _end, _pos;
71  ROMol const *_mol{nullptr};
72 };
73 } // namespace RDKit
74 
75 #endif
Defines the primary molecule class ROMol as well as associated typedefs.
iterator for a molecule's bonds, currently BiDirectional, but it theoretically ought to be RandomAcce...
Definition: BondIterators.h:27
BondIterator_(ROMol *mol)
BondIterator_ & operator++()
BondIterator_ & operator=(const BondIterator_ &other)
bool operator!=(const BondIterator_ &other) const
BondIterator_(const BondIterator_ &other)
BondIterator_ operator++(int)
BondIterator_ & operator--()
BondIterator_(ROMol *mol, ROMol::EDGE_ITER pos)
Bond * operator*() const
BondIterator_ operator--(int)
bool operator==(const BondIterator_ &other) const
class for representing a bond
Definition: Bond.h:47
const iterator for a molecule's bonds, currently BiDirectional, but it theoretically ought to be Rand...
Definition: BondIterators.h:52
Bond const * operator*() const
ConstBondIterator_ operator--(int)
ConstBondIterator_ & operator++()
ConstBondIterator_(const ConstBondIterator_ &other)
ConstBondIterator_ & operator--()
ConstBondIterator_(ROMol const *mol, ROMol::EDGE_ITER pos)
ConstBondIterator_(ROMol const *mol)
ConstBondIterator_ & operator=(const ConstBondIterator_ &other)
bool operator==(const ConstBondIterator_ &other) const
ConstBondIterator_ operator++(int)
bool operator!=(const ConstBondIterator_ &other) const
#define RDKIT_GRAPHMOL_EXPORT
Definition: export.h:225
Std stuff.
Definition: Abbreviations.h:19