Blender  V3.3
Classes | Public Member Functions | List of all members
blender::ResourceScope Class Reference

#include <BLI_resource_scope.hh>

Inheritance diagram for blender::ResourceScope:
blender::NonCopyable 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 34 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 85 of file BLI_resource_scope.hh.

References add(), data, ptr, and T.

◆ 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 68 of file BLI_resource_scope.hh.

References data, ptr, and T.

Referenced by add(), add_destruct_call(), construct(), and spreadsheet_main_region_draw().

◆ add() [3/3]

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

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

Definition at line 107 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 127 of file BLI_resource_scope.hh.

References add(), blender::LinearAllocator< Allocator >::allocate(), buffer, 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 119 of file BLI_resource_scope.hh.

Referenced by blender::ed::spreadsheet::spreadsheet_filter_rows().

◆ construct()

template<typename T , typename... Args>
T & blender::ResourceScope::construct ( Args &&...  args)
inline

◆ 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 149 of file BLI_resource_scope.hh.

Referenced by compute_geometry(), and blender::fn::evaluate_fields().


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