[Bf-blender-cvs] [9dbe43f044a] functions-experimental-refactor: start using MF prefix for some classes
Jacques Lucke
noreply at git.blender.org
Fri Oct 18 17:53:30 CEST 2019
Commit: 9dbe43f044ad6a55f02b20b585c63266c2f22714
Author: Jacques Lucke
Date: Fri Oct 18 17:23:35 2019 +0200
Branches: functions-experimental-refactor
https://developer.blender.org/rB9dbe43f044ad6a55f02b20b585c63266c2f22714
start using MF prefix for some classes
===================================================================
M source/blender/blenkernel/BKE_multi_function.h
M source/blender/blenkernel/BKE_multi_function_network.h
M source/blender/blenkernel/BKE_multi_functions.h
M source/blender/blenkernel/intern/multi_function_network.cc
M source/blender/blenkernel/intern/multi_functions.cc
M source/blender/modifiers/intern/MOD_functiondeform_cxx.cc
===================================================================
diff --git a/source/blender/blenkernel/BKE_multi_function.h b/source/blender/blenkernel/BKE_multi_function.h
index bea715de6f6..8209143f2d2 100644
--- a/source/blender/blenkernel/BKE_multi_function.h
+++ b/source/blender/blenkernel/BKE_multi_function.h
@@ -11,7 +11,7 @@ namespace BKE {
using BLI::Vector;
-struct MultiFunctionDataType {
+struct MFDataType {
public:
enum Category {
None,
@@ -19,10 +19,9 @@ struct MultiFunctionDataType {
Vector,
};
- MultiFunctionDataType() = default;
+ MFDataType() = default;
- MultiFunctionDataType(Category category, const CPPType &type)
- : m_category(category), m_base_type(&type)
+ MFDataType(Category category, const CPPType &type) : m_category(category), m_base_type(&type)
{
}
@@ -48,7 +47,7 @@ struct MultiFunctionDataType {
const CPPType *m_base_type = nullptr;
};
-struct ParamType {
+struct MFParamType {
public:
enum Category {
None,
@@ -59,14 +58,14 @@ struct ParamType {
MutableVector,
};
- ParamType(Category category, const CPPType *base_type = nullptr)
+ MFParamType(Category category, const CPPType *base_type = nullptr)
: m_category(category), m_base_type(base_type)
{
}
bool is_none() const
{
- return m_category == ParamType::None;
+ return m_category == MFParamType::None;
}
bool is_input() const
@@ -79,18 +78,18 @@ struct ParamType {
return ELEM(m_category, SingleOutput, VectorOutput, MutableVector);
}
- MultiFunctionDataType as_data_type() const
+ MFDataType as_data_type() const
{
switch (m_category) {
case None:
return {};
case ReadonlySingleInput:
case SingleOutput:
- return {MultiFunctionDataType::Single, *m_base_type};
+ return {MFDataType::Single, *m_base_type};
case ReadonlyVectorInput:
case VectorOutput:
case MutableVector:
- return {MultiFunctionDataType::Vector, *m_base_type};
+ return {MFDataType::Vector, *m_base_type};
}
BLI_assert(false);
return {};
@@ -121,385 +120,385 @@ struct ParamType {
const CPPType *m_base_type = nullptr;
};
-class MultiFunction {
- public:
- class Context {
- };
+class MFContext {
+};
- class Signature {
- private:
- Vector<std::string> m_param_names;
- Vector<ParamType> m_param_types;
- Vector<uint> m_params_with_external_dependencies;
- Vector<uint> m_corrected_indices;
+class MFSignature {
+ private:
+ Vector<std::string> m_param_names;
+ Vector<MFParamType> m_param_types;
+ Vector<uint> m_params_with_external_dependencies;
+ Vector<uint> m_corrected_indices;
- public:
- Signature() = default;
+ public:
+ MFSignature() = default;
- Signature(Vector<std::string> param_names,
- Vector<ParamType> param_types,
+ MFSignature(Vector<std::string> param_names,
+ Vector<MFParamType> param_types,
Vector<uint> params_with_external_dependencies)
- : m_param_names(std::move(param_names)),
- m_param_types(std::move(param_types)),
- m_params_with_external_dependencies(std::move(params_with_external_dependencies))
- {
- uint array_or_single_refs = 0;
- uint mutable_array_refs = 0;
- uint vector_array_or_single_refs = 0;
- uint vector_arrays = 0;
- for (ParamType param_type : m_param_types) {
- uint corrected_index = 0;
- switch (param_type.category()) {
- case ParamType::None:
- BLI_assert(false);
- break;
- case ParamType::ReadonlySingleInput:
- corrected_index = array_or_single_refs++;
- break;
- case ParamType::SingleOutput:
- corrected_index = mutable_array_refs++;
- break;
- case ParamType::ReadonlyVectorInput:
- corrected_index = vector_array_or_single_refs++;
- break;
- case ParamType::VectorOutput:
- case ParamType::MutableVector:
- corrected_index = vector_arrays++;
- break;
- }
- m_corrected_indices.append(corrected_index);
+ : m_param_names(std::move(param_names)),
+ m_param_types(std::move(param_types)),
+ m_params_with_external_dependencies(std::move(params_with_external_dependencies))
+ {
+ uint array_or_single_refs = 0;
+ uint mutable_array_refs = 0;
+ uint vector_array_or_single_refs = 0;
+ uint vector_arrays = 0;
+ for (MFParamType param_type : m_param_types) {
+ uint corrected_index = 0;
+ switch (param_type.category()) {
+ case MFParamType::None:
+ BLI_assert(false);
+ break;
+ case MFParamType::ReadonlySingleInput:
+ corrected_index = array_or_single_refs++;
+ break;
+ case MFParamType::SingleOutput:
+ corrected_index = mutable_array_refs++;
+ break;
+ case MFParamType::ReadonlyVectorInput:
+ corrected_index = vector_array_or_single_refs++;
+ break;
+ case MFParamType::VectorOutput:
+ case MFParamType::MutableVector:
+ corrected_index = vector_arrays++;
+ break;
}
+ m_corrected_indices.append(corrected_index);
}
+ }
- ArrayRef<ParamType> param_types() const
- {
- return m_param_types;
- }
+ ArrayRef<MFParamType> param_types() const
+ {
+ return m_param_types;
+ }
- uint get_corrected_index(uint index) const
- {
- return m_corrected_indices[index];
- }
+ uint get_corrected_index(uint index) const
+ {
+ return m_corrected_indices[index];
+ }
- template<typename T> bool is_readonly_single_input(uint index, StringRef name) const
- {
- return this->is_valid_param<T>(index, name, ParamType::ReadonlySingleInput);
- }
- bool is_readonly_single_input(uint index, StringRef name) const
- {
- return this->is_valid_param(index, name, ParamType::ReadonlySingleInput);
- }
+ template<typename T> bool is_readonly_single_input(uint index, StringRef name) const
+ {
+ return this->is_valid_param<T>(index, name, MFParamType::ReadonlySingleInput);
+ }
+ bool is_readonly_single_input(uint index, StringRef name) const
+ {
+ return this->is_valid_param(index, name, MFParamType::ReadonlySingleInput);
+ }
- template<typename T> bool is_single_output(uint index, StringRef name) const
- {
- return this->is_valid_param<T>(index, name, ParamType::SingleOutput);
- }
- bool is_single_output(uint index, StringRef name) const
- {
- return this->is_valid_param(index, name, ParamType::SingleOutput);
- }
+ template<typename T> bool is_single_output(uint index, StringRef name) const
+ {
+ return this->is_valid_param<T>(index, name, MFParamType::SingleOutput);
+ }
+ bool is_single_output(uint index, StringRef name) const
+ {
+ return this->is_valid_param(index, name, MFParamType::SingleOutput);
+ }
- template<typename T> bool is_readonly_vector_input(uint index, StringRef name) const
- {
- return this->is_valid_param<T>(index, name, ParamType::ReadonlyVectorInput);
- }
- bool is_readonly_vector_input(uint index, StringRef name) const
- {
- return this->is_valid_param(index, name, ParamType::ReadonlyVectorInput);
- }
+ template<typename T> bool is_readonly_vector_input(uint index, StringRef name) const
+ {
+ return this->is_valid_param<T>(index, name, MFParamType::ReadonlyVectorInput);
+ }
+ bool is_readonly_vector_input(uint index, StringRef name) const
+ {
+ return this->is_valid_param(index, name, MFParamType::ReadonlyVectorInput);
+ }
+
+ template<typename T> bool is_vector_output(uint index, StringRef name) const
+ {
+ return this->is_valid_param<T>(index, name, MFParamType::VectorOutput);
+ }
+ bool is_vector_output(uint index, StringRef name) const
+ {
+ return this->is_valid_param(index, name, MFParamType::VectorOutput);
+ }
+
+ bool is_mutable_vector(uint index, StringRef name) const
+ {
+ return this->is_valid_param(index, name, MFParamType::MutableVector);
+ }
- template<typename T> bool is_vector_output(uint index, StringRef name) const
- {
- return this->is_valid_param<T>(index, name, ParamType::VectorOutput);
+ private:
+ template<typename T>
+ bool is_valid_param(uint index, StringRef name, MFParamType::Category category) const
+ {
+ if (!this->is_valid_param(index, name, category)) {
+ return false;
}
- bool is_vector_output(uint index, StringRef name) const
- {
- return this->is_valid_param(index, name, ParamType::VectorOutput);
+ else if (ELEM(category, MFParamType::ReadonlySingleInput, MFParamType::SingleOutput)) {
+ return GET_TYPE<T>().is_same_or_generalization(m_param_types[index].type());
}
-
- bool is_mutable_vector(uint index, StringRef name) const
- {
- return this->is_valid_param(index, name, ParamType::MutableVector);
+ else if (ELEM(category,
+ MFParamType::ReadonlyVectorInput,
+ MFParamType::VectorOutput,
+ MFParamType::MutableVector)) {
+ return GET_TYPE<T>().is_same_or_generalization(m_param_types[index].base_type());
}
-
- private:
- template<typename T>
- bool is_valid_param(uint index, StringRef name, ParamType::Category category) const
- {
- if (!this->is_valid_param(index, name, category)) {
- return false;
- }
- else if (ELEM(category, ParamType::ReadonlySingleInput, ParamType::SingleOutput)) {
- return GET_TYPE<T>().is_same_or_generalization(m_param_types[index].type());
- }
- else if (ELEM(category,
- ParamType::ReadonlyVectorInput,
- ParamType::VectorOutput,
- ParamType::MutableVector)) {
- return GET_TYPE<T>().is_same_or_generalization(m_param_types[index].base_type());
- }
- else {
- return false;
- }
+ else {
+ return false;
}
+ }
- bool is_valid_param(uint index, StringRef name, ParamType::Category category) const
- {
- return m_param_names[index] == name && m_param_types[index].category() == category;
- }
- };
+ bool is_valid_param(uint index, Strin
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list