Changeset 14d898 for molecuilder/src/World.hpp
- Timestamp:
- Mar 3, 2010, 3:46:03 PM (16 years ago)
- Children:
- 3746aeb
- Parents:
- 78b9d9
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/World.hpp
r78b9d9 r14d898 27 27 class AtomDescriptor; 28 28 class AtomDescriptor_impl; 29 class MoleculeDescriptor; 30 class MoleculeDescriptor_impl; 29 31 class ManipulateAtomsProcess; 30 32 template<typename T> … … 36 38 friend class AtomDescriptor_impl; 37 39 friend class AtomDescriptor; 40 friend class MoleculeDescriptor_impl; 41 friend class MoleculeDescriptor; 38 42 39 43 // Actions, calculations etc associated with the World … … 77 81 78 82 /** 83 * returns the first molecule that matches a given descriptor. 84 * Do not rely on ordering for descriptors that match more than one molecule. 85 */ 86 molecule *getMolecule(MoleculeDescriptor descriptor); 87 88 /** 89 * returns a vector containing all molecules that match a given descriptor 90 */ 91 std::vector<molecule*> getAllMolecules(MoleculeDescriptor descriptor); 92 93 /** 79 94 * get the number of molecules in the World 80 95 */ … … 125 140 protected: 126 141 /**** Iterators to use internal data structures */ 142 143 // Atoms 144 127 145 class AtomIterator { 128 146 public: … … 163 181 AtomSet::iterator atomEnd(); 164 182 183 // Molecules 184 185 class MoleculeIterator { 186 public: 187 MoleculeIterator(); 188 MoleculeIterator(MoleculeDescriptor, World*); 189 MoleculeIterator(const MoleculeIterator&); 190 MoleculeIterator& operator=(const MoleculeIterator&); 191 MoleculeIterator& operator++(); // prefix 192 MoleculeIterator operator++(int); // postfix with dummy parameter 193 bool operator==(const MoleculeIterator&); 194 bool operator==(const MoleculeSet::iterator&); 195 bool operator!=(const MoleculeIterator&); 196 bool operator!=(const MoleculeSet::iterator&); 197 molecule* operator*(); 198 199 int getCount(); 200 protected: 201 void advanceState(); 202 MoleculeSet::iterator state; 203 boost::shared_ptr<MoleculeDescriptor_impl> descr; 204 int index; 205 206 World* world; 207 }; 208 209 /** 210 * returns an iterator over all Molecules matching a given descriptor. 211 * used for internal purposes, like MoleculeProcesses and MoleculeCalculations. 212 */ 213 MoleculeIterator getMoleculeIter(MoleculeDescriptor descr); 214 215 /** 216 * returns an iterator to the end of the MoleculeSet. Due to overloading this iterator 217 * can be compared to iterators produced by getMoleculeIter (see the mis-matching types). 218 * Thus it can be used to detect when such an iterator is at the end of the list. 219 * used for internal purposes, like MoleculeProcesses and MoleculeCalculations. 220 */ 221 MoleculeSet::iterator moleculeEnd(); 222 223 165 224 /******* Internal manipulation routines for double callback and Observer mechanism ******/ 166 225 void doManipulate(ManipulateAtomsProcess *);
Note:
See TracChangeset
for help on using the changeset viewer.