Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __RD_ATOM_ITERATORS_H__
00018 #define __RD_ATOM_ITERATORS_H__
00019
00020 #ifdef _MSC_VER
00021 #pragma warning (disable: 4661) // no suitable definition provided for explicit template instantiation request
00022 #endif
00023
00024 namespace RDKit{
00025 class QueryAtom;
00026
00027
00028 template <class Atom_, class Mol_>
00029 class AtomIterator_ {
00030 public:
00031 typedef AtomIterator_<Atom_,Mol_> ThisType;
00032 AtomIterator_() : _pos(0),_max(-1),_mol(0) {};
00033 AtomIterator_(Mol_ * mol);
00034 AtomIterator_(Mol_ * mol,int pos);
00035 AtomIterator_(const ThisType &other);
00036 AtomIterator_ &operator=(const ThisType &other);
00037 AtomIterator_ &operator+=(int val);
00038 AtomIterator_ &operator-=(int val);
00039 AtomIterator_ operator+(int val);
00040 AtomIterator_ operator-(int val);
00041
00042
00043 int operator-(ThisType &other);
00044
00045
00046 Atom_ * operator*();
00047
00048 Atom_ * operator[](const int which);
00049 bool operator==(const ThisType &other);
00050 bool operator!=(const ThisType &other);
00051 bool operator<(const ThisType &other);
00052 bool operator<=(const ThisType &other);
00053 bool operator>(const ThisType &other);
00054 bool operator>=(const ThisType &other);
00055
00056
00057 ThisType &operator++();
00058 ThisType operator++(int);
00059
00060
00061 ThisType &operator--();
00062 ThisType operator--(int);
00063
00064 private:
00065 int _pos,_max;
00066 Mol_ * _mol;
00067 };
00068
00069
00070
00071 template <class Atom_, class Mol_>
00072 class HeteroatomIterator_ {
00073 public:
00074 typedef HeteroatomIterator_<Atom_,Mol_> ThisType;
00075 HeteroatomIterator_() : _mol(0) {};
00076 HeteroatomIterator_(Mol_ * mol);
00077 HeteroatomIterator_(Mol_ * mol,int pos);
00078 ~HeteroatomIterator_();
00079 HeteroatomIterator_(const ThisType &other);
00080 HeteroatomIterator_ &operator=(const ThisType &other);
00081 bool operator==(const ThisType &other);
00082 bool operator!=(const ThisType &other);
00083
00084 Atom_ * operator*();
00085
00086
00087 ThisType &operator++();
00088 ThisType operator++(int);
00089
00090
00091 ThisType &operator--();
00092 ThisType operator--(int);
00093 private:
00094 int _end,_pos;
00095 Mol_ * _mol;
00096
00097
00098 QueryAtom *_qA;
00099
00100 int _findNext(int from);
00101 int _findPrev(int from);
00102 };
00103
00104
00105
00106
00107 template <class Atom_, class Mol_>
00108 class AromaticAtomIterator_ {
00109 public:
00110 typedef AromaticAtomIterator_<Atom_,Mol_> ThisType;
00111 AromaticAtomIterator_() : _mol(0) {};
00112 AromaticAtomIterator_(Mol_ * mol);
00113 AromaticAtomIterator_(Mol_ * mol,int pos);
00114 ~AromaticAtomIterator_();
00115 AromaticAtomIterator_(const ThisType &other);
00116 AromaticAtomIterator_ &operator=(const ThisType &other);
00117 bool operator==(const ThisType &other);
00118 bool operator!=(const ThisType &other);
00119
00120 Atom_ * operator*();
00121
00122
00123 ThisType &operator++();
00124 ThisType operator++(int);
00125
00126
00127 ThisType &operator--();
00128 ThisType operator--(int);
00129 private:
00130 int _end,_pos;
00131 Mol_ * _mol;
00132
00133 int _findNext(int from);
00134 int _findPrev(int from);
00135 };
00136
00137
00138
00139
00140 template <class Atom_, class Mol_>
00141 class QueryAtomIterator_ {
00142 public:
00143 typedef QueryAtomIterator_<Atom_,Mol_> ThisType;
00144 QueryAtomIterator_() : _mol(0),_qA(0) {};
00145 QueryAtomIterator_(Mol_ * mol,QueryAtom const *what);
00146 QueryAtomIterator_(Mol_ * mol,int pos);
00147 ~QueryAtomIterator_();
00148 QueryAtomIterator_(const ThisType &other);
00149 QueryAtomIterator_ &operator=(const ThisType &other);
00150 bool operator==(const ThisType &other);
00151 bool operator!=(const ThisType &other);
00152
00153 Atom_ * operator*();
00154
00155
00156 ThisType &operator++();
00157 ThisType operator++(int);
00158
00159
00160 ThisType &operator--();
00161 ThisType operator--(int);
00162 private:
00163 int _end,_pos;
00164 Mol_ * _mol;
00165 QueryAtom *_qA;
00166
00167 int _findNext(int from);
00168 int _findPrev(int from);
00169 };
00170
00171
00172 }
00173
00174 #endif