diff --git a/cocos2dx/cocoa/NSAutoreleasePool.cpp b/cocos2dx/cocoa/NSAutoreleasePool.cpp index 1defc3291c..3f4b3c5287 100644 --- a/cocos2dx/cocoa/NSAutoreleasePool.cpp +++ b/cocos2dx/cocoa/NSAutoreleasePool.cpp @@ -20,3 +20,36 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ****************************************************************************/ +#include "NSAutoReleasePool.h" +using namespace std: + +NSAutoreleasePool::NSAutoreleasePool(void) +{ + m_managedObjectArray = vector(); +} + +void NSAutoreleasePool::addObject(NSObject *pObject) +{ + m_managedObjectArray.push_back(pObject); +} + +void NSAutoreleasePool::removeObject(NSObject *pObject) +{ + m_managedObjectArray.po +} + + +// implementiation of NSPoolManager +NSPoolManager* NSPoolManager::m_pPoolManager = NULL; + +NSPoolManager* NSPoolManager::getInstance(void) +{ + static BOOL bInit = FALSE; + + if (bInit == FLASE) + { + m_pPoolManager = new NSPoolManager(); + } + + return m_pPoolManager; +} diff --git a/cocos2dx/include/NSAutoreleasePool.h b/cocos2dx/include/NSAutoreleasePool.h deleted file mode 100644 index 3f4526ecc6..0000000000 --- a/cocos2dx/include/NSAutoreleasePool.h +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** -Copyright (c) 2010 cocos2d-x.org - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -****************************************************************************/ - -#ifndef __NS_AUTO_RELEASE_POOL_H__ -#define __NS_AUTO_RELEASE_POOL_H__ - -#include "NSObject.h" -#include - -class NSAutoreleasePool : public NSObject -{ -public: - 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__