[Bf-blender-cvs] [cfaa0e566aa] functions-experimental-refactor: rename TypeCPP to CPPType

Jacques Lucke noreply at git.blender.org
Tue Oct 15 15:56:20 CEST 2019


Commit: cfaa0e566aa1ed56716ff44322f5bb5fd68b5131
Author: Jacques Lucke
Date:   Tue Oct 8 10:40:44 2019 +0200
Branches: functions-experimental-refactor
https://developer.blender.org/rBcfaa0e566aa1ed56716ff44322f5bb5fd68b5131

rename TypeCPP to CPPType

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

R091	source/blender/blenkernel/BKE_type_cpp.h	source/blender/blenkernel/BKE_cpp_type.h
R071	source/blender/blenkernel/BKE_types_cpp.h	source/blender/blenkernel/BKE_cpp_types.h
M	source/blender/blenkernel/BKE_function_cpp.h
M	source/blender/blenkernel/BKE_generic_array_ref.h
M	source/blender/blenkernel/BKE_tuple.h
M	source/blender/blenkernel/CMakeLists.txt
A	source/blender/blenkernel/intern/cpp_type.cc
R085	source/blender/blenkernel/intern/types_cpp.cc	source/blender/blenkernel/intern/cpp_types.cc
M	source/blender/blenkernel/intern/function_cpp.cc
M	source/blender/blenkernel/intern/generic_array_ref.cc
M	source/blender/blenkernel/intern/tuple.cc
D	source/blender/blenkernel/intern/type_cpp.cc
M	source/blender/makesrna/intern/makesrna.c

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

diff --git a/source/blender/blenkernel/BKE_type_cpp.h b/source/blender/blenkernel/BKE_cpp_type.h
similarity index 91%
rename from source/blender/blenkernel/BKE_type_cpp.h
rename to source/blender/blenkernel/BKE_cpp_type.h
index c68dceda287..9c762b21121 100644
--- a/source/blender/blenkernel/BKE_type_cpp.h
+++ b/source/blender/blenkernel/BKE_cpp_type.h
@@ -10,16 +10,16 @@ namespace BKE {
 using BLI::StringRef;
 using BLI::StringRefNull;
 
-class TypeCPP {
+class CPPType {
  public:
-  using ConstructDefaultF = void (*)(const TypeCPP *self, void *ptr);
+  using ConstructDefaultF = void (*)(const CPPType *self, void *ptr);
   using DestructF = void (*)(void *ptr);
   using CopyToInitializedF = void (*)(void *src, void *dst);
   using CopyToUninitializedF = void (*)(void *src, void *dst);
   using RelocateToInitializedF = void (*)(void *src, void *dst);
   using RelocateToUninitializedF = void (*)(void *src, void *dst);
 
-  TypeCPP(std::string name,
+  CPPType(std::string name,
           uint size,
           uint alignment,
           bool trivially_destructible,
@@ -29,7 +29,7 @@ class TypeCPP {
           CopyToUninitializedF copy_to_uninitialized,
           RelocateToInitializedF relocate_to_initialized,
           RelocateToUninitializedF relocate_to_uninitialized,
-          TypeCPP *generalization)
+          CPPType *generalization)
       : m_size(size),
         m_alignment(alignment),
         m_trivially_destructible(trivially_destructible),
@@ -49,8 +49,8 @@ class TypeCPP {
     m_alignment_mask = m_alignment - 1;
   }
 
-  TypeCPP(std::string name, TypeCPP &generalization, ConstructDefaultF construct_default)
-      : TypeCPP(std::move(name),
+  CPPType(std::string name, CPPType &generalization, ConstructDefaultF construct_default)
+      : CPPType(std::move(name),
                 generalization.m_size,
                 generalization.m_alignment,
                 generalization.m_trivially_destructible,
@@ -64,7 +64,7 @@ class TypeCPP {
   {
   }
 
-  virtual ~TypeCPP();
+  virtual ~CPPType();
 
   StringRefNull name() const
   {
@@ -81,7 +81,7 @@ class TypeCPP {
     return m_alignment;
   }
 
-  TypeCPP *generalization() const
+  CPPType *generalization() const
   {
     return m_generalization;
   }
@@ -142,7 +142,7 @@ class TypeCPP {
     m_relocate_to_uninitialized(src, dst);
   }
 
-  bool is_same_or_generalization(const TypeCPP &other) const
+  bool is_same_or_generalization(const CPPType &other) const
   {
     if (&other == this) {
       return true;
@@ -164,7 +164,7 @@ class TypeCPP {
   CopyToUninitializedF m_copy_to_uninitialized;
   RelocateToInitializedF m_relocate_to_initialized;
   RelocateToUninitializedF m_relocate_to_uninitialized;
-  TypeCPP *m_generalization;
+  CPPType *m_generalization;
   std::string m_name;
 };
 
diff --git a/source/blender/blenkernel/BKE_types_cpp.h b/source/blender/blenkernel/BKE_cpp_types.h
similarity index 71%
rename from source/blender/blenkernel/BKE_types_cpp.h
rename to source/blender/blenkernel/BKE_cpp_types.h
index 4f5c97c1997..0f2fc5c9ee4 100644
--- a/source/blender/blenkernel/BKE_types_cpp.h
+++ b/source/blender/blenkernel/BKE_cpp_types.h
@@ -1,14 +1,14 @@
 #ifndef __BKE_DATA_TYPES_H__
 #define __BKE_DATA_TYPES_H__
 
-#include "BKE_type_cpp.h"
+#include "BKE_cpp_type.h"
 
 namespace BKE {
 
 void init_data_types();
 void free_data_types();
 
-template<typename T> TypeCPP &get_type_cpp();
+template<typename T> CPPType &get_cpp_type();
 
 }  // namespace BKE
 
diff --git a/source/blender/blenkernel/BKE_function_cpp.h b/source/blender/blenkernel/BKE_function_cpp.h
index 508ba52da8e..4b8240bc4f9 100644
--- a/source/blender/blenkernel/BKE_function_cpp.h
+++ b/source/blender/blenkernel/BKE_function_cpp.h
@@ -1,7 +1,7 @@
 #ifndef __BKE_FUNCTION_CPP_H__
 #define __BKE_FUNCTION_CPP_H__
 
-#include "BKE_type_cpp.h"
+#include "BKE_cpp_type.h"
 #include "BKE_tuple.h"
 
 #include "BLI_vector.h"
@@ -17,8 +17,8 @@ class FunctionCPP;
 
 struct SignatureData {
   std::string name;
-  Vector<TypeCPP *> input_types;
-  Vector<TypeCPP *> output_types;
+  Vector<CPPType *> input_types;
+  Vector<CPPType *> output_types;
   Vector<std::string> input_names;
   Vector<std::string> output_names;
 };
@@ -35,13 +35,13 @@ class SignatureBuilderCPP {
     m_data.name = name;
   }
 
-  void add_input(StringRef name, TypeCPP &type)
+  void add_input(StringRef name, CPPType &type)
   {
     m_data.input_names.append(name);
     m_data.input_types.append(&type);
   }
 
-  void add_output(StringRef name, TypeCPP &type)
+  void add_output(StringRef name, CPPType &type)
   {
     m_data.output_names.append(name);
     m_data.input_types.append(&type);
@@ -62,12 +62,12 @@ class FunctionCPP {
     return m_signature.name;
   }
 
-  ArrayRef<TypeCPP *> input_types() const
+  ArrayRef<CPPType *> input_types() const
   {
     return m_signature.input_types;
   }
 
-  ArrayRef<TypeCPP *> output_types() const
+  ArrayRef<CPPType *> output_types() const
   {
     return m_signature.output_types;
   }
diff --git a/source/blender/blenkernel/BKE_generic_array_ref.h b/source/blender/blenkernel/BKE_generic_array_ref.h
index 2eaa7991e49..e84efa5edf9 100644
--- a/source/blender/blenkernel/BKE_generic_array_ref.h
+++ b/source/blender/blenkernel/BKE_generic_array_ref.h
@@ -1,8 +1,8 @@
 #ifndef __BKE_GENERIC_ARRAY_REF_H__
 #define __BKE_GENERIC_ARRAY_REF_H__
 
-#include "BKE_type_cpp.h"
-#include "BKE_types_cpp.h"
+#include "BKE_cpp_type.h"
+#include "BKE_cpp_types.h"
 
 #include "BLI_array_ref.h"
 
@@ -12,16 +12,16 @@ using BLI::ArrayRef;
 
 class GenericArrayRef {
  private:
-  const TypeCPP *m_type;
+  const CPPType *m_type;
   void *m_buffer;
   uint m_size;
 
  public:
-  GenericArrayRef(const TypeCPP *type) : GenericArrayRef(type, nullptr, 0)
+  GenericArrayRef(const CPPType *type) : GenericArrayRef(type, nullptr, 0)
   {
   }
 
-  GenericArrayRef(const TypeCPP *type, void *buffer, uint size)
+  GenericArrayRef(const CPPType *type, void *buffer, uint size)
       : m_type(type), m_buffer(buffer), m_size(size)
   {
     BLI_assert(type != nullptr);
@@ -36,26 +36,26 @@ class GenericArrayRef {
 
   template<typename T> ArrayRef<T> get_ref() const
   {
-    BLI_assert(get_type_cpp<T>().is_same_or_generalization(m_type));
+    BLI_assert(get_cpp_type<T>().is_same_or_generalization(m_type));
     return ArrayRef<T>((const T *)m_buffer, m_size);
   }
 };
 
-class ArrayRefTypeCPP : public TypeCPP {
+class ArrayRefCPPType : public CPPType {
  private:
-  TypeCPP &m_base_type;
+  CPPType &m_base_type;
 
  public:
-  ArrayRefTypeCPP(TypeCPP &base_type, TypeCPP &generalization);
+  ArrayRefCPPType(CPPType &base_type, CPPType &generalization);
 
-  static void ConstructDefaultCB(const TypeCPP *self, void *ptr)
+  static void ConstructDefaultCB(const CPPType *self, void *ptr)
   {
-    const ArrayRefTypeCPP *self_ = dynamic_cast<const ArrayRefTypeCPP *>(self);
+    const ArrayRefCPPType *self_ = dynamic_cast<const ArrayRefCPPType *>(self);
     new (ptr) GenericArrayRef(&self_->m_base_type);
   }
 };
 
-ArrayRefTypeCPP &get_generic_array_ref_cpp_type(TypeCPP &base);
+ArrayRefCPPType &get_generic_array_ref_cpp_type(CPPType &base);
 
 }  // namespace BKE
 
diff --git a/source/blender/blenkernel/BKE_tuple.h b/source/blender/blenkernel/BKE_tuple.h
index cfbe3ab3ce0..8a50e8f66b3 100644
--- a/source/blender/blenkernel/BKE_tuple.h
+++ b/source/blender/blenkernel/BKE_tuple.h
@@ -3,8 +3,8 @@
 
 #include "BLI_vector.h"
 
-#include "BKE_type_cpp.h"
-#include "BKE_types_cpp.h"
+#include "BKE_cpp_type.h"
+#include "BKE_cpp_types.h"
 
 namespace BKE {
 
@@ -14,7 +14,7 @@ using BLI::Vector;
 class TupleInfo : BLI::NonCopyable, BLI::NonMovable {
  private:
   Vector<uint> m_offsets;
-  Vector<TypeCPP *> m_types;
+  Vector<CPPType *> m_types;
   uint m_alignment;
   uintptr_t m_do_align_mask;
   uint m_size__data;
@@ -23,14 +23,14 @@ class TupleInfo : BLI::NonCopyable, BLI::NonMovable {
   bool m_all_trivially_destructible;
 
  public:
-  TupleInfo(Vector<TypeCPP *> types);
+  TupleInfo(Vector<CPPType *> types);
 
-  ArrayRef<TypeCPP *> types() const
+  ArrayRef<CPPType *> types() const
   {
     return m_types;
   }
 
-  TypeCPP &type_at_index(uint index) const
+  CPPType &type_at_index(uint index) const
   {
     return *m_types[index];
   }
@@ -85,8 +85,8 @@ class TupleInfo : BLI::NonCopyable, BLI::NonMovable {
 
   template<typename T> bool element_has_type(uint index) const
   {
-    TypeCPP *expected_type = m_types[index];
-    TypeCPP *actual_type == get_type_cpp<T>();
+    CPPType *expected_type = m_types[index];
+    CPPType *actual_type == get_cpp_type<T>();
     return expected_type == actual_type;
   }
 };
@@ -145,7 +145,7 @@ class TupleRef {
     BLI_assert(src != nullptr);
 
     void *dst = this->element_ptr(index);
-    TypeCPP &type = m_info->type_at_index(index);
+    CPPType &type = m_info->type_at_index(index);
 
     if (m_init[index]) {
       type.copy_to_initialized(src, dst);
@@ -178,7 +178,7 @@ class TupleRef {
     BLI_assert(src != nullptr);
 
     void *dst = this->element_ptr(index);
-    TypeCPP &type = m_info->type_at_index(index);
+    CPPType &type = m_info->type_at_index(index);
 
     if (m_init[index]) {
       type.relocate_to_initialized(src, dst);
@@ -226,7 +226,7 @@ class TupleRef {
     BLI_assert(dst != nullptr);
 
     void *src = this->element_ptr(index);
-    TypeCPP &type = m_info->type_at_index(index);
+    CPPType &type = m_info->type_at_index(index);
 
     type.relocate_to_initialized(src, dst);
     m_init[index] = false;
@@ -239,7 +239,7 @@ class TupleRef {
     BLI_assert(dst != nullptr);
 
     void *src = this->element_ptr(index);
-    TypeCPP &type = m_info->type_at_index(index);
+    CPPType &type = m_info->type_at_index(index);
 
     type.relocate_to_uninitialized(src, dst);
     m_init[index] = false;
@@ -251,7 +251,7 @@ class TupleRef {
     return this->copy_out<T>(index);
   }
 
-  template<typename T> T get_type_cpp(uint index) const
+  template<typename T> T get_cpp_type(uint index) const
   {
     BLI_STATIC_ASSERT(std::is_trivial<T>::value, "can only be used with trivial types");
     return this->copy_out<T>(index);
@@ -264,7 +264,7 @@ class TupleRef {
 
     void *src = from.element_pt

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list