CFx SDK Documentation  2022 SP0
Macros
OdHeap.h File Reference
#include "OdAlloc.h"
#include <new>

Go to the source code of this file.

Macros

#define ODRX_HEAP_OPERATORS()
 
#define ODRX_NO_HEAP_OPERATORS()
 
#define ODRX_USING_HEAP_OPERATORS(T)
 

Macro Definition Documentation

◆ ODRX_HEAP_OPERATORS

#define ODRX_HEAP_OPERATORS ( )
Value:
void* operator new(size_t s) throw(std::bad_alloc)\
{\
void* p = ::odrxAlloc(s);\
if ( !p ) throw std::bad_alloc();\
return p;\
}\
void operator delete(void* p) { ::odrxFree(p); }\
void* operator new[](size_t s) throw(std::bad_alloc)\
{\
void* p = ::odrxAlloc(s);\
if ( !p ) throw std::bad_alloc();\
return p;\
}\
void operator delete[](void* p) { ::odrxFree(p); }\
void *operator new(size_t, void* p) throw() { return p; }\
void operator delete( void*, void* ) {}\
void *operator new[](size_t, void* p) throw() { return p; }\
void operator delete[]( void*, void* ) {}
ALLOCDLL_EXPORT void * odrxAlloc(size_t nBytes)
ALLOCDLL_EXPORT void odrxFree(void *pMemBlock)

Defines the new and delete operators for a class derived from the OdRxObject class.

Definition at line 74 of file OdHeap.h.

◆ ODRX_NO_HEAP_OPERATORS

#define ODRX_NO_HEAP_OPERATORS ( )
Value:
void* operator new(size_t ) throw() { ODA_FAIL(); return 0; }\
void operator delete(void* ) { ODA_FAIL(); throw OdError(eNotApplicable); }\
void* operator new[](size_t ) throw() { ODA_FAIL(); return 0; }\
void operator delete[](void* ) { ODA_FAIL(); throw OdError(eNotApplicable); }
#define ODA_FAIL()
Definition: DebugStuff.h:65

Defines the new and delete operators that generate the exception.

Definition at line 101 of file OdHeap.h.

◆ ODRX_USING_HEAP_OPERATORS

#define ODRX_USING_HEAP_OPERATORS (   T)
Value:
using T::operator new;\
using T::operator delete;\
using T::operator new[];\
using T::operator delete[]

Defines the new and delete operators that use the new and delete operators of a base class.

Definition at line 138 of file OdHeap.h.