diff options
author | Jacques Lucke <jacques@blender.org> | 2020-07-07 20:34:35 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2020-07-07 20:34:35 +0300 |
commit | 22158162efb6fb6b6d9af51c7be652fa9248155b (patch) | |
tree | 8e798a8f3da052702f27203fa11b16329de384b2 /source/blender/functions/FN_multi_function_builder.hh | |
parent | f4633cf46c075c65d8238e3cb81de6dac95610a8 (diff) |
Functions: add generic functions that output constants
Diffstat (limited to 'source/blender/functions/FN_multi_function_builder.hh')
-rw-r--r-- | source/blender/functions/FN_multi_function_builder.hh | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/source/blender/functions/FN_multi_function_builder.hh b/source/blender/functions/FN_multi_function_builder.hh index abc1e5d0723..98f263a75fa 100644 --- a/source/blender/functions/FN_multi_function_builder.hh +++ b/source/blender/functions/FN_multi_function_builder.hh @@ -225,6 +225,33 @@ template<typename T> class CustomMF_Constant : public MultiFunction { } }; +/** + * A multi-function that outputs the same value every time. The value is not owned by an instance + * of this function. The caller is responsible for destructing and freeing the value. + */ +class CustomMF_GenericConstant : public MultiFunction { + private: + const CPPType &type_; + const void *value_; + + public: + CustomMF_GenericConstant(const CPPType &type, const void *value); + void call(IndexMask mask, MFParams params, MFContext context) const override; +}; + +/** + * A multi-function that outputs the same array every time. The array is not owned by in instance + * of this function. The caller is responsible for destructing and freeing the values. + */ +class CustomMF_GenericConstantArray : public MultiFunction { + private: + GSpan array_; + + public: + CustomMF_GenericConstantArray(GSpan array); + void call(IndexMask mask, MFParams params, MFContext context) const override; +}; + } // namespace blender::fn #endif /* __FN_MULTI_FUNCTION_BUILDER_HH__ */ |