BioinstSim  2
 All Classes Functions Variables
simobject.h
1 /******************************************************************************
2 
3 This is the super-class for almost all simulator related classes. It
4 is quite simple. It simply contains a couple of public accessible
5 methods. Its main feature is that it uses recursive parent-child
6 relationships. This allows for events such as keypresses, a new
7 simulation cycle, and rendering to be done recursively.
8 
9 It also allows all objects to have distinct names - and invaluable
10 tool for debugging.
11 
12 *******************************************************************************/
13 
14 #ifndef SIMOBJECT_H_
15 #define SIMOBJECT_H_
16 
17 /******************************************************************************/
18 /******************************************************************************/
19 
20 #include "common.h"
21 
22 /******************************************************************************/
23 /******************************************************************************/
24 
25 class CSimObject;
26 class CRender;
27 
28 typedef vector<CSimObject*> TSimObjectVector;
29 typedef vector<CSimObject*>::iterator TSimObjectVectorIterator;
30 
31 
32 /******************************************************************************/
33 /******************************************************************************/
34 
35 class CSimObject
36 {
37 public:
38  CSimObject(const char* pch_name);
39  virtual ~CSimObject();
40  const char* GetName() const;
41 
42  virtual void Draw(CRender* pc_render);
43  virtual void SimulationStep(unsigned int un_step_number);
44  virtual void Keypressed(int keycode);
45 
46  virtual void AddChild(CSimObject* pc_child);
47  virtual void RemoveChild(CSimObject* pc_child);
48 
49  virtual void PrintfChildren(unsigned indent);
50 
51  virtual TSimObjectVector* GetChildren();
52 
53  static bool g_bShuffleChildren;
54 
55 protected:
56  char* m_pchName;
57  TSimObjectVector m_vecSimObjectChildren;
58 };
59 
60 /******************************************************************************/
61 /******************************************************************************/
62 
63 
64 #endif