MeVisLab Toolbox Reference
mlMemory.h
Go to the documentation of this file.
1/*************************************************************************************
2**
3** Copyright 2007, MeVis Medical Solutions AG
4**
5** The user may use this file in accordance with the license agreement provided with
6** the Software or, alternatively, in accordance with the terms contained in a
7** written agreement between the user and MeVis Medical Solutions AG.
8**
9** For further information use the contact form at https://www.mevislab.de/contact
10**
11**************************************************************************************/
12
13#ifndef ML_MEMORY_H
14#define ML_MEMORY_H
15
17
18// ML-includes
19#include "mlUtilsSystem.h"
20
21#include "mlUtilsAPI.h"
22
24
25 //----------------------------------------------------------------------
28 //----------------------------------------------------------------------
30 public:
32 struct Deleter
33 {
34 void operator()(void* p) const;
35 };
36
41 [[nodiscard]]
43
49 [[nodiscard]]
50 static void* reallocateMemory(void* ptr, MLuint numBytes, MLMemoryErrorHandling handleFailure);
51
55 static void freeMemory(void* ptr);
56
62 [[nodiscard]]
63 static void* duplicateMemory(const void* ptr, MLuint numBytes, MLMemoryErrorHandling handleFailure);
64
68 [[nodiscard]]
70 };
71
73
74#endif // __mlMemory_H
75
76
77
78
79
80
Basic memory management class for the ML.
Definition mlMemory.h:29
static void * duplicateMemory(const void *ptr, MLuint numBytes, MLMemoryErrorHandling handleFailure)
Copies the memory pointed to by ptr of size numBytes in a newly allocated buffer which must be freed ...
static void freeMemory(void *ptr)
Free function to be use instead of free if code is written which uses/bases on the ML.
static void * allocateMemory(MLuint numBytes, MLMemoryErrorHandling handleFailure)
Allocates a memory block of numByts.
static void * reallocateMemory(void *ptr, MLuint numBytes, MLMemoryErrorHandling handleFailure)
The memory block pointed to by ptr is resized and copied so that it has at least numBytes.
static char * duplicateString(const char *str, MLMemoryErrorHandling handleFailure)
Copies the passed null terminated string str in a newly allocated buffer which must be freed by the c...
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
MLMemoryErrorHandling
Enumerator to specify memory error handling.
Definition mlTypeDefs.h:676
MLuint64 MLuint
An unsigned ML integer type with at least 64 bits used for index calculations on very large images ev...
Definition mlTypeDefs.h:506
#define ML_UTILS_EXPORT
Defines platform dependent DLL export macro for mlUtils.
Definition mlUtilities.h:20
A custom delete which can be used in std::unique_ptr and std::shared_ptr.
Definition mlMemory.h:33
void operator()(void *p) const