/usr/include/rdkit/GraphMol/AtomIterators.h is in librdkit-dev 201309-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | //
// Copyright (C) 2002-2006 Greg Landrum and Rational Discovery LLC
//
// @@ All Rights Reserved @@
// This file is part of the RDKit.
// The contents are covered by the terms of the BSD license
// which is included in the file license.txt, found at the root
// of the RDKit source tree.
//
/*! \file AtomIterators.h
\brief various tools for iterating over a molecule's Atoms.
<b>WARNING:</b> If you go changing the molecule underneath one of
these iterators you will be sad...
*/
#ifndef __RD_ATOM_ITERATORS_H__
#define __RD_ATOM_ITERATORS_H__
#ifdef _MSC_VER
#pragma warning (disable: 4661) // no suitable definition provided for explicit template instantiation request
#endif
namespace RDKit{
class QueryAtom;
//! A general random access iterator
template <class Atom_, class Mol_>
class AtomIterator_ {
public:
typedef AtomIterator_<Atom_,Mol_> ThisType;
AtomIterator_() : _pos(0),_max(-1),_mol(0) {};
AtomIterator_(Mol_ * mol);
AtomIterator_(Mol_ * mol,int pos);
AtomIterator_(const ThisType &other);
AtomIterator_ &operator=(const ThisType &other);
AtomIterator_ &operator+=(int val);
AtomIterator_ &operator-=(int val);
AtomIterator_ operator+(int val);
AtomIterator_ operator-(int val);
// iterator subtraction
int operator-(ThisType &other);
// dereference
Atom_ * operator*();
// random access
Atom_ * operator[](const int which);
bool operator==(const ThisType &other);
bool operator!=(const ThisType &other);
bool operator<(const ThisType &other);
bool operator<=(const ThisType &other);
bool operator>(const ThisType &other);
bool operator>=(const ThisType &other);
// pre-increment
ThisType &operator++();
ThisType operator++(int);
// pre-decrement
ThisType &operator--();
ThisType operator--(int);
private:
int _pos,_max;
Mol_ * _mol;
};
//! Iterate over heteroatoms, this is bidirectional
template <class Atom_, class Mol_>
class HeteroatomIterator_ {
public:
typedef HeteroatomIterator_<Atom_,Mol_> ThisType;
HeteroatomIterator_() : _mol(0) {};
HeteroatomIterator_(Mol_ * mol);
HeteroatomIterator_(Mol_ * mol,int pos);
~HeteroatomIterator_();
HeteroatomIterator_(const ThisType &other);
HeteroatomIterator_ &operator=(const ThisType &other);
bool operator==(const ThisType &other);
bool operator!=(const ThisType &other);
Atom_ * operator*();
// pre-increment
ThisType &operator++();
ThisType operator++(int);
// pre-decrement
ThisType &operator--();
ThisType operator--(int);
private:
int _end,_pos;
Mol_ * _mol;
//FIX: somehow changing the following to a pointer make the regression test pass
// QueryAtom _qA;
QueryAtom *_qA;
int _findNext(int from);
int _findPrev(int from);
};
//! Iterate over aromatic atoms, this is bidirectional
template <class Atom_, class Mol_>
class AromaticAtomIterator_ {
public:
typedef AromaticAtomIterator_<Atom_,Mol_> ThisType;
AromaticAtomIterator_() : _mol(0) {};
AromaticAtomIterator_(Mol_ * mol);
AromaticAtomIterator_(Mol_ * mol,int pos);
~AromaticAtomIterator_();
AromaticAtomIterator_(const ThisType &other);
AromaticAtomIterator_ &operator=(const ThisType &other);
bool operator==(const ThisType &other);
bool operator!=(const ThisType &other);
Atom_ * operator*();
// pre-increment
ThisType &operator++();
ThisType operator++(int);
// pre-decrement
ThisType &operator--();
ThisType operator--(int);
private:
int _end,_pos;
Mol_ * _mol;
int _findNext(int from);
int _findPrev(int from);
};
//! Iterate over atoms matching a query. This is bidirectional.
template <class Atom_, class Mol_>
class QueryAtomIterator_ {
public:
typedef QueryAtomIterator_<Atom_,Mol_> ThisType;
QueryAtomIterator_() : _mol(0),_qA(0) {};
QueryAtomIterator_(Mol_ * mol,QueryAtom const *what);
QueryAtomIterator_(Mol_ * mol,int pos);
~QueryAtomIterator_();
QueryAtomIterator_(const ThisType &other);
QueryAtomIterator_ &operator=(const ThisType &other);
bool operator==(const ThisType &other);
bool operator!=(const ThisType &other);
Atom_ * operator*();
// pre-increment
ThisType &operator++();
ThisType operator++(int);
// pre-decrement
ThisType &operator--();
ThisType operator--(int);
private:
int _end,_pos;
Mol_ * _mol;
QueryAtom *_qA;
int _findNext(int from);
int _findPrev(int from);
};
} /* end o namespace */
#endif
|