Blender V5.0
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 106 of file FN_lazy_function.hh.

Constructor & Destructor Documentation

◆ Params()

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 407 of file FN_lazy_function.hh.

References BLI_assert, data, T, and try_get_input_data_ptr().

◆ get_input()

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

Definition at line 416 of file FN_lazy_function.hh.

References BLI_assert, data, T, and try_get_input_data_ptr().

◆ 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 374 of file FN_lazy_function.hh.

References BLI_assert, and fn_.

Referenced by set_output().

◆ get_output_usage()

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

Can be used to detect which outputs have to be computed.

Definition at line 394 of file FN_lazy_function.hh.

References BLI_assert, and fn_.

◆ 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 381 of file FN_lazy_function.hh.

References BLI_assert, and fn_.

Referenced by 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 388 of file FN_lazy_function.hh.

References BLI_assert, and fn_.

◆ 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 400 of file FN_lazy_function.hh.

References BLI_assert, and fn_.

◆ 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 444 of file FN_lazy_function.hh.

References allow_multi_threading_.

◆ try_get_input_data_ptr() [1/2]

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

Definition at line 423 of file FN_lazy_function.hh.

References T, and try_get_input_data_ptr().

◆ try_get_input_data_ptr() [2/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 361 of file FN_lazy_function.hh.

References BLI_assert, and fn_.

Referenced by extract_input(), get_input(), and try_get_input_data_ptr().

◆ try_get_input_data_ptr_or_request() [1/2]

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

Definition at line 429 of file FN_lazy_function.hh.

References T, and try_get_input_data_ptr_or_request().

◆ try_get_input_data_ptr_or_request() [2/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 367 of file FN_lazy_function.hh.

References BLI_assert, and fn_.

Referenced by 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 114 of file FN_lazy_function.hh.

Referenced by Params(), and 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 113 of file FN_lazy_function.hh.

Referenced by Params().


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