Neo  0.5.0
Developer Documentation
DataManager.h
Go to the documentation of this file.
1 //========================================================================
2 // Copyright (c) 2003-2011 Anael Seghezzi <www.maratis3d.com>
3 //
4 // This software is provided 'as-is', without any express or implied
5 // warranty. In no event will the authors be held liable for any damages
6 // arising from the use of this software.
7 //
8 // Permission is granted to anyone to use this software for any purpose,
9 // including commercial applications, and to alter it and redistribute it
10 // freely, subject to the following restrictions:
11 //
12 // 1. The origin of this software must not be misrepresented; you must not
13 // claim that you wrote the original software. If you use this software
14 // in a product, an acknowledgment in the product documentation would
15 // be appreciated but is not required.
16 //
17 // 2. Altered source versions must be plainly marked as such, and must not
18 // be misrepresented as being the original software.
19 //
20 // 3. This notice may not be removed or altered from any source
21 // distribution.
22 //
23 //========================================================================
24 
25 
26 #ifndef __DATA_MANAGER_H
27 #define __DATA_MANAGER_H
28 
29 namespace Neo
30 {
31 // Data ref
32 class NEO_CORE_EXPORT DataRef
33 {
34 protected:
35 
36  long m_time;
38  unsigned int m_score;
39 
40 public:
41 
42  // constructor
43  DataRef(void);
44 
45  // clear / destroy
46  virtual void clear(void) = 0;
47  virtual void destroy(void) = 0;
48 
49 public:
50 
51  // score
52  void incrScore(void);
53  void decrScore(void);
54  inline unsigned int getScore(void){ return m_score; }
55 
56  // update
57  virtual void update(void) = 0;
58 
59  // type
60  virtual int getType(void) = 0;
61 
62  // time
63  inline void setTime(long time){ m_time = time; }
64  inline long getTime(void){ return m_time; }
65 
66  // filename
67  inline const char * getFilename(void){ return m_filename.getData(); }
68 };
69 
70 
71 // Data manager
72 class NEO_CORE_EXPORT DataManager
73 {
74 private:
75 
76  // refs
77  vector <DataRef *> m_refs;
78 
79 public:
80 
81  // destructor
82  virtual ~DataManager(void);
83 
84 public:
85 
86  // clear
87  virtual void clear(void);
88 
89  // refs
90  void addRef(DataRef * ref);
91  inline DataRef * getRef(unsigned int id){ return m_refs[id]; }
92  inline unsigned int getRefsNumber(void){ return m_refs.size(); }
93 };
94 }
95 #endif
Definition: DataManager.h:72
long m_time
Definition: DataManager.h:36
DataRef * getRef(unsigned int id)
Definition: DataManager.h:91
const char * getFilename(void)
Definition: DataManager.h:67
Implements a framework for string manipulation that operates directly on C strings.
Definition: NeoString.h:35
Definition: DataManager.h:32
const char * getData(void)
Returns the current internal string buffer. Attention: Might return NULL!
Definition: NeoString.h:74
long getTime(void)
Definition: DataManager.h:64
unsigned int getScore(void)
Definition: DataManager.h:54
unsigned int getRefsNumber(void)
Definition: DataManager.h:92
void setTime(long time)
Definition: DataManager.h:63
String m_filename
Definition: DataManager.h:37
Definition: Color.h:29
unsigned int m_score
Definition: DataManager.h:38