PageRenderTime 26ms CodeModel.GetById 12ms app.highlight 9ms RepoModel.GetById 2ms app.codeStats 0ms

/TGame/TData/Manager/DataManagerImp.h

http://awoe.googlecode.com/
C++ Header | 72 lines | 31 code | 19 blank | 22 comment | 0 complexity | 1aab3243cb0bb64ace198ed3e25ca063 MD5 | raw file
 1#ifndef __DATA_TABLE_IMP__
 2#define __DATA_TABLE_IMP__
 3
 4#include "DataManagerIf.h"
 5#include <hash_map>
 6
 7//
 8//	Data Manager that use id only
 9//
10class TDATA_API  DataManagerImp : public IDataManager
11{
12public:
13	DataManagerImp();
14	virtual ~DataManagerImp();
15
16
17	//	
18	//	IData
19	//
20	virtual bool		set(IData* pData) ;
21	virtual IData*		get(const int& nID, const int& nGrpID )const;
22
23
24	//
25	//	Table Size
26	//
27	virtual int			size()const ;
28
29	//
30	//	Iterator
31	virtual bool forEach(IDataVisitor& v);
32private:
33	typedef	stdext::hash_map<int, IData*>	DataMap;
34
35	DataMap		m_theDataM;
36};
37
38
39
40//
41//	Data Manger the use both group id and id
42//
43class TDATA_API  DataManagerImpG : public IDataManager
44{
45public:
46	DataManagerImpG();
47	virtual ~DataManagerImpG();
48
49
50	//	
51	//	IData
52	//
53	virtual bool		set(IData* pData) ;
54	virtual IData*		get(const int& nID, const int& nGrpID )const;
55
56
57	//
58	//	Table Size
59	//
60	virtual int			size()const ;
61
62	//
63	//	Iterator
64	virtual bool forEach(IDataVisitor& v);
65private:
66	typedef	stdext::hash_map<__int64, IData*>	DataMap;
67
68	DataMap		m_theDataM;
69};
70
71#endif
72