|
Open Graph Drawing Framework |
v. 2023.09 (Elderberry)
|
|
|
Go to the documentation of this file.
53 #define OGDF_MM(Alloc) \
55 static void* operator new(size_t nBytes) { \
56 if (OGDF_LIKELY(Alloc::checkSize(nBytes))) \
57 return Alloc::allocate(nBytes); \
59 return ogdf::MallocMemoryAllocator::allocate(nBytes); \
62 static void operator delete(void* p, size_t nBytes) { \
63 if (OGDF_LIKELY(p != 0)) { \
64 if (OGDF_LIKELY(Alloc::checkSize(nBytes))) \
65 Alloc::deallocate(nBytes, p); \
67 ogdf::MallocMemoryAllocator::deallocate(nBytes, p); \
70 static void* operator new(size_t, void* p) { return p; } \
71 static void operator delete(void*, void*) { }
73 #ifdef OGDF_MEMORY_MALLOC_TS
74 # define OGDF_ALLOCATOR ogdf::MallocMemoryAllocator
76 # define OGDF_ALLOCATOR ogdf::PoolMemoryAllocator
85 #define OGDF_NEW_DELETE OGDF_MM(OGDF_ALLOCATOR)
92 #define OGDF_MALLOC_NEW_DELETE OGDF_MM(ogdf::MallocMemoryAllocator)
118 const size_t s = n *
sizeof(T);
120 return static_cast<T*
>(OGDF_ALLOCATOR::allocate(s));
128 const size_t s = n *
sizeof(T);
130 OGDF_ALLOCATOR::deallocate(s, p);
The namespace for all OGDF objects.
T * allocate(const size_t n) const
Encapsulates OGDF_ALLOCATOR in a class that can be used as the Allocator for containers of the C++ st...
#define OGDF_LIKELY(x)
Specify the likely branch in a condition.
void deallocate(T *const p, size_t n) const noexcept
bool operator==(const OGDFAllocator< U > &) const noexcept
static void deallocate(size_t, void *p)
Deallocates memory at address p. We do not keep track of the size of the deallocated object.
static void * allocate(size_t nBytes, const char *, int)
Allocates memory of size nBytes.
OGDFAllocator() noexcept=default
Declaration of memory manager for allocating small pieces of memory.
bool operator!=(const OGDFAllocator< U > &) const noexcept
Basic declarations, included by all source files.
Declaration of memory manager for allocating small pieces of memory.