DART 6.13.2
|
#include <MemoryAllocatorDebugger.hpp>
Public Member Functions | |
template<typename... Args> | |
MemoryAllocatorDebugger (Args &&... args) | |
Constructor. | |
~MemoryAllocatorDebugger () | |
Destructor. | |
const std::string & | getType () const override |
Returns type string. | |
void * | allocate (size_t bytes) noexcept override |
Allocates size bytes of uninitialized storage. | |
void | deallocate (void *pointer, size_t bytes) override |
Deallocates the storage referenced by the pointer p , which must be a pointer obtained by an earlier cal to allocate(). | |
bool | isEmpty () const |
Returns true if there is no memory allocated by the internal allocator. | |
bool | hasAllocated (void *pointer, size_t size) const |
Returns true if a pointer is allocated by the internal allocator. | |
const T & | getInternalAllocator () const |
Returns the internal allocator. | |
T & | getInternalAllocator () |
Returns the internal allocator. | |
void | print (std::ostream &os=std::cout, int indent=0) const override |
Prints state of the memory allocator. | |
template<typename T > | |
T * | allocateAs (size_t n=1) noexcept |
Allocates object(s) without calling the constructor. | |
template<typename T , typename... Args> | |
T * | construct (Args &&... args) noexcept |
Allocates uninitialized storage and constructs an object of type T to the allocated storage. | |
template<typename T , typename... Args> | |
T * | constructAt (void *pointer, Args &&... args) |
template<typename T , typename... Args> | |
T * | constructAt (T *pointer, Args &&... args) |
template<typename T > | |
void | destroy (T *object) noexcept |
Calls the destructor of the object and deallocate the storage. | |
bool | is () const |
Returns true if the types of this Base and the template parameter (a base class) are identical. | |
const Derived * | as () const |
Casts to pointer of Derived if Base is its base class. | |
Derived * | as () |
Casts to pointer of Derived if Base is its base class. | |
const Derived & | asRef () const |
Casts to reference of Derived if Base is its base class. UB otherwise. | |
Derived & | asRef () |
Casts to reference of Derived if Base is its base class. UB otherwise. | |
Static Public Member Functions | |
static const std::string & | getStaticType () |
Returns type string. | |
static MemoryAllocator & | GetDefault () |
Returns the default memory allocator. | |
Private Member Functions | |
const MemoryAllocator & | base () const |
Casts to Base const-reference. | |
MemoryAllocator & | base () |
Casts to Base reference. | |
Private Attributes | |
T | mInternalAllocator |
size_t | mSize = 0 |
size_t | mPeak = 0 |
std::unordered_map< void *, size_t > | mMapPointerToSize |
std::mutex | mMutex |
dart::common::MemoryAllocatorDebugger< T >::MemoryAllocatorDebugger | ( | Args &&... | args | ) |
Constructor.
dart::common::MemoryAllocatorDebugger< T >::~MemoryAllocatorDebugger | ( | ) |
Destructor.
|
overridevirtualnoexcept |
Allocates size
bytes of uninitialized storage.
[in] | bytes | The byte size to allocate sotrage for. |
Implements dart::common::MemoryAllocator.
|
noexceptinherited |
Allocates object(s) without calling the constructor.
This is identical to static_cast<T*>
(allocate(n * sizeof(T))).
[in] | n | The number of objects to allocate. |
|
inherited |
Casts to pointer of Derived if Base is its base class.
Returns nullptr otherwise.
|
inherited |
Casts to pointer of Derived if Base is its base class.
Returns nullptr otherwise.
|
inherited |
Casts to reference of Derived if Base is its base class. UB otherwise.
|
inherited |
Casts to reference of Derived if Base is its base class. UB otherwise.
|
privateinherited |
Casts to Base reference.
|
privateinherited |
Casts to Base const-reference.
|
noexceptinherited |
Allocates uninitialized storage and constructs an object of type T to the allocated storage.
T | The object type to construct. |
Args... | The argument types to pass to the object constructor. |
[in] | args | The constructor arguments to use. |
|
inherited |
|
inherited |
|
overridevirtual |
Deallocates the storage referenced by the pointer p
, which must be a pointer obtained by an earlier cal to allocate().
[in] | pointer | Pointer obtained from allocate(). |
[in] | bytes | The bytes of the allocated memory. |
Implements dart::common::MemoryAllocator.
|
noexceptinherited |
Calls the destructor of the object and deallocate the storage.
|
staticinherited |
Returns the default memory allocator.
T & dart::common::MemoryAllocatorDebugger< T >::getInternalAllocator | ( | ) |
Returns the internal allocator.
const T & dart::common::MemoryAllocatorDebugger< T >::getInternalAllocator | ( | ) | const |
Returns the internal allocator.
|
static |
Returns type string.
|
overridevirtual |
Returns type string.
Implements dart::common::MemoryAllocator.
bool dart::common::MemoryAllocatorDebugger< T >::hasAllocated | ( | void * | pointer, |
size_t | size | ||
) | const |
Returns true if a pointer is allocated by the internal allocator.
|
inherited |
Returns true if the types of this Base
and the template parameter (a base class) are identical.
This function is a syntactic sugar, which is identical to: (getType() == ShapeType::getStaticType()).
Example code:
bool dart::common::MemoryAllocatorDebugger< T >::isEmpty | ( | ) | const |
Returns true if there is no memory allocated by the internal allocator.
|
overridevirtual |
Prints state of the memory allocator.
Reimplemented from dart::common::MemoryAllocator.
|
private |
|
private |
|
mutableprivate |
|
private |
|
private |