From e3ed31701f2bc9c9827be12e8e3fa68bc9a3207b Mon Sep 17 00:00:00 2001 From: Ming Date: Tue, 6 Jul 2010 12:18:40 +0000 Subject: [PATCH] issue #6 --- cocos2dx/include/NSAutoreleasePool.h | 36 ++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/cocos2dx/include/NSAutoreleasePool.h b/cocos2dx/include/NSAutoreleasePool.h index 1a7562fe1b..3f4526ecc6 100644 --- a/cocos2dx/include/NSAutoreleasePool.h +++ b/cocos2dx/include/NSAutoreleasePool.h @@ -23,11 +23,43 @@ THE SOFTWARE. #ifndef __NS_AUTO_RELEASE_POOL_H__ #define __NS_AUTO_RELEASE_POOL_H__ -class NSAutoreleasePool +#include "NSObject.h" +#include + +class NSAutoreleasePool : public NSObject { public: NSAutoreleasePool(void); - ~NSAutoreleasePool(void); + + void addObject(NSObject *pObject); + void removeObject(NSObject *pObject); + + void clear(void); +private: + std::vector m_managedObjectArray; }; +class NSPoolManager +{ +public: + + ~NSPoolManager(); + + void finalize(void); + void push(void); + void pop(void); + + void removeObject(NSObject *pObject); + void addObject(NSObject *pObject); + +public: + static NSPoolManager* getInstance(); + +private: + NSPoolManager(); + +private: + static NSPoolManager *m_pPoolManager; +} + #endif //__NS_AUTO_RELEASE_POOL_H__