00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef TA_SIMPLEPOOL_H
00013 #define TA_SIMPLEPOOL_H
00014
00015 namespace TA
00016 {
00017
00018
00019 template <class Type>
00020 class SimplePool
00021 {
00022 public:
00023 SimplePool();
00024 ~SimplePool();
00025
00026 void Initialise(int nSize);
00027 void Finalise();
00028
00029 Type* Alloc();
00030 void Free(Type* pData);
00031
00032 private:
00033 struct Item
00034 {
00035 Type data;
00036 };
00037
00038 Item* m_pData;
00039 int m_nSize;
00040 int m_nFreeCount;
00041 Item* m_pFreeList;
00042
00043 Item*& ItemToNextPtr(Item& item) { return (Item*&)item; }
00044 };
00045
00046 }
00047
00048 #include "SimplePool.inl"
00049
00050 #endif // TA_SIMPLEPOOL_H
© Copyright 2004-2006 TRUE AXIS PTY LTD Australia. All rights reserved.