|
Blender
V2.93
|
#include <BLI_resource_scope.hh>
Inherits blender::NonCopyable, and blender::NonMovable.
Public Member Functions | |
| ResourceScope ()=default | |
| ~ResourceScope () | |
| template<typename T > | |
| T * | add (std::unique_ptr< T > resource, const char *name) |
| template<typename T > | |
| T * | add (destruct_ptr< T > resource, const char *name) |
| void | add (void *userdata, void(*free)(void *), const char *name) |
| template<typename T > | |
| T & | add_value (T &&value, const char *name) |
| LinearAllocator & | linear_allocator () |
| template<typename T , typename... Args> | |
| T & | construct (const char *name, Args &&... args) |
| void | print (StringRef name) const |
Definition at line 48 of file BLI_resource_scope.hh.
|
default |
|
inline |
Definition at line 62 of file BLI_resource_scope.hh.
References data, and blender::Vector< T, InlineBufferCapacity, Allocator >::size().
|
inline |
Pass ownership of the resource to the ResourceScope. It will be destructed when the collector is destructed.
Definition at line 96 of file BLI_resource_scope.hh.
|
inline |
Pass ownership of the resource to the ResourceScope. It will be destructed and freed when the collector is destructed.
Definition at line 75 of file BLI_resource_scope.hh.
References BLI_assert, data, ptr, and T.
Referenced by add(), blender::fn::mf_network_optimization::add_constant_folded_sockets(), construct(), blender::nodes::MFNetworkBuilderBase::construct_fn(), blender::ed::spreadsheet::GeometryDataSource::get_column_values(), and spreadsheet_main_region_draw().
|
inline |
Pass ownership of some resource to the ResourceScope. The given free function will be called when the collector is destructed.
Definition at line 121 of file BLI_resource_scope.hh.
References blender::Vector< T, InlineBufferCapacity, Allocator >::append(), data, and free().
Construct an object with the same value in the ResourceScope and return a reference to the new value.
Definition at line 134 of file BLI_resource_scope.hh.
|
inline |
Utility method to construct an instance of type T that will be owned by the ResourceScope.
Definition at line 151 of file BLI_resource_scope.hh.
References add(), blender::LinearAllocator< Allocator >::construct(), and T.
Referenced by blender::fn::mf_network_optimization::add_constant_folded_sockets(), blender::fn::MFParamsBuilder::add_readonly_single_input(), blender::fn::MFParamsBuilder::add_readonly_vector_input(), blender::nodes::create_function_for_node_that_expands_into_multiple(), blender::nodes::get_multi_function_per_node(), blender::ed::spreadsheet::GeometryDataSource::get_selected_element_indices(), blender::fn::MFNetworkEvaluationStorage::get_single_input__full(), blender::fn::MFNetworkEvaluationStorage::get_single_input__single(), blender::fn::MFNetworkEvaluationStorage::get_vector_input__full(), blender::fn::MFNetworkEvaluationStorage::get_vector_input__single(), blender::nodes::insert_default_value_for_type(), blender::fn::mf_network_optimization::prepare_params_for_constant_folding(), blender::fn::MFParams::readonly_single_input(), and blender::fn::MFParams::readonly_vector_input().
|
inline |
Returns a reference to a linear allocator that is owned by the ResourcesCollector. Memory allocated through this allocator will be freed when the collector is destructed.
Definition at line 143 of file BLI_resource_scope.hh.
Referenced by compute_geometry(), blender::nodes::MFNetworkBuilderBase::construct_fn(), blender::fn::mf_network_optimization::prepare_params_for_constant_folding(), and blender::nodes::socket_expand_in_mf_network().
|
inline |
Print the names of all the resources that are owned by this ResourceScope. This can be useful for debugging.
Definition at line 163 of file BLI_resource_scope.hh.
References data, and blender::Vector< T, InlineBufferCapacity, Allocator >::size().