Blender  V2.93
Public Member Functions | List of all members
blender::LinearAllocator< Allocator > Class Template Reference

#include <BLI_linear_allocator.hh>

Inherits blender::NonCopyable, and blender::NonMovable.

Public Member Functions

 LinearAllocator ()
 
 ~LinearAllocator ()
 
void * allocate (const int64_t size, const int64_t alignment)
 
template<typename T >
Tallocate ()
 
template<typename T >
MutableSpan< Tallocate_array (int64_t size)
 
template<typename T , typename... Args>
destruct_ptr< Tconstruct (Args &&... args)
 
template<typename T >
MutableSpan< Tconstruct_array_copy (Span< T > src)
 
StringRefNull copy_string (StringRef str)
 
MutableSpan< void * > allocate_elements_and_pointer_array (int64_t element_amount, int64_t element_size, int64_t element_alignment)
 
template<typename T , typename... Args>
Span< T * > construct_elements_and_pointer_array (int64_t n, Args &&... args)
 
void provide_buffer (void *buffer, uint size)
 
template<size_t Size, size_t Alignment>
void provide_buffer (AlignedBuffer< Size, Alignment > &aligned_buffer)
 

Detailed Description

template<typename Allocator = GuardedAllocator>
class blender::LinearAllocator< Allocator >

Definition at line 33 of file BLI_linear_allocator.hh.

Constructor & Destructor Documentation

◆ LinearAllocator()

template<typename Allocator = GuardedAllocator>
blender::LinearAllocator< Allocator >::LinearAllocator ( )
inline

Definition at line 51 of file BLI_linear_allocator.hh.

◆ ~LinearAllocator()

template<typename Allocator = GuardedAllocator>
blender::LinearAllocator< Allocator >::~LinearAllocator ( )
inline

Definition at line 57 of file BLI_linear_allocator.hh.

References ptr.

Member Function Documentation

◆ allocate() [1/2]

template<typename Allocator = GuardedAllocator>
template<typename T >
T* blender::LinearAllocator< Allocator >::allocate ( )
inline

◆ allocate() [2/2]

template<typename Allocator = GuardedAllocator>
void* blender::LinearAllocator< Allocator >::allocate ( const int64_t  size,
const int64_t  alignment 
)
inline

◆ allocate_array()

template<typename Allocator = GuardedAllocator>
template<typename T >
MutableSpan<T> blender::LinearAllocator< Allocator >::allocate_array ( int64_t  size)
inline

Allocate a memory buffer that can hold T array with the given size.

This method only allocates memory and does not construct the instance.

Definition at line 110 of file BLI_linear_allocator.hh.

References blender::LinearAllocator< Allocator >::allocate(), size(), and T.

Referenced by blender::fn::MFNetwork::add_dummy(), and blender::tests::TEST().

◆ allocate_elements_and_pointer_array()

template<typename Allocator = GuardedAllocator>
MutableSpan<void *> blender::LinearAllocator< Allocator >::allocate_elements_and_pointer_array ( int64_t  element_amount,
int64_t  element_size,
int64_t  element_alignment 
)
inline

◆ construct()

template<typename Allocator = GuardedAllocator>
template<typename T , typename... Args>
destruct_ptr<T> blender::LinearAllocator< Allocator >::construct ( Args &&...  args)
inline

◆ construct_array_copy()

template<typename Allocator = GuardedAllocator>
template<typename T >
MutableSpan<T> blender::LinearAllocator< Allocator >::construct_array_copy ( Span< T src)
inline

◆ construct_elements_and_pointer_array()

template<typename Allocator = GuardedAllocator>
template<typename T , typename... Args>
Span<T *> blender::LinearAllocator< Allocator >::construct_elements_and_pointer_array ( int64_t  n,
Args &&...  args 
)
inline

◆ copy_string()

template<typename Allocator = GuardedAllocator>
StringRefNull blender::LinearAllocator< Allocator >::copy_string ( StringRef  str)
inline

Copy the given string into a memory buffer provided by this allocator. The returned string is always null terminated.

Definition at line 148 of file BLI_linear_allocator.hh.

References blender::LinearAllocator< Allocator >::allocate(), buffer, and str.

Referenced by blender::fn::MFNetwork::add_dummy(), blender::string_search::extract_normalized_words(), and blender::tests::TEST().

◆ provide_buffer() [1/2]

template<typename Allocator = GuardedAllocator>
template<size_t Size, size_t Alignment>
void blender::LinearAllocator< Allocator >::provide_buffer ( AlignedBuffer< Size, Alignment > &  aligned_buffer)
inline

◆ provide_buffer() [2/2]

template<typename Allocator = GuardedAllocator>
void blender::LinearAllocator< Allocator >::provide_buffer ( void *  buffer,
uint  size 
)
inline

Tell the allocator to use up the given memory buffer, before allocating new memory from the system.

Definition at line 191 of file BLI_linear_allocator.hh.

References blender::Vector< T, InlineBufferCapacity, Allocator >::append(), buffer, and size().

Referenced by blender::LinearAllocator< Allocator >::provide_buffer(), and blender::tests::TEST().


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