Blender V4.3
blender::fn::lazy_function::Params Class Referenceabstract

#include <FN_lazy_function.hh>

Inherited by blender::fn::lazy_function::BasicParams, blender::fn::lazy_function::GraphExecutorLFParams, and blender::fn::lazy_function::RemappedParams.

Public Attributes

const LazyFunctionfn_
 
std::thread::id main_thread_id_
 
std::atomic< bool > allow_multi_threading_
 

#Params Inline Methods

 Params (const LazyFunction &fn, bool allow_multi_threading_initially)
 
void * try_get_input_data_ptr (int index) const
 
void * try_get_input_data_ptr_or_request (int index)
 
void * get_output_data_ptr (int index)
 
void output_set (int index)
 
bool output_was_set (int index) const
 
ValueUsage get_output_usage (int index) const
 
void set_input_unused (int index)
 
template<typename T >
T extract_input (int index)
 
template<typename T >
Tget_input (int index) const
 
template<typename T >
Ttry_get_input_data_ptr (int index) const
 
template<typename T >
Ttry_get_input_data_ptr_or_request (int index)
 
template<typename T >
void set_output (int index, T &&value)
 
bool try_enable_multi_threading ()
 

Detailed Description

Defines the calling convention for a lazy-function. During execution, a lazy-function retrieves its inputs and sets the outputs through Params.

Definition at line 133 of file FN_lazy_function.hh.

Constructor & Destructor Documentation

◆ Params()

blender::fn::lazy_function::Params::Params ( const LazyFunction & fn,
bool allow_multi_threading_initially )
inline

Definition at line 378 of file FN_lazy_function.hh.

Member Function Documentation

◆ extract_input()

template<typename T >
T blender::fn::lazy_function::Params::extract_input ( int index)
inline

Typed utility methods that wrap the methods above.

Definition at line 435 of file FN_lazy_function.hh.

References BLI_assert, and try_get_input_data_ptr().

Referenced by blender::nodes::GeoNodeExecParams::extract_input().

◆ get_input()

template<typename T >
T & blender::fn::lazy_function::Params::get_input ( int index) const
inline

◆ get_output_data_ptr()

void * blender::fn::lazy_function::Params::get_output_data_ptr ( int index)
inline

Get a pointer to where the output value should be stored. The value at the pointer is in an uninitialized state at first. The #LazyFunction is responsible for initializing the value. After the output has been initialized to its final value, output_set has to be called.

Definition at line 402 of file FN_lazy_function.hh.

References BLI_assert, fn_, and blender::fn::lazy_function::LazyFunction::outputs().

Referenced by blender::fn::lazy_function::RemappedParams::get_output_data_ptr_impl(), and set_output().

◆ get_output_usage()

ValueUsage blender::fn::lazy_function::Params::get_output_usage ( int index) const
inline

◆ output_set()

void blender::fn::lazy_function::Params::output_set ( int index)
inline

Call this after the output value is initialized. After this is called, the value must not be touched anymore. It may be moved or destructed immediately.

Definition at line 409 of file FN_lazy_function.hh.

References BLI_assert, fn_, and blender::fn::lazy_function::LazyFunction::outputs().

Referenced by blender::fn::lazy_function::RemappedParams::output_set_impl(), and set_output().

◆ output_was_set()

bool blender::fn::lazy_function::Params::output_was_set ( int index) const
inline

Allows the #LazyFunction to check whether an output was computed already without keeping track of it itself.

Definition at line 416 of file FN_lazy_function.hh.

References BLI_assert, fn_, and blender::fn::lazy_function::LazyFunction::outputs().

Referenced by blender::fn::lazy_function::RemappedParams::output_was_set_impl().

◆ set_input_unused()

void blender::fn::lazy_function::Params::set_input_unused ( int index)
inline

Tell the caller of the #LazyFunction that a specific input will definitely not be used. Only an input that was not ValueUsage::Used can become unused.

Definition at line 428 of file FN_lazy_function.hh.

References BLI_assert, fn_, and blender::fn::lazy_function::LazyFunction::inputs().

Referenced by blender::nodes::GeoNodeExecParams::set_input_unused(), and blender::fn::lazy_function::RemappedParams::set_input_unused_impl().

◆ set_output()

template<typename T >
void blender::fn::lazy_function::Params::set_output ( int index,
T && value )
inline

◆ try_enable_multi_threading()

bool blender::fn::lazy_function::Params::try_enable_multi_threading ( )
inline

Returns true when the lazy-function is now allowed to use multi-threading when interacting with this Params. That means, it is allowed to call non-const methods from different threads.

Definition at line 472 of file FN_lazy_function.hh.

References allow_multi_threading_.

Referenced by blender::fn::lazy_function::RemappedParams::try_enable_multi_threading_impl().

◆ try_get_input_data_ptr() [1/2]

void * blender::fn::lazy_function::Params::try_get_input_data_ptr ( int index) const
inline

Get a pointer to an input value if the value is available already. Otherwise null is returned.

The #LazyFunction must leave returned object in an initialized state, but can move from it.

Definition at line 389 of file FN_lazy_function.hh.

References BLI_assert, fn_, and blender::fn::lazy_function::LazyFunction::inputs().

Referenced by extract_input(), get_input(), try_get_input_data_ptr(), and blender::fn::lazy_function::RemappedParams::try_get_input_data_ptr_impl().

◆ try_get_input_data_ptr() [2/2]

template<typename T >
T * blender::fn::lazy_function::Params::try_get_input_data_ptr ( int index) const
inline

Definition at line 451 of file FN_lazy_function.hh.

References try_get_input_data_ptr().

◆ try_get_input_data_ptr_or_request() [1/2]

void * blender::fn::lazy_function::Params::try_get_input_data_ptr_or_request ( int index)
inline

Same as try_get_input_data_ptr, but if the data is not yet available, request it. This makes sure that the data will be available in a future execution of the #LazyFunction.

Definition at line 395 of file FN_lazy_function.hh.

References BLI_assert, fn_, and blender::fn::lazy_function::LazyFunction::inputs().

Referenced by try_get_input_data_ptr_or_request(), and blender::fn::lazy_function::RemappedParams::try_get_input_data_ptr_or_request_impl().

◆ try_get_input_data_ptr_or_request() [2/2]

template<typename T >
T * blender::fn::lazy_function::Params::try_get_input_data_ptr_or_request ( int index)
inline

Definition at line 457 of file FN_lazy_function.hh.

References try_get_input_data_ptr_or_request().

Member Data Documentation

◆ allow_multi_threading_

std::atomic<bool> blender::fn::lazy_function::Params::allow_multi_threading_

Definition at line 141 of file FN_lazy_function.hh.

Referenced by try_enable_multi_threading().

◆ fn_

const LazyFunction& blender::fn::lazy_function::Params::fn_

◆ main_thread_id_

std::thread::id blender::fn::lazy_function::Params::main_thread_id_

Definition at line 140 of file FN_lazy_function.hh.


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