14#ifdef DNA_DEPRECATED_ALLOW
16# define DNA_DEPRECATED
18# ifndef DNA_DEPRECATED
20# define DNA_DEPRECATED __attribute__((deprecated))
23# define DNA_DEPRECATED
29# define DNA_PRIVATE_ATTR __attribute__((deprecated))
31# define DNA_PRIVATE_ATTR
35#ifdef DNA_DEPRECATED_ALLOW
36# define DNA_DEPRECATED_GCC_POISON 0
40# define DNA_DEPRECATED_GCC_POISON 1
42# define DNA_DEPRECATED_GCC_POISON 0
66# define DNA_DEFINE_CXX_METHODS(class_name)
75namespace blender::dna::internal {
77template<
class T>
class ShallowDataConstRef {
79 constexpr explicit ShallowDataConstRef(
const T &ref) : ref_(ref) {}
81 inline const T *get_pointer()
const
90class ShallowZeroInitializeTag {};
94# define DNA_DEFINE_CXX_METHODS(class_name) \
95 class_name() = default; \
96 ~class_name() = default; \
98 class_name(const class_name &other) = delete; \
99 class_name(class_name &&other) noexcept = delete; \
100 class_name &operator=(const class_name &other) = delete; \
101 class_name &operator=(class_name &&other) = delete; \
104 class_name(const blender::dna::internal::ShallowDataConstRef<class_name> ref) : class_name() \
106 _DNA_internal_memcpy(this, ref.get_pointer(), sizeof(class_name)); \
108 class_name &operator=(const blender::dna::internal::ShallowDataConstRef<class_name> ref) \
110 if (this != ref.get_pointer()) { \
111 _DNA_internal_memcpy(this, ref.get_pointer(), sizeof(class_name)); \
116 class_name(const blender::dna::internal::ShallowZeroInitializeTag ) : class_name() \
118 _DNA_internal_memzero(this, sizeof(class_name)); \
120 class_name &operator=(const blender::dna::internal::ShallowZeroInitializeTag ) \
122 _DNA_internal_memzero(this, sizeof(class_name)); \
137[[nodiscard]]
inline internal::ShallowDataConstRef<T> shallow_copy(
const T &other)
139 return internal::ShallowDataConstRef(other);
142template<
typename T>
inline void shallow_copy_array(T *dst,
const T *src,
const int64_t size)
149[[nodiscard]]
inline internal::ShallowZeroInitializeTag shallow_zero_initialize()
151 return internal::ShallowZeroInitializeTag();
154template<
typename T>
inline void shallow_swap(T &a, T &
b)
local_group_size(16, 16) .push_constant(Type b
void _DNA_internal_memzero(void *dst, size_t size)
void _DNA_internal_swap(void *a, void *b, size_t size)
void _DNA_internal_memcpy(void *dst, const void *src, size_t size)