From e585187b248f48b3c6e9247b49fa07c6565d65e5 Mon Sep 17 00:00:00 2001 From: maximius Date: Sat, 17 Oct 2009 15:51:44 -0700 Subject: *Backed out changeset 3be01fb200a5 --HG-- branch : trunk --- src/framework/Policies/CreationPolicy.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/framework/Policies/CreationPolicy.h') diff --git a/src/framework/Policies/CreationPolicy.h b/src/framework/Policies/CreationPolicy.h index 9bca121b632..91bec9eab37 100644 --- a/src/framework/Policies/CreationPolicy.h +++ b/src/framework/Policies/CreationPolicy.h @@ -17,10 +17,13 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + #ifndef TRINITY_CREATIONPOLICY_H #define TRINITY_CREATIONPOLICY_H + #include #include "Platform/Define.h" + namespace Trinity { /** @@ -33,6 +36,7 @@ namespace Trinity static T* Create(void) { return (new T); } static void Destroy(T *obj) { delete obj; } }; + /** * LocalStaticCreation policy creates an object on the stack * the first time call Create. @@ -59,8 +63,10 @@ namespace Trinity static MaxAlign si_localStatic; return new(&si_localStatic) T; } + static void Destroy(T *obj) { obj->~T(); } }; + /** * CreateUsingMalloc by pass the memory manger. */ @@ -74,12 +80,14 @@ namespace Trinity if (!p) return 0; return new(p) T; } + static void Destroy(T* p) { p->~T(); ::free(p); } }; + /** * CreateOnCallBack creates the object base on the call back. */ @@ -91,6 +99,7 @@ namespace Trinity { return CALL_BACK::createCallBack(); } + static void Destroy(T *p) { CALL_BACK::destroyCallBack(p); -- cgit v1.2.3