1234567891011121314151617181920212223242526272829303132333435 |
- #ifndef __INDEXALLOC_H__
- #define __INDEXALLOC_H__
- #include "Lock.h"
- typedef struct _SIndex
- {
- int m_nIdx; // 索引
- BOOL m_bUsed; // 是否已使用
- _SIndex()
- {
- m_nIdx = -1;
- m_bUsed = FALSE;
- }
- }SINDEX, *LPINDEX;
- class CIndexAlloc
- {
- public:
- CIndexAlloc();
- ~CIndexAlloc();
- BOOL Initialize(IN CONST int dwMaxNum);
- int AllocIndex();
- void FreeIndex(IN CONST int dwIndex);
- int GetIndexNum(){return m_nIndexNum;}
- private:
- LPINDEX m_lpIndexs; //索引集
- int m_nIndexNum; //索引数量
- CLock m_lock;
- };
- #endif //__INDEXALLOC_H__
|