gwnavruntime/base/memory.h File Reference
|
| Kaim |
| The Autodesk Navigation namespace.
|
|
|
#define | KY_DEFINE_NEW_DELETE_OPERATORS(MemStat) |
| This macro defines new and delete operators. More...
|
|
#define | KY_REFCOUNT_MALLOC_FREE(ClassName) |
| Specific to RefCounting, no inheritance involved, used to make RefCount-able classes compatible with Kaim::Ptr whose instances are created via placement new in their own preallocated buffer. More...
|
|
#define KY_DEFINE_NEW_DELETE_OPERATORS |
( |
|
MemStat | ) |
|
Value:public: \
KY_MEMORY_REDEFINE_NEW(NavigationClass, MemStat) \
KY_MEMORY_DEFINE_PLACEMENT_NEW \
private: \
This macro defines new and delete operators.
For internal use in the declarations of classes that do not derive from NewOverrideBase.
#define KY_REFCOUNT_MALLOC_FREE |
( |
|
ClassName | ) |
|
Value:public: \
KY_INLINE void AddRef() { RefCount ++; } \
KY_INLINE void Release() \
{ \
if ((RefCount.fetch_add(-1) - 1) == 0) \
KY_FREE(this); \
} \
int GetRefCount() const { return RefCount; } \
private: \
ClassName(); \
static KY_INLINE ClassName* Create(char* memoryStart) \
{ \
ClassName* instance = (::new((ClassName*)memoryStart) ClassName()); \
if (instance) { instance->RefCount = 1; } \
return instance; \
} \
private: \
mutable std::atomic<int> RefCount;
Specific to RefCounting, no inheritance involved, used to make RefCount-able classes compatible with Kaim::Ptr whose instances are created via placement new in their own preallocated buffer.
Go to the source code of this file.