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
23ML_UTILS_START_NAMESPACE
24
25 //----------------------------------------------------------------------
28 //----------------------------------------------------------------------
30 public:
32 struct Deleter
33 {
34 void operator()(void* p) const;
35 };
36
41 [[nodiscard]]
42 static void* allocateMemory(MLuint numBytes, MLMemoryErrorHandling handleFailure);
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]]
69 static char* duplicateString(const char *str, MLMemoryErrorHandling handleFailure);
70 };
71
72ML_UTILS_END_NAMESPACE
73
74#endif // __mlMemory_H
75
76
77
78
79
80
static void * duplicateMemory(const void *ptr, MLuint numBytes, MLMemoryErrorHandling handleFailure)
static void freeMemory(void *ptr)
static void * allocateMemory(MLuint numBytes, MLMemoryErrorHandling handleFailure)
static void * reallocateMemory(void *ptr, MLuint numBytes, MLMemoryErrorHandling handleFailure)
static char * duplicateString(const char *str, MLMemoryErrorHandling handleFailure)
MLMemoryErrorHandling
Enumerator to specify memory error handling.
Definition mlTypeDefs.h:675
MLuint64 MLuint
Definition mlTypeDefs.h:505
#define ML_UTILS_EXPORT
Definition mlUtilities.h:18
A custom delete that can be used in std::unique_ptr and std::shared_ptr.
Definition mlMemory.h:33
void operator()(void *p) const