30 std::unique_ptr<ResourceScope> scope_;
79 void assert_current_param_name(
StringRef expected_name);
81 int current_param_index()
const;
85 void add_unused_output_for_unsupporting_function(
const CPPType &type);
142inline ParamsBuilder::ParamsBuilder(
const Signature &signature,
const IndexMask &mask)
143 : signature_(&signature), mask_(mask), min_array_size_(mask.min_array_size())
145 actual_params_.reserve(signature.params.size());
152 actual_params_.append_unchecked_as(std::in_place_type<GVArray>,
163 actual_params_.append_unchecked_as(std::in_place_type<GVArray>,
174 actual_params_.append_unchecked_as(std::in_place_type<GVArray>,
varray_tag::span{}, span);
180 actual_params_.append_unchecked_as(std::in_place_type<GVArray>,
191 actual_params_.append_unchecked_as(std::in_place_type<GVArray>, std::move(varray));
198 this->resource_scope().construct<GVVectorArray_For_GVectorArray>(vector_array),
206 single_vector, min_array_size_),
215 actual_params_.append_unchecked_as(std::in_place_type<const GVVectorArray *>, &ref);
229 actual_params_.append_unchecked_as(std::in_place_type<GMutableSpan>, ref);
234 this->assert_current_param_name(expected_name);
235 const int param_index = this->current_param_index();
244 actual_params_.append_unchecked_as(std::in_place_type<GMutableSpan>, dummy_span);
247 this->add_unused_output_for_unsupporting_function(type);
255 actual_params_.append_unchecked_as(std::in_place_type<GVectorArray *>, &vector_array);
262 actual_params_.append_unchecked_as(std::in_place_type<GMutableSpan>, ref);
269 actual_params_.append_unchecked_as(std::in_place_type<GVectorArray *>, &vector_array);
274 return actual_params_.size();
282 return std::get<GMutableSpan>(actual_params_[param_index]);
290 return *std::get<GVectorArray *>(actual_params_[param_index]);
293inline void ParamsBuilder::assert_current_param_type(
ParamType param_type,
StringRef expected_name)
297 int param_index = this->current_param_index();
299 if (expected_name !=
"") {
304 ParamType expected_type = signature_->
params[param_index].type;
309inline void ParamsBuilder::assert_current_param_name(
StringRef expected_name)
316 const int param_index = this->current_param_index();
317 StringRef actual_name = signature_->
params[param_index].name;
322inline int ParamsBuilder::current_param_index()
const
324 return actual_params_.size();
327inline ResourceScope &ParamsBuilder::resource_scope()
330 scope_ = std::make_unique<ResourceScope>();
345 return varray.
typed<T>();
351 return std::get<GVArray>(builder_->actual_params_[param_index]);
357 return !std::get<GMutableSpan>(builder_->actual_params_[param_index]).is_empty();
371 GMutableSpan span = std::get<GMutableSpan>(builder_->actual_params_[param_index]);
389 return std::get<GMutableSpan>(builder_->actual_params_[param_index]);
402 return *std::get<const GVVectorArray *>(builder_->actual_params_[param_index]);
414 return *std::get<GVectorArray *>(builder_->actual_params_[param_index]);
425 return std::get<GMutableSpan>(builder_->actual_params_[param_index]);
437 return *std::get<GVectorArray *>(builder_->actual_params_[param_index]);
440inline void Params::assert_correct_param(
int param_index,
StringRef name,
ParamType param_type)
445 if (name.size() > 0) {
455 BLI_assert(builder_->signature_->
params[param_index].type.category() == category);
456 if (name.size() > 0) {
#define UNUSED_VARS_NDEBUG(...)
static const CPPType & get()
const CPPType & type() const
const CPPType & type() const
const CPPType & type() const
VArray< T > typed() const
const CPPType & type() const
const CPPType & type() const
T & construct(Args &&...args)
constexpr bool is_empty() const
const CPPType & single_type() const
static ParamType ForVectorInput(const CPPType &base_type)
const DataType & data_type() const
static ParamType ForSingleOutput(const CPPType &type)
static ParamType ForVectorOutput(const CPPType &base_type)
static ParamType ForMutableSingle(const CPPType &type)
static ParamType ForMutableVector(const CPPType &base_type)
ParamCategory category() const
static ParamType ForSingleInput(const CPPType &type)
void add_single_mutable(GMutableSpan ref, StringRef expected_name="")
GVectorArray & computed_vector_array(int param_index)
int next_param_index() const
void add_ignored_single_output(StringRef expected_name="")
void add_uninitialized_single_output(T *value, StringRef expected_name="")
void add_vector_output(GVectorArray &vector_array, StringRef expected_name="")
GMutableSpan computed_array(int param_index)
void add_vector_mutable(GVectorArray &vector_array, StringRef expected_name="")
ParamsBuilder(const class MultiFunction &fn, const IndexMask *mask)
void add_readonly_single_input(const T *value, StringRef expected_name="")
void add_readonly_vector_input(const GVectorArray &vector_array, StringRef expected_name="")
void add_readonly_single_input_value(T value, StringRef expected_name="")
MutableSpan< T > uninitialized_single_output_if_required(int param_index, StringRef name="")
const VVectorArray< T > & readonly_vector_input(int param_index, StringRef name="")
MutableSpan< T > uninitialized_single_output(int param_index, StringRef name="")
GVectorArray_TypedMutableRef< T > vector_mutable(int param_index, StringRef name="")
GVectorArray_TypedMutableRef< T > vector_output(int param_index, StringRef name="")
MutableSpan< T > single_mutable(int param_index, StringRef name="")
Params(ParamsBuilder &builder)
VArray< T > readonly_single_input(int param_index, StringRef name="")
bool single_output_is_required(int param_index, StringRef name="")
Vector< ParamInfo > params