Contains classes that implement memory allocation and deallocation.
More...
|
template<class T , class U > |
SharedPtr< T > | staticPointerCast (const SharedPtr< U > &r) |
|
template<class T , class U > |
SharedPtr< T > | reinterpretPointerCast (const SharedPtr< U > &r) |
|
template<class T , class U > |
SharedPtr< T > | dynamicPointerCast (const SharedPtr< U > &r) |
|
template<class U > |
| SharedPtr (const SharedPtr< U > &other) |
|
template<class U > |
| SharedPtr (const SharedPtr< U > &r, T *ptr, T *shiftedPtr) |
|
void | _remove () |
|
SharedPtr< T > & | operator= (const SharedPtr< T > &ptr) |
|
template<class U > |
void | reset (U *ptr) |
|
template<class U , class D > |
void | reset (U *ptr, const D &deleter) |
|
DAAL_EXPORT void * | daal_malloc (size_t size, size_t alignment=DAAL_MALLOC_DEFAULT_ALIGNMENT) |
|
DAAL_EXPORT void | daal_free (void *ptr) |
|
DAAL_EXPORT void | daal_memcpy_s (void *dest, size_t numberOfElements, const void *src, size_t count) |
|
◆ _remove()
Decreases the reference count If the reference count becomes equal to zero, deletes the owned pointer
◆ daal_free()
DAAL_EXPORT void daal::services::daal_free |
( |
void * |
ptr | ) |
|
Deallocates the space previously allocated by daal_malloc
- Parameters
-
[in] | ptr | Pointer to the beginning of a block of memory to deallocate |
◆ daal_malloc()
DAAL_EXPORT void* daal::services::daal_malloc |
( |
size_t |
size, |
|
|
size_t |
alignment = DAAL_MALLOC_DEFAULT_ALIGNMENT |
|
) |
| |
Allocates an aligned block of memory
- Parameters
-
[in] | size | Size of the block of memory in bytes |
[in] | alignment | Alignment constraint. Must be a power of two |
- Returns
- Pointer to the beginning of a newly allocated block of memory
◆ daal_memcpy_s()
DAAL_EXPORT void daal::services::daal_memcpy_s |
( |
void * |
dest, |
|
|
size_t |
numberOfElements, |
|
|
const void * |
src, |
|
|
size_t |
count |
|
) |
| |
Copies bytes between buffers
- Parameters
-
[out] | dest | Pointer to new buffer |
[in] | numberOfElements | Size of new buffer |
[in] | src | Pointer to source buffer |
[in] | count | Number of bytes to copy. |
◆ dynamicPointerCast()
Creates a new instance of SharedPtr whose managed object type is obtained from the type of the managed object of r using a cast expression. Both shared pointers share ownership of the managed object. The managed object of the resulting SharedPtr is obtained by calling dynamic_cast<T*>(r.get()).
◆ operator=()
Makes a copy of an input shared pointer and increments the reference count
- Parameters
-
[in] | ptr | Shared pointer to copy |
◆ reinterpretPointerCast()
SharedPtr<T> daal::services::interface1::reinterpretPointerCast |
( |
const SharedPtr< U > & |
r | ) |
|
Creates a new instance of SharedPtr whose managed object type is obtained from the type of the managed object of r using a cast expression. Both shared pointers share ownership of the managed object. The managed object of the resulting SharedPtr is obtained by calling reinterpret_cast<T*>(r.get()).
◆ reset() [1/2]
Releases managed pointer, takes an ownership of ptr with default deleter
- Template Parameters
-
U | Class of the managed object |
- Parameters
-
[in] | ptr | Pointer to the managed object |
◆ reset() [2/2]
void reset |
( |
U * |
ptr, |
|
|
const D & |
deleter |
|
) |
| |
Releases managed pointer, takes an ownership of ptr with deleter D
- Template Parameters
-
U | Class of the managed object |
D | Class of the deleter object |
- Parameters
-
[in] | ptr | Pointer to the managed object |
[in] | deleter | Object used to delete the pointer when the reference count becomes equal to zero |
◆ SharedPtr() [1/2]
Constructs a shared pointer from another shared pointer of the same type
- Parameters
-
[in] | other | Input shared pointer |
◆ SharedPtr() [2/2]
Aliasing constructor: constructs a SharedPtr that shares ownership information with r, but holds an unrelated and unmanaged ptr pointer. Even if this SharedPtr is the last of the group to go out of scope, it calls the destructor for the object originally managed by r. However, calling get() on this always returns a copy of ptr. It is the responsibility of a programmer to make sure this ptr remains valid as long as this SharedPtr exists, such as in the typical use cases where ptr is a member of the object managed by r or is an alias (e.g., downcast) of r.get()
◆ staticPointerCast()
Creates a new instance of SharedPtr whose managed object type is obtained from the type of the managed object of r using a cast expression. Both shared pointers share ownership of the managed object. The managed object of the resulting SharedPtr is obtained by calling static_cast<T*>(r.get()).