aboutsummaryrefslogtreecommitdiff
path: root/src/framework/Policies/CreationPolicy.h
diff options
context:
space:
mode:
authormaximius <none@none>2009-10-17 15:51:44 -0700
committermaximius <none@none>2009-10-17 15:51:44 -0700
commite585187b248f48b3c6e9247b49fa07c6565d65e5 (patch)
tree637c5b7ddacf41040bef4ea4f75a97da64c6a9bc /src/framework/Policies/CreationPolicy.h
parent26b5e033ffde3d161382fc9addbfa99738379641 (diff)
*Backed out changeset 3be01fb200a5
--HG-- branch : trunk
Diffstat (limited to 'src/framework/Policies/CreationPolicy.h')
-rw-r--r--src/framework/Policies/CreationPolicy.h9
1 files changed, 9 insertions, 0 deletions
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 <stdlib.h>
#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);