Subversion Repositories WoWGM

Rev

Rev 5 | Rev 32 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5 Rev 31
Line 2... Line 2...
2
#define  _CDATASTORE_H_
2
#define  _CDATASTORE_H_
3
 
3
 
4
 
4
 
5
/****************************************************************************
5
/****************************************************************************
6
*
6
*
7
*	CDataStore class
7
*	  CDataStore class
8
*
8
*
9
***/
9
***/
10
 
10
 
11
class CDataStore {
11
class CDataStore {
12
 
12
 
13
	private:
13
	private:
14
 
14
 
15
		//=======================================================================
15
		//=======================================================================
16
		virtual void vfptr() {};	// To create the VTable
16
		virtual void vfptr() {};  // To create the VTable
17
		char*        m_data;		// Buffer
17
		char*        m_data;      // Buffer
18
		unsigned int m_base;		// Buffer index base
18
		unsigned int m_base;      // Buffer index base
19
		unsigned int m_alloc;		// Number of memory-allocated buffer bytes
19
		unsigned int m_alloc;     // Number of memory-allocated buffer bytes
20
		unsigned int m_size;		// Size of buffer
20
		unsigned int m_size;      // Size of buffer
21
		unsigned int m_read;		// Read bytes
21
		unsigned int m_read;      // Read bytes
22
 
22
 
23
		//=======================================================================
23
		//=======================================================================
24
		void Initialize(CDataStore *pData);
24
		void Initialize (CDataStore *pData);
25
 
25
 
26
		//=======================================================================
26
		//=======================================================================
27
		void Destroy(CDataStore *pData);
27
		void Destroy (CDataStore *pData);
28
 
28
 
29
		
29
		
30
	public:
30
	public:
31
 
31
 
32
		//=======================================================================
32
		//=======================================================================
Line 34... Line 34...
34
 
34
 
35
		//=======================================================================
35
		//=======================================================================
36
		~CDataStore ();
36
		~CDataStore ();
37
 
37
 
38
		//=======================================================================
38
		//=======================================================================
39
		inline bool IsRead ()
39
		inline bool IsRead () {
40
		{
-
 
41
			// Return TRUE if the data was read in its entirety
40
			// Return true if the data was read in its entirety
42
			return m_size==m_read;
41
			return m_size==m_read;
43
		}
42
		}
44
 
43
 
45
		//=======================================================================
44
		//=======================================================================
46
		inline bool IsFinal ()
45
		inline bool IsFinal () {
47
		{
-
 
48
			// Return TRUE if the data is finalized and ready for sending
46
			// Return true if the data is finalized and ready for sending
49
			return m_read!=-1;
47
			return m_read!=-1;
50
		}
48
		}
51
 
49
 
52
		//=======================================================================
50
		//=======================================================================
53
		CDataStore* Reset ();
51
		CDataStore* Reset ();
54
 
52
 
55
		//=======================================================================
53
		//=======================================================================
56
		inline void Finalize ()
54
		inline void Finalize () { m_read = 0; }
57
		{
-
 
58
			m_read = 0;
-
 
59
		}
-
 
60
 
55
 
61
		//=======================================================================
56
		//=======================================================================
62
		CDataStore& Set (DWORD pos, CHAR bytes);
57
		CDataStore& Set (DWORD pos, CHAR bytes);
63
 
58
 
64
		//=======================================================================
59
		//=======================================================================
Line 198... Line 193...
198
 
193
 
199
		//=======================================================================
194
		//=======================================================================
200
		CDataStore& GetArray (float* pval, DWORD count);
195
		CDataStore& GetArray (float* pval, DWORD count);
201
 
196
 
202
		//=======================================================================
197
		//=======================================================================
203
		virtual void GetBufferParams (LPCVOID*	dataPtr,
198
		virtual void GetBufferParams (LPCVOID*  dataPtr,
204
									  UINT*		sizePtr,
199
                                  UINT*     sizePtr,
205
									  UINT*		allocPtr) const;
200
                                  UINT*     allocPtr) const;
206
 
201
 
207
		//=======================================================================
202
		//=======================================================================
208
		void DetachBuffer (PVOID* dataPtr, UINT* sizePtr, UINT* allocPtr);
203
		void DetachBuffer (PVOID* dataPtr, UINT* sizePtr, UINT* allocPtr);
209
 
204
 
210
};
205
};