Blender
V3.3
|
#include <BLI_linear_allocator.hh>
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 , typename... Args> | |
MutableSpan< T > | construct_array (int64_t size, 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 19 of file BLI_linear_allocator.hh.
|
inline |
Definition at line 37 of file BLI_linear_allocator.hh.
|
inline |
Definition at line 43 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 86 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 56 of file BLI_linear_allocator.hh.
References blender::LinearAllocator< Allocator >::allocate(), BLI_assert, is_power_of_2_i(), and size().
Referenced by blender::ResourceScope::add_destruct_call(), blender::GValueMap< Key >::add_new_by_copy(), blender::GValueMap< Key >::add_new_by_move(), blender::modifiers::geometry_nodes::NodeParamsProvider::alloc_output_value(), compute_geometry(), blender::fn::evaluate_fields(), blender::modifiers::geometry_nodes::GeometryNodesEvaluator::execute_multi_function_node__field(), blender::modifiers::geometry_nodes::GeometryNodesEvaluator::execute_multi_function_node__value(), blender::modifiers::geometry_nodes::GeometryNodesEvaluator::execute_unknown_node(), blender::modifiers::geometry_nodes::GeometryNodesEvaluator::extract_group_outputs(), blender::modifiers::geometry_nodes::GeometryNodesEvaluator::forward_output(), blender::modifiers::geometry_nodes::GeometryNodesEvaluator::forward_to_sockets_with_same_type(), blender::modifiers::geometry_nodes::GeometryNodesEvaluator::get_value_from_socket(), blender::fn::ValueAllocator::obtain_OneSingle(), blender::fn::ValueAllocator::obtain_Span(), blender::modifiers::geometry_nodes::NodeParamsProvider::set_default_remaining_outputs(), 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 96 of file BLI_linear_allocator.hh.
References blender::LinearAllocator< Allocator >::allocate(), size(), and T.
Referenced by blender::fn::MFProcedure::new_call_instruction(), and blender::tests::TEST().
|
inline |
Definition at line 157 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 110 of file BLI_linear_allocator.hh.
References blender::LinearAllocator< Allocator >::allocate(), buffer, and T.
Referenced by compute_geometry(), blender::ResourceScope::construct(), blender::fn::MFProcedure::construct_function(), blender::modifiers::geometry_nodes::GeometryNodesEvaluator::create_states_for_reachable_nodes(), blender::modifiers::geometry_nodes::GeometryNodesEvaluator::initialize_node_state(), blender::nodes::geometry_nodes_eval_log::ModifierLog::ModifierLog(), blender::fn::MFProcedure::new_branch_instruction(), blender::fn::MFProcedure::new_call_instruction(), blender::fn::MFProcedure::new_destruct_instruction(), blender::fn::MFProcedure::new_dummy_instruction(), blender::fn::MFProcedure::new_return_instruction(), blender::fn::MFProcedure::new_variable(), blender::nodes::NodeTreeRef::NodeTreeRef(), and blender::tests::TEST().
|
inline |
Construct multiple instances of a type in an array. The constructor of is called with the given arguments. The caller is responsible for calling the destructor (and not delete
) on the constructed elements.
Definition at line 123 of file BLI_linear_allocator.hh.
Referenced by blender::modifiers::geometry_nodes::GeometryNodesEvaluator::initialize_node_state(), and blender::tests::TEST().
|
inline |
Copy the given array into a memory buffer provided by this allocator.
Definition at line 135 of file BLI_linear_allocator.hh.
References blender::MutableSpan< T >::data(), src, and blender::uninitialized_copy_n().
Referenced by BLI_string_search_add(), and blender::tests::TEST().
|
inline |
Definition at line 175 of file BLI_linear_allocator.hh.
References blender::LinearAllocator< Allocator >::allocate_elements_and_pointer_array(), blender::MutableSpan< T >::cast(), and T.
Referenced by 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 149 of file BLI_linear_allocator.hh.
References blender::LinearAllocator< Allocator >::allocate(), buffer, and str.
Referenced by blender::string_search::extract_normalized_words(), and blender::tests::TEST().
|
inline |
Definition at line 198 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 192 of file BLI_linear_allocator.hh.
References blender::Vector< T, InlineBufferCapacity, Allocator >::append(), buffer, and size().
Referenced by blender::fn::MFProcedureExecutor::call(), blender::LinearAllocator< Allocator >::provide_buffer(), and blender::tests::TEST().