Rumba C++ SDK
maquina::BufferAllocator< T > Class Template Reference

Allocator to use with std::vector. Allocates memory first in the user provided buffer and then using the standard allocator. More...

#include <BufferAllocator.h>

Public Types

using size_type = typename std::allocator< T >::size_type
 
using value_type = typename std::allocator< T >::value_type
 
using difference_type = typename std::allocator< T >::difference_type
 
using pointer = typename std::allocator< T >::pointer
 
using const_pointer = typename std::allocator< T >::const_pointer
 
using reference = typename std::allocator< T >::reference
 
using const_reference = typename std::allocator< T >::const_reference
 
using propagate_on_container_move_assignment = std::true_type
 

Public Member Functions

 BufferAllocator ()=delete
 
 BufferAllocator (T *ptr, size_type size)
 Creates a BufferAllocator. More...
 
T * allocate (size_type n, const void *hint=0)
 
void deallocate (T *p, std::size_t n)
 
bool use_heap () const
 Return true if the heap allocator has been used by this allocator. Return false if only the buffer has been used. More...
 

Detailed Description

template<class T>
class maquina::BufferAllocator< T >

Allocator to use with std::vector. Allocates memory first in the user provided buffer and then using the standard allocator.

Member Typedef Documentation

◆ const_pointer

template<class T >
using maquina::BufferAllocator< T >::const_pointer = typename std::allocator<T>::const_pointer

◆ const_reference

template<class T >
using maquina::BufferAllocator< T >::const_reference = typename std::allocator<T>::const_reference

◆ difference_type

template<class T >
using maquina::BufferAllocator< T >::difference_type = typename std::allocator<T>::difference_type

◆ pointer

template<class T >
using maquina::BufferAllocator< T >::pointer = typename std::allocator<T>::pointer

◆ propagate_on_container_move_assignment

template<class T >
using maquina::BufferAllocator< T >::propagate_on_container_move_assignment = std::true_type

◆ reference

template<class T >
using maquina::BufferAllocator< T >::reference = typename std::allocator<T>::reference

◆ size_type

template<class T >
using maquina::BufferAllocator< T >::size_type = typename std::allocator<T>::size_type

◆ value_type

template<class T >
using maquina::BufferAllocator< T >::value_type = typename std::allocator<T>::value_type

Constructor & Destructor Documentation

◆ BufferAllocator() [1/2]

template<class T >
maquina::BufferAllocator< T >::BufferAllocator ( )
delete

◆ BufferAllocator() [2/2]

template<class T >
maquina::BufferAllocator< T >::BufferAllocator ( T *  ptr,
size_type  size 
)
inline

Creates a BufferAllocator.

Parameters
ptrA user provided buffer where the first allocation should be performed.
sizeThe user buffer size in number of objects.

Member Function Documentation

◆ allocate()

template<class T >
T* maquina::BufferAllocator< T >::allocate ( size_type  n,
const void *  hint = 0 
)
inline

◆ deallocate()

template<class T >
void maquina::BufferAllocator< T >::deallocate ( T *  p,
std::size_t  n 
)
inline

◆ use_heap()

template<class T >
bool maquina::BufferAllocator< T >::use_heap ( ) const
inline

Return true if the heap allocator has been used by this allocator. Return false if only the buffer has been used.


The documentation for this class was generated from the following file: