Blender V4.3
blender::ResourceScope Class Reference

#include <BLI_resource_scope.hh>

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

Public Member Functions

 ResourceScope ()
 
 ~ResourceScope ()
 
#ResourceScope Inline Methods
template<typename T >
Tadd (std::unique_ptr< T > resource)
 
template<typename T >
Tadd (destruct_ptr< T > resource)
 
void add (void *userdata, void(*free)(void *))
 
template<typename T >
Tadd_value (T &&value)
 
template<typename Func >
void add_destruct_call (Func func)
 
template<typename T , typename... Args>
Tconstruct (Args &&...args)
 
LinearAllocatorlinear_allocator ()
 

Detailed Description

Definition at line 36 of file BLI_resource_scope.hh.

Constructor & Destructor Documentation

◆ ResourceScope()

blender::ResourceScope::ResourceScope ( )
default

◆ ~ResourceScope()

blender::ResourceScope::~ResourceScope ( )

Member Function Documentation

◆ add() [1/3]

template<typename T >
T * blender::ResourceScope::add ( destruct_ptr< T > resource)
inline

Pass ownership of the resource to the ResourceScope. It will be destructed when the collector is destructed.

Definition at line 87 of file BLI_resource_scope.hh.

References add(), data, and ptr.

◆ add() [2/3]

template<typename T >
T * blender::ResourceScope::add ( std::unique_ptr< T > resource)
inline

Pass ownership of the resource to the ResourceScope. It will be destructed and freed when the collector is destructed.

Definition at line 70 of file BLI_resource_scope.hh.

References add(), data, and ptr.

Referenced by add(), add(), add_destruct_call(), construct(), and blender::ed::spreadsheet::spreadsheet_main_region_draw().

◆ add() [3/3]

void blender::ResourceScope::add ( void * userdata,
void(* free )(void *) )
inline

Pass ownership of some resource to the ResourceScope. The given free function will be called when the collector is destructed.

Definition at line 109 of file BLI_resource_scope.hh.

References blender::Vector< T, InlineBufferCapacity, Allocator >::append(), data, and free().

◆ add_destruct_call()

template<typename Func >
void blender::ResourceScope::add_destruct_call ( Func func)
inline

The passed in function will be called when the scope is destructed.

Definition at line 129 of file BLI_resource_scope.hh.

References add(), blender::LinearAllocator< Allocator >::allocate(), and data.

Referenced by blender::fn::evaluate_fields().

◆ add_value()

template<typename T >
T & blender::ResourceScope::add_value ( T && value)
inline

Construct an object with the same value in the ResourceScope and return a reference to the new value.

Definition at line 121 of file BLI_resource_scope.hh.

References construct().

◆ construct()

◆ linear_allocator()

LinearAllocator & blender::ResourceScope::linear_allocator ( )
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 151 of file BLI_resource_scope.hh.

Referenced by blender::fn::evaluate_fields().


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