Changes in src/World.hpp [23b547:88d586]
- File:
-
- 1 edited
-
src/World.hpp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/World.hpp
r23b547 r88d586 19 19 #include "Patterns/Observer.hpp" 20 20 #include "Patterns/Cacheable.hpp" 21 #include "Patterns/Singleton.hpp"22 23 21 24 22 // forward declarations … … 35 33 class AtomsCalculation; 36 34 37 38 39 class World : public Singleton<World>, public Observable 35 class World : public Observable 40 36 { 41 42 // Make access to constructor and destructor possible from inside the singleton43 friend class Singleton<World>;44 45 37 // necessary for coupling with descriptors 46 38 friend class AtomDescriptor_impl; … … 53 45 template<typename> friend class AtomsCalculation; 54 46 public: 55 56 // Types for Atom and Molecule structures57 47 typedef std::map<atomId_t,atom*> AtomSet; 58 48 typedef std::map<moleculeId_t,molecule*> MoleculeSet; … … 161 151 // Atoms 162 152 163 class AtomIterator : 164 public std::iterator<std::iterator_traits<AtomSet::iterator>::difference_type, 165 std::iterator_traits<AtomSet::iterator>::value_type, 166 std::iterator_traits<AtomSet::iterator>::pointer, 167 std::iterator_traits<AtomSet::iterator>::reference> 168 { 153 class AtomIterator { 169 154 public: 170 171 typedef AtomSet::iterator _Iter;172 typedef _Iter::value_type value_type;173 typedef _Iter::difference_type difference_type;174 typedef _Iter::pointer pointer;175 typedef _Iter::reference reference;176 typedef _Iter::iterator_category iterator_category;177 178 179 155 AtomIterator(); 180 156 AtomIterator(AtomDescriptor, World*); … … 215 191 // Molecules 216 192 217 class MoleculeIterator : 218 public std::iterator<std::iterator_traits<MoleculeSet::iterator>::difference_type, 219 std::iterator_traits<MoleculeSet::iterator>::value_type, 220 std::iterator_traits<MoleculeSet::iterator>::pointer, 221 std::iterator_traits<MoleculeSet::iterator>::reference> 222 { 193 class MoleculeIterator { 223 194 public: 224 225 typedef MoleculeSet::iterator _Iter;226 typedef _Iter::value_type value_type;227 typedef _Iter::difference_type difference_type;228 typedef _Iter::pointer pointer;229 typedef _Iter::reference reference;230 typedef _Iter::iterator_category iterator_category;231 232 195 MoleculeIterator(); 233 196 MoleculeIterator(MoleculeDescriptor, World*); … … 282 245 MoleculeSet molecules; 283 246 moleculeId_t currMoleculeId; 247 248 249 /***** singleton Stuff *****/ 250 public: 251 252 /** 253 * get the currently active instance of the World. 254 */ 255 static World* get(); 256 257 /** 258 * destroy the currently active instance of the World. 259 */ 260 static void destroy(); 261 262 /** 263 * destroy the currently active instance of the World and immidiately 264 * create a new one. Use this to reset while somebody is still Observing 265 * the world and should reset the observed instance. All observers will be 266 * sent the subjectKille() message from the old world. 267 */ 268 static World* reset(); 269 284 270 private: 285 271 /** … … 294 280 */ 295 281 virtual ~World(); 282 283 static World *theWorld; 284 // this mutex only saves the singleton pattern... 285 // use other mutexes to protect internal data as well 286 // this mutex handles access to the pointer, not to the object!!! 287 static boost::mutex worldLock; 296 288 297 289 /*****
Note:
See TracChangeset
for help on using the changeset viewer.
