[Bf-blender-cvs] [f91bd739863] functions-experimental-refactor: remove code from blenkernel (now lives in functions2)

Jacques Lucke noreply at git.blender.org
Fri Nov 1 20:31:38 CET 2019


Commit: f91bd73986308993a29b038f1efb5ebc0053afcd
Author: Jacques Lucke
Date:   Fri Nov 1 19:51:34 2019 +0100
Branches: functions-experimental-refactor
https://developer.blender.org/rBf91bd73986308993a29b038f1efb5ebc0053afcd

remove code from blenkernel (now lives in functions2)

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

D	source/blender/blenkernel/BKE_cpp_type.h
D	source/blender/blenkernel/BKE_cpp_types.h
D	source/blender/blenkernel/BKE_generic_array_ref.h
D	source/blender/blenkernel/BKE_generic_vector_array.h
D	source/blender/blenkernel/BKE_generic_virtual_list_list_ref.h
D	source/blender/blenkernel/BKE_generic_virtual_list_ref.h
D	source/blender/blenkernel/BKE_init_stuff.h
D	source/blender/blenkernel/BKE_multi_function.h
D	source/blender/blenkernel/BKE_multi_function_network.h
D	source/blender/blenkernel/BKE_multi_functions.h
D	source/blender/blenkernel/BKE_tuple.h
M	source/blender/blenkernel/CMakeLists.txt
D	source/blender/blenkernel/intern/cpp_type.cc
D	source/blender/blenkernel/intern/cpp_types.cc
D	source/blender/blenkernel/intern/generic_array_ref.cc
D	source/blender/blenkernel/intern/init_stuff.cc
D	source/blender/blenkernel/intern/multi_function_network.cc
D	source/blender/blenkernel/intern/multi_functions.cc
D	source/blender/blenkernel/intern/tuple.cc
M	source/blender/windowmanager/intern/wm_init_exit.c

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

diff --git a/source/blender/blenkernel/BKE_cpp_type.h b/source/blender/blenkernel/BKE_cpp_type.h
deleted file mode 100644
index f46491b4626..00000000000
--- a/source/blender/blenkernel/BKE_cpp_type.h
+++ /dev/null
@@ -1,158 +0,0 @@
-#ifndef __BKE_CPP_TYPE_H__
-#define __BKE_CPP_TYPE_H__
-
-#include "BLI_string_ref.h"
-#include "BLI_utility_mixins.h"
-#include "BLI_vector.h"
-
-namespace BKE {
-
-using BLI::StringRef;
-using BLI::StringRefNull;
-
-class CPPType {
- public:
-  using ConstructDefaultF = void (*)(const CPPType *self, void *ptr);
-  using DestructF = void (*)(void *ptr);
-  using CopyToInitializedF = void (*)(const void *src, void *dst);
-  using CopyToUninitializedF = void (*)(const void *src, void *dst);
-  using RelocateToInitializedF = void (*)(void *src, void *dst);
-  using RelocateToUninitializedF = void (*)(void *src, void *dst);
-
-  CPPType(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,
-          const CPPType *generalization)
-      : 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),
-        m_relocate_to_initialized(relocate_to_initialized),
-        m_relocate_to_uninitialized(relocate_to_uninitialized),
-        m_generalization(generalization),
-        m_name(name)
-  {
-    BLI_assert(is_power_of_2_i(m_alignment));
-    BLI_assert(generalization == nullptr ||
-               (generalization->size() == size && generalization->alignment() <= alignment));
-
-    m_alignment_mask = m_alignment - 1;
-  }
-
-  virtual ~CPPType();
-
-  StringRefNull name() const
-  {
-    return m_name;
-  }
-
-  uint size() const
-  {
-    return m_size;
-  }
-
-  uint alignment() const
-  {
-    return m_alignment;
-  }
-
-  const CPPType *generalization() const
-  {
-    return m_generalization;
-  }
-
-  bool trivially_destructible() const
-  {
-    return m_trivially_destructible;
-  }
-
-  bool pointer_has_valid_alignment(const void *ptr) const
-  {
-    return (POINTER_AS_UINT(ptr) & m_alignment_mask) == 0;
-  }
-
-  void construct_default(void *ptr) const
-  {
-    BLI_assert(this->pointer_has_valid_alignment(ptr));
-
-    m_construct_default(this, ptr);
-  }
-
-  void destruct(void *ptr) const
-  {
-    BLI_assert(this->pointer_has_valid_alignment(ptr));
-
-    m_destruct(ptr);
-  }
-
-  void copy_to_initialized(const void *src, void *dst) const
-  {
-    BLI_assert(this->pointer_has_valid_alignment(src));
-    BLI_assert(this->pointer_has_valid_alignment(dst));
-
-    m_copy_to_initialized(src, dst);
-  }
-
-  void copy_to_uninitialized(const void *src, void *dst) const
-  {
-    BLI_assert(this->pointer_has_valid_alignment(src));
-    BLI_assert(this->pointer_has_valid_alignment(dst));
-
-    m_copy_to_uninitialized(src, dst);
-  }
-
-  void relocate_to_initialized(void *src, void *dst) const
-  {
-    BLI_assert(this->pointer_has_valid_alignment(src));
-    BLI_assert(this->pointer_has_valid_alignment(dst));
-
-    m_relocate_to_initialized(src, dst);
-  }
-
-  void relocate_to_uninitialized(void *src, void *dst) const
-  {
-    BLI_assert(this->pointer_has_valid_alignment(src));
-    BLI_assert(this->pointer_has_valid_alignment(dst));
-
-    m_relocate_to_uninitialized(src, dst);
-  }
-
-  bool is_same_or_generalization(const CPPType &other) const
-  {
-    if (&other == this) {
-      return true;
-    }
-    if (m_generalization == nullptr) {
-      return false;
-    }
-    return m_generalization->is_same_or_generalization(other);
-  }
-
- private:
-  uint m_size;
-  uint m_alignment;
-  uint m_alignment_mask;
-  bool m_trivially_destructible;
-  ConstructDefaultF m_construct_default;
-  DestructF m_destruct;
-  CopyToInitializedF m_copy_to_initialized;
-  CopyToUninitializedF m_copy_to_uninitialized;
-  RelocateToInitializedF m_relocate_to_initialized;
-  RelocateToUninitializedF m_relocate_to_uninitialized;
-  const CPPType *m_generalization;
-  std::string m_name;
-};
-
-}  // namespace BKE
-
-#endif /* __BKE_CPP_TYPE_H__ */
diff --git a/source/blender/blenkernel/BKE_cpp_types.h b/source/blender/blenkernel/BKE_cpp_types.h
deleted file mode 100644
index e20257f8799..00000000000
--- a/source/blender/blenkernel/BKE_cpp_types.h
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifndef __BKE_CPP_TYPES_H__
-#define __BKE_CPP_TYPES_H__
-
-#include "BKE_cpp_type.h"
-
-namespace BKE {
-
-void init_data_types();
-void free_data_types();
-
-template<typename T> const CPPType &GET_TYPE();
-
-}  // namespace BKE
-
-#endif /* __BKE_CPP_TYPES_H__ */
diff --git a/source/blender/blenkernel/BKE_generic_array_ref.h b/source/blender/blenkernel/BKE_generic_array_ref.h
deleted file mode 100644
index d5ebe17516c..00000000000
--- a/source/blender/blenkernel/BKE_generic_array_ref.h
+++ /dev/null
@@ -1,146 +0,0 @@
-#ifndef __BKE_GENERIC_ARRAY_REF_H__
-#define __BKE_GENERIC_ARRAY_REF_H__
-
-#include "BKE_cpp_type.h"
-#include "BKE_cpp_types.h"
-
-#include "BLI_array_ref.h"
-
-namespace BKE {
-
-using BLI::ArrayRef;
-using BLI::MutableArrayRef;
-
-class GenericArrayRef {
- private:
-  const CPPType *m_type;
-  const void *m_buffer;
-  uint m_size;
-
- public:
-  GenericArrayRef(const CPPType &type) : GenericArrayRef(type, nullptr, 0)
-  {
-  }
-
-  GenericArrayRef(const CPPType &type, const void *buffer, uint size)
-      : m_type(&type), m_buffer(buffer), m_size(size)
-  {
-    BLI_assert(buffer != nullptr || size == 0);
-    BLI_assert(type.pointer_has_valid_alignment(buffer));
-  }
-
-  const CPPType &type() const
-  {
-    return *m_type;
-  }
-
-  uint size() const
-  {
-    return m_size;
-  }
-
-  const void *buffer() const
-  {
-    return m_buffer;
-  }
-
-  const void *operator[](uint index) const
-  {
-    BLI_assert(index < m_size);
-    return POINTER_OFFSET(m_buffer, m_type->size() * index);
-  }
-
-  template<typename T> ArrayRef<T> get_ref() const
-  {
-    BLI_assert(GET_TYPE<T>().is_same_or_generalization(*m_type));
-    return ArrayRef<T>((const T *)m_buffer, m_size);
-  }
-};
-
-class GenericMutableArrayRef {
- private:
-  const CPPType *m_type;
-  void *m_buffer;
-  uint m_size;
-
- public:
-  GenericMutableArrayRef(const CPPType &type) : GenericMutableArrayRef(type, nullptr, 0)
-  {
-  }
-
-  GenericMutableArrayRef(const CPPType &type, void *buffer, uint size)
-      : m_type(&type), m_buffer(buffer), m_size(size)
-  {
-    BLI_assert(buffer != nullptr || size == 0);
-    BLI_assert(type.pointer_has_valid_alignment(buffer));
-  }
-
-  template<typename T>
-  GenericMutableArrayRef(ArrayRef<T> array)
-      : GenericMutableArrayRef(GET_TYPE<T>(), (void *)array.begin(), array.size())
-  {
-  }
-
-  operator GenericArrayRef() const
-  {
-    return GenericArrayRef(*m_type, m_buffer, m_size);
-  }
-
-  void destruct_all()
-  {
-    if (m_type->trivially_destructible()) {
-      return;
-    }
-    for (uint i = 0; i < m_size; i++) {
-      m_type->destruct((*this)[i]);
-    }
-  }
-
-  void destruct_indices(ArrayRef<uint> indices)
-  {
-    if (m_type->trivially_destructible()) {
-      return;
-    }
-    for (uint i : indices) {
-      m_type->destruct((*this)[i]);
-    }
-  }
-
-  const CPPType &type() const
-  {
-    return *m_type;
-  }
-
-  void *buffer()
-  {
-    return m_buffer;
-  }
-
-  uint size() const
-  {
-    return m_size;
-  }
-
-  void copy_in__uninitialized(uint index, const void *src)
-  {
-    BLI_assert(index < m_size);
-    void *dst = POINTER_OFFSET(m_buffer, m_type->size() * index);
-    m_type->copy_to_uninitialized(src, dst);
-  }
-
-  void *operator[](uint index)
-  {
-    BLI_assert(index < m_size);
-    return POINTER_OFFSET(m_buffer, m_type->size() * index);
-  }
-
-  template<typename T> MutableArrayRef<T> get_ref()
-  {
-    BLI_assert(GET_TYPE<T>().is_same_or_generalization(*m_type));
-    return MutableArrayRef<T>((T *)m_buffer, m_size);
-  }
-};
-
-}  // namespace BKE
-
-#endif /* __BKE_GENERIC_ARRAY_REF_H__ */
diff --git a/source/blender/blenkernel/BKE_generic_vector_array.h b/source/blender/blenkernel/BKE_generic_vector_array.h
deleted file mode 100644
index f4b25370a69..00000000000
--- a/source/blender/blenkernel/BKE_generic_vector_array.h
+++ /dev/null
@@ -1,204 +0,0 @@
-#ifndef __BKE_GENERIC_MULTI_VECTOR_H__
-#define __BKE_GENERIC_MULTI_VECTOR_H__
-
-#include "BKE_cpp_type.h"
-#include "BKE_cpp_types.h"
-#include "BKE_generic_array_ref.h"
-#include "BKE_generic_virtual_list_list_ref.h"
-
-#include "BLI_array_ref.h"
-#include "BLI_index_range.h"
-#include "BLI_monotonic_allocator.h"
-
-namespace BKE {
-
-using BLI::ArrayRef;
-using BLI::IndexRange;
-using BLI::MonotonicAllocator;
-using BLI::MutableArrayRef;
-
-class GenericVectorArray : BLI::NonCopyable, BLI::NonMovable {
- private:
-  BLI::GuardedAllocator m_slices_allocator;
-  MonotonicAllocator<> m_elements_allocator;
-  const CPPType &m_type;
-  void **m_starts;
-  uint *m_lengths;
-  uint *m_capacities;
-  uint m_array_size;
-  uint m_element_size;
-
- public:
-  GenericVectorArray() = delete;
-
-  GenericVectorArray(const CPPType &type, uint array_size)
-      : m_type(type), m_array_size(array_size), m_element_size(type.size())
-  {
-    uint byte_size__starts = sizeof(void *) * array_size;
-    m_starts = (void **)m_slices_allocator.allocate(byte_size__starts, __func__);
-    memset((void *)m_starts, 0, byte_size__starts);
-
-    uint byte_size__lengths = sizeof(uint) * array_size;
-    m_lengths = (uint *)m_slices_allocator.allocate(byte_size__lengths, __func__);
-    memset((void *)m_lengths, 0, byte_size__lengths);
-
-    uint byte_size__capacities = sizeof(uint) * array_size;
-    m_capacities = (uint *)m_slices_allocator.allocate(byte_size__capacities, __func__);
-    memset((void *)m_capacities, 0, byte_size__capacities);
-  }
-
-  ~Gener

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list