[Bf-blender-cvs] [55d0c806117] functions-experimental-refactor: add more type attributes

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


Commit: 55d0c80611789c6e840f1e8993b59c26cda55d45
Author: Jacques Lucke
Date:   Tue Oct 1 20:19:16 2019 +0200
Branches: functions-experimental-refactor
https://developer.blender.org/rB55d0c80611789c6e840f1e8993b59c26cda55d45

add more type attributes

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

M	source/blender/blenkernel/BKE_type_cpp.h
M	source/blender/blenkernel/intern/types_cpp.cc

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

diff --git a/source/blender/blenkernel/BKE_type_cpp.h b/source/blender/blenkernel/BKE_type_cpp.h
index 4c183ddc29c..f152b7a9122 100644
--- a/source/blender/blenkernel/BKE_type_cpp.h
+++ b/source/blender/blenkernel/BKE_type_cpp.h
@@ -20,13 +20,19 @@ class TypeCPP final {
   using RelocateToUninitializedF = void (*)(void *src, void *dst);
 
   TypeCPP(std::string name,
+          uint size,
+          uint alignment,
+          bool trivially_destructible,
           ConstructDefaultF construct_default,
           DestructF destruct,
           CopyToInitializedF copy_to_initialized,
           CopyToUninitializedF copy_to_uninitialized,
           RelocateToInitializedF relocate_to_initialized,
           RelocateToUninitializedF relocate_to_uninitialized)
-      : m_construct_default(construct_default),
+      : m_size(size),
+        m_alignment(alignment),
+        m_trivially_destructible(trivially_destructible),
+        m_construct_default(construct_default),
         m_destruct(destruct),
         m_copy_to_initialized(copy_to_initialized),
         m_copy_to_uninitialized(copy_to_uninitialized),
@@ -72,6 +78,9 @@ class TypeCPP final {
   }
 
  private:
+  uint m_size;
+  uint m_alignment;
+  bool m_trivially_destructible;
   ConstructDefaultF m_construct_default;
   DestructF m_destruct;
   CopyToInitializedF m_copy_to_initialized;
diff --git a/source/blender/blenkernel/intern/types_cpp.cc b/source/blender/blenkernel/intern/types_cpp.cc
index 242d6951650..32196fd5ac7 100644
--- a/source/blender/blenkernel/intern/types_cpp.cc
+++ b/source/blender/blenkernel/intern/types_cpp.cc
@@ -3,9 +3,12 @@
 #include "DNA_object_types.h"
 
 #include "BLI_math_cxx.h"
+#include "BLI_vector.h"
 
 namespace BKE {
 
+using BLI::Vector;
+
 static Vector<TypeCPP *, 4, BLI::RawAllocator> allocated_types;
 
 void free_data_types()
@@ -56,6 +59,9 @@ void init_data_types()
 
 #define CPP_TYPE_CONSTRUCTION(IDENTIFIER, TYPE_NAME) \
   TYPE_##IDENTIFIER = new TypeCPP(STRINGIFY(IDENTIFIER), \
+                                  sizeof(TYPE_NAME), \
+                                  alignof(TYPE_NAME), \
+                                  std::is_trivially_destructible<TYPE_NAME>::value, \
                                   ConstructDefault_CB<TYPE_NAME>, \
                                   Destruct_CB<TYPE_NAME>, \
                                   CopyToInitialized_CB<TYPE_NAME>, \



More information about the Bf-blender-cvs mailing list