[Bf-blender-cvs] [ff29177a4c9] functions-experimental-refactor: make CPPType const everywhere

Jacques Lucke noreply at git.blender.org
Fri Oct 18 17:53:43 CEST 2019


Commit: ff29177a4c9e8e9e08925d093d8194e7ac099b4d
Author: Jacques Lucke
Date:   Fri Oct 18 17:47:02 2019 +0200
Branches: functions-experimental-refactor
https://developer.blender.org/rBff29177a4c9e8e9e08925d093d8194e7ac099b4d

make CPPType const everywhere

===================================================================

M	source/blender/blenkernel/BKE_cpp_type.h
M	source/blender/blenkernel/BKE_cpp_types.h
M	source/blender/blenkernel/BKE_multi_functions.h
M	source/blender/blenkernel/intern/cpp_types.cc
M	source/blender/blenkernel/intern/multi_functions.cc

===================================================================

diff --git a/source/blender/blenkernel/BKE_cpp_type.h b/source/blender/blenkernel/BKE_cpp_type.h
index b9dd946f9bc..f46491b4626 100644
--- a/source/blender/blenkernel/BKE_cpp_type.h
+++ b/source/blender/blenkernel/BKE_cpp_type.h
@@ -29,7 +29,7 @@ class CPPType {
           CopyToUninitializedF copy_to_uninitialized,
           RelocateToInitializedF relocate_to_initialized,
           RelocateToUninitializedF relocate_to_uninitialized,
-          CPPType *generalization)
+          const CPPType *generalization)
       : m_size(size),
         m_alignment(alignment),
         m_trivially_destructible(trivially_destructible),
@@ -49,21 +49,6 @@ class CPPType {
     m_alignment_mask = m_alignment - 1;
   }
 
-  CPPType(std::string name, CPPType &generalization, ConstructDefaultF construct_default)
-      : CPPType(std::move(name),
-                generalization.m_size,
-                generalization.m_alignment,
-                generalization.m_trivially_destructible,
-                construct_default,
-                generalization.m_destruct,
-                generalization.m_copy_to_initialized,
-                generalization.m_copy_to_uninitialized,
-                generalization.m_relocate_to_initialized,
-                generalization.m_relocate_to_uninitialized,
-                &generalization)
-  {
-  }
-
   virtual ~CPPType();
 
   StringRefNull name() const
@@ -81,7 +66,7 @@ class CPPType {
     return m_alignment;
   }
 
-  CPPType *generalization() const
+  const CPPType *generalization() const
   {
     return m_generalization;
   }
@@ -164,7 +149,7 @@ class CPPType {
   CopyToUninitializedF m_copy_to_uninitialized;
   RelocateToInitializedF m_relocate_to_initialized;
   RelocateToUninitializedF m_relocate_to_uninitialized;
-  CPPType *m_generalization;
+  const CPPType *m_generalization;
   std::string m_name;
 };
 
diff --git a/source/blender/blenkernel/BKE_cpp_types.h b/source/blender/blenkernel/BKE_cpp_types.h
index 0ee9c45a4f2..e20257f8799 100644
--- a/source/blender/blenkernel/BKE_cpp_types.h
+++ b/source/blender/blenkernel/BKE_cpp_types.h
@@ -8,7 +8,7 @@ namespace BKE {
 void init_data_types();
 void free_data_types();
 
-template<typename T> CPPType &GET_TYPE();
+template<typename T> const CPPType &GET_TYPE();
 
 }  // namespace BKE
 
diff --git a/source/blender/blenkernel/BKE_multi_functions.h b/source/blender/blenkernel/BKE_multi_functions.h
index 398e4e6da57..c27b190b997 100644
--- a/source/blender/blenkernel/BKE_multi_functions.h
+++ b/source/blender/blenkernel/BKE_multi_functions.h
@@ -49,37 +49,37 @@ class MultiFunction_FloatRange final : public MultiFunction {
 
 class MultiFunction_AppendToList final : public MultiFunction {
  private:
-  CPPType &m_base_type;
+  const CPPType &m_base_type;
 
  public:
-  MultiFunction_AppendToList(CPPType &base_type);
+  MultiFunction_AppendToList(const CPPType &base_type);
   void call(ArrayRef<uint> mask_indices, MFParams &params, MFContext &context) const override;
 };
 
 class MultiFunction_GetListElement final : public MultiFunction {
  private:
-  CPPType &m_base_type;
+  const CPPType &m_base_type;
 
  public:
-  MultiFunction_GetListElement(CPPType &base_type);
+  MultiFunction_GetListElement(const CPPType &base_type);
   void call(ArrayRef<uint> mask_indices, MFParams &params, MFContext &context) const override;
 };
 
 class MultiFunction_ListLength final : public MultiFunction {
  private:
-  CPPType &m_base_type;
+  const CPPType &m_base_type;
 
  public:
-  MultiFunction_ListLength(CPPType &base_type);
+  MultiFunction_ListLength(const CPPType &base_type);
   void call(ArrayRef<uint> mask_indices, MFParams &params, MFContext &context) const override;
 };
 
 class MultiFunction_CombineLists final : public MultiFunction {
  private:
-  CPPType &m_base_type;
+  const CPPType &m_base_type;
 
  public:
-  MultiFunction_CombineLists(CPPType &base_type);
+  MultiFunction_CombineLists(const CPPType &base_type);
   void call(ArrayRef<uint> mask_indices, MFParams &params, MFContext &context) const override;
 };
 
diff --git a/source/blender/blenkernel/intern/cpp_types.cc b/source/blender/blenkernel/intern/cpp_types.cc
index 01e9789bb69..4eceee97cdd 100644
--- a/source/blender/blenkernel/intern/cpp_types.cc
+++ b/source/blender/blenkernel/intern/cpp_types.cc
@@ -106,7 +106,7 @@ void init_data_types()
 }
 
 #define CPP_TYPE_GETTER(IDENTIFIER, TYPE_NAME) \
-  template<> CPPType &GET_TYPE<TYPE_NAME>() \
+  template<> const CPPType &GET_TYPE<TYPE_NAME>() \
   { \
     return *TYPE_##IDENTIFIER; \
   }
@@ -123,4 +123,4 @@ CPP_TYPE_GETTER(GenericMutableArrayRef, GenericMutableArrayRef);
 
 #undef CPP_TYPE_GETTER
 
-}  // namespace BKE
\ No newline at end of file
+}  // namespace BKE
diff --git a/source/blender/blenkernel/intern/multi_functions.cc b/source/blender/blenkernel/intern/multi_functions.cc
index 6de2d13db58..85e39d3e4cd 100644
--- a/source/blender/blenkernel/intern/multi_functions.cc
+++ b/source/blender/blenkernel/intern/multi_functions.cc
@@ -180,7 +180,8 @@ void MultiFunction_FloatRange::call(ArrayRef<uint> mask_indices,
   }
 }
 
-MultiFunction_AppendToList::MultiFunction_AppendToList(CPPType &base_type) : m_base_type(base_type)
+MultiFunction_AppendToList::MultiFunction_AppendToList(const CPPType &base_type)
+    : m_base_type(base_type)
 {
   MFSignatureBuilder signature;
   signature.mutable_vector("List", m_base_type);
@@ -200,7 +201,7 @@ void MultiFunction_AppendToList::call(ArrayRef<uint> mask_indices,
   }
 }
 
-MultiFunction_GetListElement::MultiFunction_GetListElement(CPPType &base_type)
+MultiFunction_GetListElement::MultiFunction_GetListElement(const CPPType &base_type)
     : m_base_type(base_type)
 {
   MFSignatureBuilder signature;
@@ -234,7 +235,8 @@ void MultiFunction_GetListElement::call(ArrayRef<uint> mask_indices,
   }
 }
 
-MultiFunction_ListLength::MultiFunction_ListLength(CPPType &base_type) : m_base_type(base_type)
+MultiFunction_ListLength::MultiFunction_ListLength(const CPPType &base_type)
+    : m_base_type(base_type)
 {
   MFSignatureBuilder signature;
   signature.readonly_vector_input("List", m_base_type);
@@ -254,7 +256,8 @@ void MultiFunction_ListLength::call(ArrayRef<uint> mask_indices,
   }
 }
 
-MultiFunction_CombineLists::MultiFunction_CombineLists(CPPType &base_type) : m_base_type(base_type)
+MultiFunction_CombineLists::MultiFunction_CombineLists(const CPPType &base_type)
+    : m_base_type(base_type)
 {
   MFSignatureBuilder signature;
   signature.mutable_vector("List", m_base_type);



More information about the Bf-blender-cvs mailing list