mn::memory::basic_threadsafed_allocator< TMutex, TAllocator, TFilter > Class Template Reference
#include <mn_lock_storage.hpp>
Collaboration diagram for mn::memory::basic_threadsafed_allocator< TMutex, TAllocator, TFilter >:
Public Types | |
using | allocator_category = typename allocator::allocator_category |
using | value_type = void |
using | pointer = void * |
using | const_pointer = const void * |
using | difference_type = mn::ptrdiff_t |
using | size_type = size_t |
using | is_thread_safe = mn::true_type |
using | lock_type = TMutex |
using | allocator_impl = TAllocator |
using | filter_type = TFilter |
using | self_type = basic_threadsafed_allocator< TMutex, TAllocator, TFilter > |
using | lock_guard = mn::basic_autolock< lock_type > |
Public Member Functions | |
basic_threadsafed_allocator () noexcept | |
basic_threadsafed_allocator (const lock_type &lckObject) noexcept | |
basic_threadsafed_allocator (const lock_type &lckObject, const filter_type &_fFilter) noexcept | |
pointer | allocate (size_t size, size_t alignment) |
malloc() a buffer in a given TAllocator and cheak with the given TFilter is this okay to alloc More... | |
pointer | allocate (size_t size) |
malloc() a buffer in a given TAllocator and cheak with the given TFilter is this okay to alloc More... | |
pointer | allocate (size_t count, size_t size, size_t alignment=0) |
malloc() a buffer in a given TAllocator and cheak with the given TFilter is this okay to alloc More... | |
void | deallocate (pointer address, size_t size, size_t alignment) noexcept |
free() a buffer in a given heap. More... | |
void | deallocate (pointer address, size_t size) noexcept |
free() a buffer in a given heap. More... | |
void | deallocate (pointer address, size_t count, size_t size, size_t alignment) noexcept |
free() a buffer in a given heap. More... | |
template<class Type , typename... Args> | |
Type * | construct (Args &&... args) |
Construct a object from allocated impl. More... | |
template<class Type > | |
void | destroy (Type *address) noexcept |
Deconstruct a object (call deconstructor) and free the memory. More... | |
size_t | get_max_alocator_size () const noexcept |
Get the maximal size to allocate. More... | |
void | lock (unsigned long xTicksToWait=0) const |
void | unlock () const noexcept |
void | set_ticksToWait (unsigned long xTicksToWait) |
bool | is_locked () |
basic_threadsafed_allocator (const self_type &other) noexcept=delete | |
self_type & | operator= (const basic_threadsafed_allocator &other) noexcept=delete |
Private Attributes | |
lock_type | m_lockObjct |
filter_type | m_fFilter |
unsigned long | m_xTicksToWait |
Detailed Description
template<class TMutex, class TAllocator, class TFilter = basic_allocator_filter>
class mn::memory::basic_threadsafed_allocator< TMutex, TAllocator, TFilter >
The basic allocater for all allocator impl in this library, with thread-safed version.
Member Typedef Documentation
◆ allocator_category
template<class TMutex , class TAllocator , class TFilter = basic_allocator_filter>
using mn::memory::basic_threadsafed_allocator< TMutex, TAllocator, TFilter >::allocator_category = typename allocator::allocator_category |
◆ allocator_impl
template<class TMutex , class TAllocator , class TFilter = basic_allocator_filter>
using mn::memory::basic_threadsafed_allocator< TMutex, TAllocator, TFilter >::allocator_impl = TAllocator |
◆ const_pointer
template<class TMutex , class TAllocator , class TFilter = basic_allocator_filter>
using mn::memory::basic_threadsafed_allocator< TMutex, TAllocator, TFilter >::const_pointer = const void* |
◆ difference_type
template<class TMutex , class TAllocator , class TFilter = basic_allocator_filter>
using mn::memory::basic_threadsafed_allocator< TMutex, TAllocator, TFilter >::difference_type = mn::ptrdiff_t |
◆ filter_type
template<class TMutex , class TAllocator , class TFilter = basic_allocator_filter>
using mn::memory::basic_threadsafed_allocator< TMutex, TAllocator, TFilter >::filter_type = TFilter |
◆ is_thread_safe
template<class TMutex , class TAllocator , class TFilter = basic_allocator_filter>
using mn::memory::basic_threadsafed_allocator< TMutex, TAllocator, TFilter >::is_thread_safe = mn::true_type |
◆ lock_guard
template<class TMutex , class TAllocator , class TFilter = basic_allocator_filter>
using mn::memory::basic_threadsafed_allocator< TMutex, TAllocator, TFilter >::lock_guard = mn::basic_autolock<lock_type> |
◆ lock_type
template<class TMutex , class TAllocator , class TFilter = basic_allocator_filter>
using mn::memory::basic_threadsafed_allocator< TMutex, TAllocator, TFilter >::lock_type = TMutex |
◆ pointer
template<class TMutex , class TAllocator , class TFilter = basic_allocator_filter>
using mn::memory::basic_threadsafed_allocator< TMutex, TAllocator, TFilter >::pointer = void* |
◆ self_type
template<class TMutex , class TAllocator , class TFilter = basic_allocator_filter>
using mn::memory::basic_threadsafed_allocator< TMutex, TAllocator, TFilter >::self_type = basic_threadsafed_allocator<TMutex, TAllocator, TFilter> |
◆ size_type
template<class TMutex , class TAllocator , class TFilter = basic_allocator_filter>
using mn::memory::basic_threadsafed_allocator< TMutex, TAllocator, TFilter >::size_type = size_t |
◆ value_type
template<class TMutex , class TAllocator , class TFilter = basic_allocator_filter>
using mn::memory::basic_threadsafed_allocator< TMutex, TAllocator, TFilter >::value_type = void |
Constructor & Destructor Documentation
◆ basic_threadsafed_allocator() [1/4]
template<class TMutex , class TAllocator , class TFilter = basic_allocator_filter>
|
inlinenoexcept |
◆ basic_threadsafed_allocator() [2/4]
template<class TMutex , class TAllocator , class TFilter = basic_allocator_filter>
|
inlinenoexcept |
◆ basic_threadsafed_allocator() [3/4]
template<class TMutex , class TAllocator , class TFilter = basic_allocator_filter>
|
inlinenoexcept |
◆ basic_threadsafed_allocator() [4/4]
template<class TMutex , class TAllocator , class TFilter = basic_allocator_filter>
|
deletenoexcept |
Member Function Documentation
◆ allocate() [1/3]
template<class TMutex , class TAllocator , class TFilter = basic_allocator_filter>
|
inline |
malloc() a buffer in a given TAllocator and cheak with the given TFilter is this okay to alloc
- Parameters
-
size The size of the Type count The count of the array alignment
- Returns
- Pointer to new memory, or NULL if allocation fails.
◆ allocate() [2/3]
template<class TMutex , class TAllocator , class TFilter = basic_allocator_filter>
|
inline |
malloc() a buffer in a given TAllocator and cheak with the given TFilter is this okay to alloc
- Parameters
-
size Size of desired buffer.
- Returns
- Pointer to new memory, or NULL if allocation fails.
◆ allocate() [3/3]
template<class TMutex , class TAllocator , class TFilter = basic_allocator_filter>
|
inline |
malloc() a buffer in a given TAllocator and cheak with the given TFilter is this okay to alloc
- Parameters
-
size Size of desired buffer. alignment
- Returns
- Pointer to new memory, or NULL if allocation fails.
◆ construct()
template<class TMutex , class TAllocator , class TFilter = basic_allocator_filter>
template<class Type , typename... Args>
|
inline |
Construct a object from allocated impl.
- Template Parameters
-
Type The type of the object.
- Parameters
-
Args The arguments for the constructer of the object.
◆ deallocate() [1/3]
template<class TMutex , class TAllocator , class TFilter = basic_allocator_filter>
|
inlinenoexcept |
free() a buffer in a given heap.
- Parameters
-
address The address to free count The count of the array size The size of the Type alignment
◆ deallocate() [2/3]
template<class TMutex , class TAllocator , class TFilter = basic_allocator_filter>
|
inlinenoexcept |
free() a buffer in a given heap.
- Parameters
-
address The address to free. size The size of the Type
◆ deallocate() [3/3]
template<class TMutex , class TAllocator , class TFilter = basic_allocator_filter>
|
inlinenoexcept |
free() a buffer in a given heap.
- Parameters
-
address The address to free. alignment size The size of the Type
◆ destroy()
template<class TMutex , class TAllocator , class TFilter = basic_allocator_filter>
template<class Type >
|
inlinenoexcept |
Deconstruct a object (call deconstructor) and free the memory.
- Template Parameters
-
Type The type of the object.
- Parameters
-
address The pointer of the object to be deconstruct.
◆ get_max_alocator_size()
template<class TMutex , class TAllocator , class TFilter = basic_allocator_filter>
|
inlinenoexcept |
Get the maximal size to allocate.
- Returns
- The maximal size to allocate.
◆ is_locked()
template<class TMutex , class TAllocator , class TFilter = basic_allocator_filter>
|
inline |
◆ lock()
template<class TMutex , class TAllocator , class TFilter = basic_allocator_filter>
|
inline |
◆ operator=()
template<class TMutex , class TAllocator , class TFilter = basic_allocator_filter>
|
deletenoexcept |
◆ set_ticksToWait()
template<class TMutex , class TAllocator , class TFilter = basic_allocator_filter>
|
inline |
◆ unlock()
template<class TMutex , class TAllocator , class TFilter = basic_allocator_filter>
|
inlinenoexcept |
Member Data Documentation
◆ m_fFilter
template<class TMutex , class TAllocator , class TFilter = basic_allocator_filter>
|
private |
◆ m_lockObjct
template<class TMutex , class TAllocator , class TFilter = basic_allocator_filter>
|
private |
◆ m_xTicksToWait
template<class TMutex , class TAllocator , class TFilter = basic_allocator_filter>
|
private |
The documentation for this class was generated from the following file: