|
Blender
V2.93
|
#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 > | |
| T * | allocate () |
| template<typename T > | |
| MutableSpan< T > | allocate_array (int64_t size) |
| template<typename T , typename... Args> | |
| destruct_ptr< T > | construct (Args &&... args) |
| template<typename T > | |
| MutableSpan< T > | construct_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) |
Definition at line 33 of file BLI_linear_allocator.hh.
|
inline |
Definition at line 51 of file BLI_linear_allocator.hh.
|
inline |
Definition at line 57 of file BLI_linear_allocator.hh.
References ptr.
|
inline |
Allocate a memory buffer that can hold an instance of T.
This method only allocates memory and does not construct the instance.
Definition at line 100 of file BLI_linear_allocator.hh.
References T.
Referenced by blender::LinearAllocator< Allocator >::allocate(), blender::LinearAllocator< Allocator >::allocate_array(), blender::LinearAllocator< Allocator >::allocate_elements_and_pointer_array(), blender::LinearAllocator< Allocator >::construct(), and blender::LinearAllocator< Allocator >::copy_string().
|
inline |
Get a pointer to a memory buffer with the given size an alignment. The memory buffer will be freed when this LinearAllocator is destructed.
The alignment has to be a power of 2.
Definition at line 70 of file BLI_linear_allocator.hh.
References blender::LinearAllocator< Allocator >::allocate(), BLI_assert, is_power_of_2_i(), and size().
Referenced by blender::fn::GValueMap< Key >::add_new_by_copy(), blender::fn::GValueMap< Key >::add_new_by_move(), compute_geometry(), blender::nodes::MFNetworkBuilderBase::construct_fn(), blender::fn::MFNetworkEvaluationStorage::get_mutable_single__single(), blender::fn::MFNetworkEvaluationStorage::get_single_output__single(), blender::fn::mf_network_optimization::prepare_params_for_constant_folding(), blender::nodes::socket_expand_in_mf_network(), and blender::tests::TEST().
|
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().
|
inline |
Definition at line 156 of file BLI_linear_allocator.hh.
References blender::LinearAllocator< Allocator >::allocate(), and POINTER_OFFSET.
Referenced by blender::LinearAllocator< Allocator >::construct_elements_and_pointer_array().
|
inline |
Construct an instance of T in memory provided by this allocator.
Arguments passed to this method will be forwarded to the constructor of T.
You must not call delete on the returned value. Instead, only the destructor has to be called.
Definition at line 124 of file BLI_linear_allocator.hh.
References blender::LinearAllocator< Allocator >::allocate(), buffer, and T.
Referenced by blender::fn::MFNetwork::add_dummy(), blender::fn::MFNetwork::add_function(), blender::fn::MFNetworkEvaluationStorage::add_single_input_from_caller(), blender::fn::MFNetworkEvaluationStorage::add_single_output_from_caller(), blender::fn::MFNetworkEvaluationStorage::add_vector_input_from_caller(), blender::fn::MFNetworkEvaluationStorage::add_vector_output_from_caller(), compute_geometry(), blender::ResourceScope::construct(), blender::fn::MFNetworkEvaluationStorage::get_mutable_single__full(), blender::fn::MFNetworkEvaluationStorage::get_mutable_single__single(), blender::fn::MFNetworkEvaluationStorage::get_mutable_vector__full(), blender::fn::MFNetworkEvaluationStorage::get_mutable_vector__single(), blender::fn::MFNetworkEvaluationStorage::get_single_output__full(), blender::fn::MFNetworkEvaluationStorage::get_single_output__single(), blender::fn::MFNetworkEvaluationStorage::get_vector_output__full(), blender::fn::MFNetworkEvaluationStorage::get_vector_output__single(), blender::nodes::NodeTreeRef::NodeTreeRef(), and blender::tests::TEST().
|
inline |
Copy the given array into a memory buffer provided by this allocator.
Definition at line 134 of file BLI_linear_allocator.hh.
References blender::Span< T >::data(), blender::MutableSpan< T >::data(), blender::Span< T >::is_empty(), blender::Span< T >::size(), and blender::uninitialized_copy_n().
Referenced by blender::fn::MFNetwork::add_function(), BLI_string_search_add(), and blender::tests::TEST().
|
inline |
Definition at line 174 of file BLI_linear_allocator.hh.
References blender::LinearAllocator< Allocator >::allocate_elements_and_pointer_array(), blender::MutableSpan< T >::cast(), and T.
Referenced by blender::fn::MFNetwork::add_dummy(), blender::fn::MFNetwork::add_function(), and blender::tests::TEST().
|
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().
|
inline |
Definition at line 197 of file BLI_linear_allocator.hh.
References blender::LinearAllocator< Allocator >::provide_buffer(), and blender::AlignedBuffer< Size, Alignment >::ptr().
|
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().