RDKit: BondIterators.h Source File

| RDKit Open-source cheminformatics and machine learning.

Loading...
Searching...
No Matches
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
23namespace RDKit {
24
25//! \brief iterator for a molecule's bonds, currently BiDirectional,
26//! but it theoretically ought to be RandomAccess.
27 class RDKIT_GRAPHMOL_EXPORT BondIterator_ {
28 // FIX: I'm not pleased with the lack of internal testing code
29 // (PREs and the like) in here
30 public:
31 BondIterator_() {}
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{nullptr};
49};
50//! \brief const iterator for a molecule's bonds, currently BiDirectional,
51//! but it theoretically ought to be RandomAccess.
52 class RDKIT_GRAPHMOL_EXPORT ConstBondIterator_ {
53 public:
54 ConstBondIterator_() {}
55 ConstBondIterator_(ROMol const *mol);
56 ConstBondIterator_(ROMol const *mol, ROMol::EDGE_ITER pos);
57 ConstBondIterator_(const ConstBondIterator_ &other);
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{nullptr};
72};
73} // namespace RDKit
74
75#endif
ROMol.h
Defines the primary molecule class ROMol as well as associated typedefs.
RDKit::BondIterator_::BondIterator_
BondIterator_(ROMol *mol)
RDKit::BondIterator_::operator=
BondIterator_ & operator=(const BondIterator_ &other)
RDKit::BondIterator_::operator!=
bool operator!=(const BondIterator_ &other) const
RDKit::BondIterator_::operator++
BondIterator_ & operator++()
RDKit::BondIterator_::BondIterator_
BondIterator_(const BondIterator_ &other)
RDKit::BondIterator_::operator*
Bond * operator*() const
RDKit::BondIterator_::BondIterator_
BondIterator_()
Definition BondIterators.h:31
RDKit::BondIterator_::operator++
BondIterator_ operator++(int)
RDKit::BondIterator_::operator--
BondIterator_ & operator--()
RDKit::BondIterator_::BondIterator_
BondIterator_(ROMol *mol, ROMol::EDGE_ITER pos)
RDKit::BondIterator_::operator--
BondIterator_ operator--(int)
RDKit::BondIterator_::operator==
bool operator==(const BondIterator_ &other) const
RDKit::Bond
class for representing a bond
Definition Bond.h:46
RDKit::ConstBondIterator_::operator--
ConstBondIterator_ operator--(int)
RDKit::ConstBondIterator_::operator--
ConstBondIterator_ & operator--()
RDKit::ConstBondIterator_::ConstBondIterator_
ConstBondIterator_(const ConstBondIterator_ &other)
RDKit::ConstBondIterator_::operator*
Bond const * operator*() const
RDKit::ConstBondIterator_::operator=
ConstBondIterator_ & operator=(const ConstBondIterator_ &other)
RDKit::ConstBondIterator_::ConstBondIterator_
ConstBondIterator_(ROMol const *mol, ROMol::EDGE_ITER pos)
RDKit::ConstBondIterator_::ConstBondIterator_
ConstBondIterator_(ROMol const *mol)
RDKit::ConstBondIterator_::operator==
bool operator==(const ConstBondIterator_ &other) const
RDKit::ConstBondIterator_::operator++
ConstBondIterator_ operator++(int)
RDKit::ConstBondIterator_::operator++
ConstBondIterator_ & operator++()
RDKit::ConstBondIterator_::ConstBondIterator_
ConstBondIterator_()
Definition BondIterators.h:54
RDKit::ConstBondIterator_::operator!=
bool operator!=(const ConstBondIterator_ &other) const
RDKit::ROMol
Definition ROMol.h:199
export.h
RDKIT_GRAPHMOL_EXPORT
#define RDKIT_GRAPHMOL_EXPORT
Definition export.h:249
RDKit
Std stuff.
Definition Abbreviations.h:19