nux-0.9.48

NuxCore/Memory.h File Reference

Go to the source code of this file.

Namespaces

namespace  nux

Defines

#define NUX_DEFAULT_ALIGNMENT   4
#define NUX_SAFE_DELETE(mem)
#define NUX_SAFE_DELETE_ARRAY(mem_array)
#define NUX_SAFE_FREE(mem)
#define NUX_MEMOP_ALLOC   1
 Memory operation defines.
#define NUX_MEMOP_NEW   2
#define NUX_MEMOP_NEWARRAY   3
#define NUX_MEMOP_FREE   4
#define NUX_MEMOP_DELETE   5
#define NUX_MEMOP_DELETEARRAY   6
#define NUX_NEW_EXPLICIT(Allocator, ClassName, Comment, ParentPtr, File, Line, FunctionName)
#define NUX_NEW(Allocator, ClassName, Comment, ParentPtr)   NUX_NEW_EXPLICIT(Allocator, ClassName, Comment, ParentPtr, __FILE__, __LINE__, __FUNCTION__)
#define inlNew(ClassName, Comment, ParentPtr)   NUX_NEW(GetDefaultMemoryAllocator(), ClassName, Comment, ParentPtr)
#define NUX_DELETE_EXPLICIT(ptrObject, File, Line, FunctionName)
#define NUX_DELETE(ptrObject)   NUX_DELETE_EXPLICIT(ptrObject, __FILE__, __LINE__, __FUNCTION__)
#define inlDelete(ptrObject)   NUX_DELETE(ptrObject)
#define NUX_ALLOC_EXPLICIT(Allocator, ObjectType, Count, Comment, ParentPtr, File, Line, FunctionName)
#define NUX_ALLOC(Allocator, ObjectType, Count, Comment, ParentPtr, File, Line, FunctionName)   NUX_ALLOC_EXPLICIT(Allocator, ObjectType, Count, Comment, ParentPtr, File, Line, FunctionName)
#define inlMMAlloc(Allocator, ObjectType, Count, Comment, ParentPtr)   NUX_ALLOC(Allocator, ObjectType, Count, Comment, ParentPtr, __FILE__, __LINE__, __FUNCTION__)
#define NUX_FREE_EXPLICIT(Allocator, Ptr, File, Line)
#define NUX_FREE(Allocator, Ptr)   NUX_FREE_EXPLICIT(Allocator, Ptr, __FILE__, __LINE__)
#define inlMMFree(Allocator, Ptr)   NUX_FREE(Allocator, Ptr)

Functions

t_u32 nux::Memcmp (const void *Buf1, const void *Buf2, t_u32 Count)
bool nux::MemIsZero (const void *V, t_size Count)
void * nux::Memmove (void *Dest, const void *Src, t_size Count)
void nux::Memset (void *Dest, t_s32 C, t_size Count)
void nux::Memzero (void *Dest, t_size Count)
void nux::Memcpy (void *Dest, const void *Src, t_size Count)
void nux::Memswap (void *Ptr1, void *Ptr2, t_size Size)
bool nux::IsMemoryAligned (void *data, t_u32 alignment)
 Check that the alignment is a power of two.
void * nux::Malloc (t_size Count, t_u32 Alignment=NUX_DEFAULT_ALIGNMENT)
void * nux::Realloc (void *Original, t_size Count, t_u32 Alignment=NUX_DEFAULT_ALIGNMENT)
void inlFree (void *Original)

Define Documentation

#define inlDelete (   ptrObject)    NUX_DELETE(ptrObject)
#define inlMMAlloc (   Allocator,
  ObjectType,
  Count,
  Comment,
  ParentPtr 
)    NUX_ALLOC(Allocator, ObjectType, Count, Comment, ParentPtr, __FILE__, __LINE__, __FUNCTION__)
#define inlMMFree (   Allocator,
  Ptr 
)    NUX_FREE(Allocator, Ptr)
#define inlNew (   ClassName,
  Comment,
  ParentPtr 
)    NUX_NEW(GetDefaultMemoryAllocator(), ClassName, Comment, ParentPtr)
#define NUX_ALLOC (   Allocator,
  ObjectType,
  Count,
  Comment,
  ParentPtr,
  File,
  Line,
  FunctionName 
)    NUX_ALLOC_EXPLICIT(Allocator, ObjectType, Count, Comment, ParentPtr, File, Line, FunctionName)
#define NUX_ALLOC_EXPLICIT (   Allocator,
  ObjectType,
  Count,
  Comment,
  ParentPtr,
  File,
  Line,
  FunctionName 
)
Value:
Memory::MemHelperAlloc< ObjectType >(NUX_MEMOP_ALLOC,                                              \
                                              Count,                                                            \
                                              Allocator,                                                        \
                                              ParentPtr,                                                        \
                                              Comment,                                                          \
                                              #ObjectType,                                                      \
                                              File,                                                             \
                                              Line,                                                             \
                                              FunctionName)
#define NUX_DEFAULT_ALIGNMENT   4
#define NUX_DELETE (   ptrObject)    NUX_DELETE_EXPLICIT(ptrObject, __FILE__, __LINE__, __FUNCTION__)
#define NUX_DELETE_EXPLICIT (   ptrObject,
  File,
  Line,
  FunctionName 
)
Value:
Memory::MemHelperDelete(NUX_MEMOP_DELETE, (ptrObject),                 \
                          File,                                                     \
                          Line,                                                     \
                          FunctionName);
#define NUX_FREE (   Allocator,
  Ptr 
)    NUX_FREE_EXPLICIT(Allocator, Ptr, __FILE__, __LINE__)
#define NUX_FREE_EXPLICIT (   Allocator,
  Ptr,
  File,
  Line 
)
Value:
Memory::MemHelperFastDelete( NUX_MEMOP_FREE,       \
                            Allocator,                          \
                            Ptr,                                \
                            File,                               \
                            Line);
#define NUX_MEMOP_ALLOC   1

Memory operation defines.

#define NUX_MEMOP_DELETE   5
#define NUX_MEMOP_DELETEARRAY   6
#define NUX_MEMOP_FREE   4
#define NUX_MEMOP_NEW   2
#define NUX_MEMOP_NEWARRAY   3
#define NUX_NEW (   Allocator,
  ClassName,
  Comment,
  ParentPtr 
)    NUX_NEW_EXPLICIT(Allocator, ClassName, Comment, ParentPtr, __FILE__, __LINE__, __FUNCTION__)
#define NUX_NEW_EXPLICIT (   Allocator,
  ClassName,
  Comment,
  ParentPtr,
  File,
  Line,
  FunctionName 
)
Value:
new(Memory::MemHelperAlloc< ClassName >(NUX_MEMOP_NEW,                 \
                    1,                                                              \
                    Allocator,                                                      \
                    ParentPtr,                                                      \
                    Comment,                                                        \
                    #ClassName,                                                     \
                    File,                                                           \
                    Line,                                                           \
                    FunctionName)) ClassName
#define NUX_SAFE_DELETE (   mem)
Value:
if(mem)             \
                                {                   \
                                    INLDELETE (mem);   \
                                    (mem) = 0;      \
                                }

Referenced by nux::TableItem::SetItemTextColor().

#define NUX_SAFE_DELETE_ARRAY (   mem_array)
Value:
if(mem_array)               \
                                            {                           \
                                                INLDELETEARRAY (mem_array);  \
                                                (mem_array) = 0;        \
                                            }
#define NUX_SAFE_FREE (   mem)
Value:
if(mem)             \
{                   \
    std::free(mem);      \
    (mem) = 0;      \
}

Function Documentation

void inlFree ( void *  Original) [inline]