source: molecuilder/src/World.hpp@ d2d8f5

Last change on this file since d2d8f5 was d2d8f5, checked in by Tillmann Crueger <crueger@…>, 16 years ago

Made all atoms register themselves with the world upon creation

  • Property mode set to 100644
File size: 1.2 KB
Line 
1/*
2 * World.hpp
3 *
4 * Created on: Feb 3, 2010
5 * Author: crueger
6 */
7
8#ifndef WORLD_HPP_
9#define WORLD_HPP_
10
11#include <boost/thread.hpp>
12#include <map>
13
14#include "Patterns/Observer.hpp"
15#include "Patterns/Cacheable.hpp"
16
17// forward declarations
18class periodentafel;
19class MoleculeListClass;
20class atom;
21
22class World : public Observable
23{
24public:
25
26 /***** getter and setter *****/
27 periodentafel* getPeriode();
28private:
29 periodentafel *periode;
30 std::map<int,atom*> atoms;
31
32
33 /***** singleton Stuff *****/
34public:
35 static World* get();
36 static void destroy();
37 static World* reset();
38
39private:
40 World();
41 virtual ~World();
42
43 static World *theWorld;
44 // this mutex only saves the singleton pattern...
45 // use other mutexes to protect internal data as well
46 // this mutex handles access to the pointer, not to the object!!!
47 static boost::mutex worldLock;
48
49 /*****
50 * some legacy stuff that is include for now but will be removed later
51 *****/
52public:
53 MoleculeListClass *getMolecules();
54
55 // functions used for the WorldContent template mechanism
56 void registerAtom(atom *theAtom);
57 void unregisterAtom(atom *theAtom);
58private:
59 MoleculeListClass *molecules;
60};
61
62#endif /* WORLD_HPP_ */
Note: See TracBrowser for help on using the repository browser.