diff options
author | Jacques Lucke <jacques@blender.org> | 2020-07-03 15:20:42 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2020-07-03 15:20:42 +0300 |
commit | 5fbf70b0d0c5a387d01bba4b4d536d166e16ac0e (patch) | |
tree | 49b23dfe3d2181390c96ea58510bf510e0018da2 /source | |
parent | d64803f63b4311b0abb93542a907e97b47493e9f (diff) |
Cleanup: use trailing underscore for non-public data members
Diffstat (limited to 'source')
16 files changed, 678 insertions, 679 deletions
diff --git a/source/blender/functions/FN_array_spans.hh b/source/blender/functions/FN_array_spans.hh index acd3e921b50..139b949e55a 100644 --- a/source/blender/functions/FN_array_spans.hh +++ b/source/blender/functions/FN_array_spans.hh @@ -40,8 +40,8 @@ enum class VArraySpanCategory { template<typename T> class VArraySpanBase { protected: - uint m_virtual_size; - VArraySpanCategory m_category; + uint virtual_size_; + VArraySpanCategory category_; union { struct { @@ -52,16 +52,16 @@ template<typename T> class VArraySpanBase { const T *const *starts; const uint *sizes; } starts_and_sizes; - } m_data; + } data_; public: bool is_single_array() const { - switch (m_category) { + switch (category_) { case VArraySpanCategory::SingleArray: return true; case VArraySpanCategory::StartsAndSizes: - return m_virtual_size == 1; + return virtual_size_ == 1; } BLI_assert(false); return false; @@ -69,12 +69,12 @@ template<typename T> class VArraySpanBase { bool is_empty() const { - return this->m_virtual_size == 0; + return this->virtual_size_ == 0; } uint size() const { - return this->m_virtual_size; + return this->virtual_size_; } }; @@ -94,38 +94,38 @@ template<typename T> class VArraySpan : public VArraySpanBase<T> { public: VArraySpan() { - this->m_virtual_size = 0; - this->m_category = VArraySpanCategory::StartsAndSizes; - this->m_data.starts_and_sizes.starts = nullptr; - this->m_data.starts_and_sizes.sizes = nullptr; + this->virtual_size_ = 0; + this->category_ = VArraySpanCategory::StartsAndSizes; + this->data_.starts_and_sizes.starts = nullptr; + this->data_.starts_and_sizes.sizes = nullptr; } VArraySpan(Span<T> span, uint virtual_size) { - this->m_virtual_size = virtual_size; - this->m_category = VArraySpanCategory::SingleArray; - this->m_data.single_array.start = span.data(); - this->m_data.single_array.size = span.size(); + this->virtual_size_ = virtual_size; + this->category_ = VArraySpanCategory::SingleArray; + this->data_.single_array.start = span.data(); + this->data_.single_array.size = span.size(); } VArraySpan(Span<const T *> starts, Span<uint> sizes) { BLI_assert(starts.size() == sizes.size()); - this->m_virtual_size = starts.size(); - this->m_category = VArraySpanCategory::StartsAndSizes; - this->m_data.starts_and_sizes.starts = starts.begin(); - this->m_data.starts_and_sizes.sizes = sizes.begin(); + this->virtual_size_ = starts.size(); + this->category_ = VArraySpanCategory::StartsAndSizes; + this->data_.starts_and_sizes.starts = starts.begin(); + this->data_.starts_and_sizes.sizes = sizes.begin(); } VSpan<T> operator[](uint index) const { - BLI_assert(index < this->m_virtual_size); - switch (this->m_category) { + BLI_assert(index < this->virtual_size_); + switch (this->category_) { case VArraySpanCategory::SingleArray: - return VSpan<T>(Span<T>(this->m_data.single_array.start, this->m_data.single_array.size)); + return VSpan<T>(Span<T>(this->data_.single_array.start, this->data_.single_array.size)); case VArraySpanCategory::StartsAndSizes: - return VSpan<T>(Span<T>(this->m_data.starts_and_sizes.starts[index], - this->m_data.starts_and_sizes.sizes[index])); + return VSpan<T>(Span<T>(this->data_.starts_and_sizes.starts[index], + this->data_.starts_and_sizes.sizes[index])); } BLI_assert(false); return {}; @@ -138,68 +138,68 @@ template<typename T> class VArraySpan : public VArraySpanBase<T> { */ class GVArraySpan : public VArraySpanBase<void> { private: - const CPPType *m_type; + const CPPType *type_; GVArraySpan() = default; public: GVArraySpan(const CPPType &type) { - this->m_type = &type; - this->m_virtual_size = 0; - this->m_category = VArraySpanCategory::StartsAndSizes; - this->m_data.starts_and_sizes.starts = nullptr; - this->m_data.starts_and_sizes.sizes = nullptr; + this->type_ = &type; + this->virtual_size_ = 0; + this->category_ = VArraySpanCategory::StartsAndSizes; + this->data_.starts_and_sizes.starts = nullptr; + this->data_.starts_and_sizes.sizes = nullptr; } GVArraySpan(GSpan array, uint virtual_size) { - this->m_type = &array.type(); - this->m_virtual_size = virtual_size; - this->m_category = VArraySpanCategory::SingleArray; - this->m_data.single_array.start = array.buffer(); - this->m_data.single_array.size = array.size(); + this->type_ = &array.type(); + this->virtual_size_ = virtual_size; + this->category_ = VArraySpanCategory::SingleArray; + this->data_.single_array.start = array.buffer(); + this->data_.single_array.size = array.size(); } GVArraySpan(const CPPType &type, Span<const void *> starts, Span<uint> sizes) { BLI_assert(starts.size() == sizes.size()); - this->m_type = &type; - this->m_virtual_size = starts.size(); - this->m_category = VArraySpanCategory::StartsAndSizes; - this->m_data.starts_and_sizes.starts = (void **)starts.begin(); - this->m_data.starts_and_sizes.sizes = sizes.begin(); + this->type_ = &type; + this->virtual_size_ = starts.size(); + this->category_ = VArraySpanCategory::StartsAndSizes; + this->data_.starts_and_sizes.starts = (void **)starts.begin(); + this->data_.starts_and_sizes.sizes = sizes.begin(); } template<typename T> GVArraySpan(VArraySpan<T> other) { - this->m_type = &CPPType::get<T>(); + this->type_ = &CPPType::get<T>(); memcpy(this, &other, sizeof(VArraySpanBase<void>)); } const CPPType &type() const { - return *this->m_type; + return *this->type_; } template<typename T> VArraySpan<T> typed() const { - BLI_assert(m_type->is<T>()); + BLI_assert(type_->is<T>()); return VArraySpan<T>(*this); } GVSpan operator[](uint index) const { - BLI_assert(index < m_virtual_size); - switch (m_category) { + BLI_assert(index < virtual_size_); + switch (category_) { case VArraySpanCategory::SingleArray: - return GVSpan(GSpan(*m_type, m_data.single_array.start, m_data.single_array.size)); + return GVSpan(GSpan(*type_, data_.single_array.start, data_.single_array.size)); case VArraySpanCategory::StartsAndSizes: return GVSpan(GSpan( - *m_type, m_data.starts_and_sizes.starts[index], m_data.starts_and_sizes.sizes[index])); + *type_, data_.starts_and_sizes.starts[index], data_.starts_and_sizes.sizes[index])); } BLI_assert(false); - return GVSpan(*m_type); + return GVSpan(*type_); } }; diff --git a/source/blender/functions/FN_attributes_ref.hh b/source/blender/functions/FN_attributes_ref.hh index 383b26330bf..276c424ebf6 100644 --- a/source/blender/functions/FN_attributes_ref.hh +++ b/source/blender/functions/FN_attributes_ref.hh @@ -40,10 +40,10 @@ class AttributesInfo; class AttributesInfoBuilder : NonCopyable, NonMovable { private: - LinearAllocator<> m_allocator; - VectorSet<std::string> m_names; - Vector<const CPPType *> m_types; - Vector<void *> m_defaults; + LinearAllocator<> allocator_; + VectorSet<std::string> names_; + Vector<const CPPType *> types_; + Vector<void *> defaults_; friend AttributesInfo; @@ -65,11 +65,11 @@ class AttributesInfoBuilder : NonCopyable, NonMovable { */ class AttributesInfo : NonCopyable, NonMovable { private: - LinearAllocator<> m_allocator; - Map<StringRefNull, uint> m_index_by_name; - Vector<StringRefNull> m_name_by_index; - Vector<const CPPType *> m_type_by_index; - Vector<void *> m_defaults; + LinearAllocator<> allocator_; + Map<StringRefNull, uint> index_by_name_; + Vector<StringRefNull> name_by_index_; + Vector<const CPPType *> type_by_index_; + Vector<void *> defaults_; public: AttributesInfo() = default; @@ -78,27 +78,27 @@ class AttributesInfo : NonCopyable, NonMovable { uint size() const { - return m_name_by_index.size(); + return name_by_index_.size(); } IndexRange index_range() const { - return m_name_by_index.index_range(); + return name_by_index_.index_range(); } StringRefNull name_of(uint index) const { - return m_name_by_index[index]; + return name_by_index_[index]; } uint index_of(StringRef name) const { - return m_index_by_name.lookup_as(name); + return index_by_name_.lookup_as(name); } const void *default_of(uint index) const { - return m_defaults[index]; + return defaults_[index]; } const void *default_of(StringRef name) const @@ -108,8 +108,8 @@ class AttributesInfo : NonCopyable, NonMovable { template<typename T> const T &default_of(uint index) const { - BLI_assert(m_type_by_index[index]->is<T>()); - return *(T *)m_defaults[index]; + BLI_assert(type_by_index_[index]->is<T>()); + return *(T *)defaults_[index]; } template<typename T> const T &default_of(StringRef name) const @@ -119,7 +119,7 @@ class AttributesInfo : NonCopyable, NonMovable { const CPPType &type_of(uint index) const { - return *m_type_by_index[index]; + return *type_by_index_[index]; } const CPPType &type_of(StringRef name) const @@ -134,7 +134,7 @@ class AttributesInfo : NonCopyable, NonMovable { int try_index_of(StringRef name) const { - return (int)m_index_by_name.lookup_default_as(name, -1); + return (int)index_by_name_.lookup_default_as(name, -1); } int try_index_of(StringRef name, const CPPType &type) const @@ -158,9 +158,9 @@ class AttributesInfo : NonCopyable, NonMovable { */ class MutableAttributesRef { private: - const AttributesInfo *m_info; - Span<void *> m_buffers; - IndexRange m_range; + const AttributesInfo *info_; + Span<void *> buffers_; + IndexRange range_; public: MutableAttributesRef(const AttributesInfo &info, Span<void *> buffers, uint size) @@ -169,46 +169,46 @@ class MutableAttributesRef { } MutableAttributesRef(const AttributesInfo &info, Span<void *> buffers, IndexRange range) - : m_info(&info), m_buffers(buffers), m_range(range) + : info_(&info), buffers_(buffers), range_(range) { } uint size() const { - return m_range.size(); + return range_.size(); } const AttributesInfo &info() const { - return *m_info; + return *info_; } GMutableSpan get(uint index) const { - const CPPType &type = m_info->type_of(index); - void *ptr = POINTER_OFFSET(m_buffers[index], type.size() * m_range.start()); - return GMutableSpan(type, ptr, m_range.size()); + const CPPType &type = info_->type_of(index); + void *ptr = POINTER_OFFSET(buffers_[index], type.size() * range_.start()); + return GMutableSpan(type, ptr, range_.size()); } GMutableSpan get(StringRef name) const { - return this->get(m_info->index_of(name)); + return this->get(info_->index_of(name)); } template<typename T> MutableSpan<T> get(uint index) const { - BLI_assert(m_info->type_of(index).is<T>()); - return MutableSpan<T>((T *)m_buffers[index] + m_range.start(), m_range.size()); + BLI_assert(info_->type_of(index).is<T>()); + return MutableSpan<T>((T *)buffers_[index] + range_.start(), range_.size()); } template<typename T> MutableSpan<T> get(StringRef name) const { - return this->get<T>(m_info->index_of(name)); + return this->get<T>(info_->index_of(name)); } std::optional<GMutableSpan> try_get(StringRef name, const CPPType &type) const { - int index = m_info->try_index_of(name, type); + int index = info_->try_index_of(name, type); if (index == -1) { return {}; } @@ -219,11 +219,11 @@ class MutableAttributesRef { template<typename T> std::optional<MutableSpan<T>> try_get(StringRef name) const { - int index = m_info->try_index_of(name); + int index = info_->try_index_of(name); if (index == -1) { return {}; } - else if (m_info->type_of((uint)index).is<T>()) { + else if (info_->type_of((uint)index).is<T>()) { return this->get<T>((uint)index); } else { @@ -238,7 +238,7 @@ class MutableAttributesRef { MutableAttributesRef slice(uint start, uint size) const { - return MutableAttributesRef(*m_info, m_buffers, m_range.slice(start, size)); + return MutableAttributesRef(*info_, buffers_, range_.slice(start, size)); } }; diff --git a/source/blender/functions/FN_cpp_type.hh b/source/blender/functions/FN_cpp_type.hh index 706ff85bdf3..e8f0335e7c9 100644 --- a/source/blender/functions/FN_cpp_type.hh +++ b/source/blender/functions/FN_cpp_type.hh @@ -132,36 +132,36 @@ class CPPType { FillUninitializedF fill_uninitialized, FillUninitializedIndicesF fill_uninitialized_indices, const void *default_value) - : m_size(size), - m_alignment(alignment), - m_is_trivially_destructible(is_trivially_destructible), - m_construct_default(construct_default), - m_construct_default_n(construct_default_n), - m_construct_default_indices(construct_default_indices), - m_destruct(destruct), - m_destruct_n(destruct_n), - m_destruct_indices(destruct_indices), - m_copy_to_initialized(copy_to_initialized), - m_copy_to_initialized_n(copy_to_initialized_n), - m_copy_to_initialized_indices(copy_to_initialized_indices), - m_copy_to_uninitialized(copy_to_uninitialized), - m_copy_to_uninitialized_n(copy_to_uninitialized_n), - m_copy_to_uninitialized_indices(copy_to_uninitialized_indices), - m_relocate_to_initialized(relocate_to_initialized), - m_relocate_to_initialized_n(relocate_to_initialized_n), - m_relocate_to_initialized_indices(relocate_to_initialized_indices), - m_relocate_to_uninitialized(relocate_to_uninitialized), - m_relocate_to_uninitialized_n(relocate_to_uninitialized_n), - m_relocate_to_uninitialized_indices(relocate_to_uninitialized_indices), - m_fill_initialized(fill_initialized), - m_fill_initialized_indices(fill_initialized_indices), - m_fill_uninitialized(fill_uninitialized), - m_fill_uninitialized_indices(fill_uninitialized_indices), - m_default_value(default_value), - m_name(name) - { - BLI_assert(is_power_of_2_i(m_alignment)); - m_alignment_mask = (uintptr_t)m_alignment - (uintptr_t)1; + : size_(size), + alignment_(alignment), + is_trivially_destructible_(is_trivially_destructible), + construct_default_(construct_default), + construct_default_n_(construct_default_n), + construct_default_indices_(construct_default_indices), + destruct_(destruct), + destruct_n_(destruct_n), + destruct_indices_(destruct_indices), + copy_to_initialized_(copy_to_initialized), + copy_to_initialized_n_(copy_to_initialized_n), + copy_to_initialized_indices_(copy_to_initialized_indices), + copy_to_uninitialized_(copy_to_uninitialized), + copy_to_uninitialized_n_(copy_to_uninitialized_n), + copy_to_uninitialized_indices_(copy_to_uninitialized_indices), + relocate_to_initialized_(relocate_to_initialized), + relocate_to_initialized_n_(relocate_to_initialized_n), + relocate_to_initialized_indices_(relocate_to_initialized_indices), + relocate_to_uninitialized_(relocate_to_uninitialized), + relocate_to_uninitialized_n_(relocate_to_uninitialized_n), + relocate_to_uninitialized_indices_(relocate_to_uninitialized_indices), + fill_initialized_(fill_initialized), + fill_initialized_indices_(fill_initialized_indices), + fill_uninitialized_(fill_uninitialized), + fill_uninitialized_indices_(fill_uninitialized_indices), + default_value_(default_value), + name_(name) + { + BLI_assert(is_power_of_2_i(alignment_)); + alignment_mask_ = (uintptr_t)alignment_ - (uintptr_t)1; } /** @@ -170,7 +170,7 @@ class CPPType { */ StringRefNull name() const { - return m_name; + return name_; } /** @@ -181,7 +181,7 @@ class CPPType { */ uint size() const { - return m_size; + return size_; } /** @@ -192,7 +192,7 @@ class CPPType { */ uint alignment() const { - return m_alignment; + return alignment_; } /** @@ -204,7 +204,7 @@ class CPPType { */ bool is_trivially_destructible() const { - return m_is_trivially_destructible; + return is_trivially_destructible_; } /** @@ -212,7 +212,7 @@ class CPPType { */ bool pointer_has_valid_alignment(const void *ptr) const { - return ((uintptr_t)ptr & m_alignment_mask) == 0; + return ((uintptr_t)ptr & alignment_mask_) == 0; } bool pointer_can_point_to_instance(const void *ptr) const @@ -232,21 +232,21 @@ class CPPType { { BLI_assert(this->pointer_can_point_to_instance(ptr)); - m_construct_default(ptr); + construct_default_(ptr); } void construct_default_n(void *ptr, uint n) const { BLI_assert(this->pointer_has_valid_alignment(ptr)); - m_construct_default_n(ptr, n); + construct_default_n_(ptr, n); } void construct_default_indices(void *ptr, IndexMask index_mask) const { BLI_assert(this->pointer_has_valid_alignment(ptr)); - m_construct_default_indices(ptr, index_mask); + construct_default_indices_(ptr, index_mask); } /** @@ -261,21 +261,21 @@ class CPPType { { BLI_assert(this->pointer_can_point_to_instance(ptr)); - m_destruct(ptr); + destruct_(ptr); } void destruct_n(void *ptr, uint n) const { BLI_assert(this->pointer_has_valid_alignment(ptr)); - m_destruct_n(ptr, n); + destruct_n_(ptr, n); } void destruct_indices(void *ptr, IndexMask index_mask) const { BLI_assert(this->pointer_has_valid_alignment(ptr)); - m_destruct_indices(ptr, index_mask); + destruct_indices_(ptr, index_mask); } /** @@ -290,7 +290,7 @@ class CPPType { BLI_assert(this->pointer_can_point_to_instance(src)); BLI_assert(this->pointer_can_point_to_instance(dst)); - m_copy_to_initialized(src, dst); + copy_to_initialized_(src, dst); } void copy_to_initialized_n(const void *src, void *dst, uint n) const @@ -299,7 +299,7 @@ class CPPType { BLI_assert(this->pointer_has_valid_alignment(src)); BLI_assert(this->pointer_has_valid_alignment(dst)); - m_copy_to_initialized_n(src, dst, n); + copy_to_initialized_n_(src, dst, n); } void copy_to_initialized_indices(const void *src, void *dst, IndexMask index_mask) const @@ -308,7 +308,7 @@ class CPPType { BLI_assert(this->pointer_has_valid_alignment(src)); BLI_assert(this->pointer_has_valid_alignment(dst)); - m_copy_to_initialized_indices(src, dst, index_mask); + copy_to_initialized_indices_(src, dst, index_mask); } /** @@ -325,7 +325,7 @@ class CPPType { BLI_assert(this->pointer_can_point_to_instance(src)); BLI_assert(this->pointer_can_point_to_instance(dst)); - m_copy_to_uninitialized(src, dst); + copy_to_uninitialized_(src, dst); } void copy_to_uninitialized_n(const void *src, void *dst, uint n) const @@ -334,7 +334,7 @@ class CPPType { BLI_assert(this->pointer_has_valid_alignment(src)); BLI_assert(this->pointer_has_valid_alignment(dst)); - m_copy_to_uninitialized_n(src, dst, n); + copy_to_uninitialized_n_(src, dst, n); } void copy_to_uninitialized_indices(const void *src, void *dst, IndexMask index_mask) const @@ -343,7 +343,7 @@ class CPPType { BLI_assert(this->pointer_has_valid_alignment(src)); BLI_assert(this->pointer_has_valid_alignment(dst)); - m_copy_to_uninitialized_indices(src, dst, index_mask); + copy_to_uninitialized_indices_(src, dst, index_mask); } /** @@ -360,7 +360,7 @@ class CPPType { BLI_assert(this->pointer_can_point_to_instance(src)); BLI_assert(this->pointer_can_point_to_instance(dst)); - m_relocate_to_initialized(src, dst); + relocate_to_initialized_(src, dst); } void relocate_to_initialized_n(void *src, void *dst, uint n) const @@ -369,7 +369,7 @@ class CPPType { BLI_assert(this->pointer_has_valid_alignment(src)); BLI_assert(this->pointer_has_valid_alignment(dst)); - m_relocate_to_initialized_n(src, dst, n); + relocate_to_initialized_n_(src, dst, n); } void relocate_to_initialized_indices(void *src, void *dst, IndexMask index_mask) const @@ -378,7 +378,7 @@ class CPPType { BLI_assert(this->pointer_has_valid_alignment(src)); BLI_assert(this->pointer_has_valid_alignment(dst)); - m_relocate_to_initialized_indices(src, dst, index_mask); + relocate_to_initialized_indices_(src, dst, index_mask); } /** @@ -395,7 +395,7 @@ class CPPType { BLI_assert(this->pointer_can_point_to_instance(src)); BLI_assert(this->pointer_can_point_to_instance(dst)); - m_relocate_to_uninitialized(src, dst); + relocate_to_uninitialized_(src, dst); } void relocate_to_uninitialized_n(void *src, void *dst, uint n) const @@ -404,7 +404,7 @@ class CPPType { BLI_assert(this->pointer_has_valid_alignment(src)); BLI_assert(this->pointer_has_valid_alignment(dst)); - m_relocate_to_uninitialized_n(src, dst, n); + relocate_to_uninitialized_n_(src, dst, n); } void relocate_to_uninitialized_indices(void *src, void *dst, IndexMask index_mask) const @@ -413,7 +413,7 @@ class CPPType { BLI_assert(this->pointer_has_valid_alignment(src)); BLI_assert(this->pointer_has_valid_alignment(dst)); - m_relocate_to_uninitialized_indices(src, dst, index_mask); + relocate_to_uninitialized_indices_(src, dst, index_mask); } /** @@ -426,7 +426,7 @@ class CPPType { BLI_assert(this->pointer_can_point_to_instance(value)); BLI_assert(this->pointer_can_point_to_instance(dst)); - m_fill_initialized(value, dst, n); + fill_initialized_(value, dst, n); } void fill_initialized_indices(const void *value, void *dst, IndexMask index_mask) const @@ -434,7 +434,7 @@ class CPPType { BLI_assert(this->pointer_has_valid_alignment(value)); BLI_assert(this->pointer_has_valid_alignment(dst)); - m_fill_initialized_indices(value, dst, index_mask); + fill_initialized_indices_(value, dst, index_mask); } /** @@ -447,7 +447,7 @@ class CPPType { BLI_assert(this->pointer_can_point_to_instance(value)); BLI_assert(this->pointer_can_point_to_instance(dst)); - m_fill_uninitialized(value, dst, n); + fill_uninitialized_(value, dst, n); } void fill_uninitialized_indices(const void *value, void *dst, IndexMask index_mask) const @@ -455,7 +455,7 @@ class CPPType { BLI_assert(this->pointer_has_valid_alignment(value)); BLI_assert(this->pointer_has_valid_alignment(dst)); - m_fill_uninitialized_indices(value, dst, index_mask); + fill_uninitialized_indices_(value, dst, index_mask); } /** @@ -464,7 +464,7 @@ class CPPType { */ const void *default_value() const { - return m_default_value; + return default_value_; } /** @@ -489,43 +489,43 @@ class CPPType { } private: - uint m_size; - uint m_alignment; - uintptr_t m_alignment_mask; - bool m_is_trivially_destructible; + uint size_; + uint alignment_; + uintptr_t alignment_mask_; + bool is_trivially_destructible_; - ConstructDefaultF m_construct_default; - ConstructDefaultNF m_construct_default_n; - ConstructDefaultIndicesF m_construct_default_indices; + ConstructDefaultF construct_default_; + ConstructDefaultNF construct_default_n_; + ConstructDefaultIndicesF construct_default_indices_; - DestructF m_destruct; - DestructNF m_destruct_n; - DestructIndicesF m_destruct_indices; + DestructF destruct_; + DestructNF destruct_n_; + DestructIndicesF destruct_indices_; - CopyToInitializedF m_copy_to_initialized; - CopyToInitializedNF m_copy_to_initialized_n; - CopyToInitializedIndicesF m_copy_to_initialized_indices; + CopyToInitializedF copy_to_initialized_; + CopyToInitializedNF copy_to_initialized_n_; + CopyToInitializedIndicesF copy_to_initialized_indices_; - CopyToUninitializedF m_copy_to_uninitialized; - CopyToUninitializedNF m_copy_to_uninitialized_n; - CopyToUninitializedIndicesF m_copy_to_uninitialized_indices; + CopyToUninitializedF copy_to_uninitialized_; + CopyToUninitializedNF copy_to_uninitialized_n_; + CopyToUninitializedIndicesF copy_to_uninitialized_indices_; - RelocateToInitializedF m_relocate_to_initialized; - RelocateToInitializedNF m_relocate_to_initialized_n; - RelocateToInitializedIndicesF m_relocate_to_initialized_indices; + RelocateToInitializedF relocate_to_initialized_; + RelocateToInitializedNF relocate_to_initialized_n_; + RelocateToInitializedIndicesF relocate_to_initialized_indices_; - RelocateToUninitializedF m_relocate_to_uninitialized; - RelocateToUninitializedNF m_relocate_to_uninitialized_n; - RelocateToUninitializedIndicesF m_relocate_to_uninitialized_indices; + RelocateToUninitializedF relocate_to_uninitialized_; + RelocateToUninitializedNF relocate_to_uninitialized_n_; + RelocateToUninitializedIndicesF relocate_to_uninitialized_indices_; - FillInitializedF m_fill_initialized; - FillInitializedIndicesF m_fill_initialized_indices; + FillInitializedF fill_initialized_; + FillInitializedIndicesF fill_initialized_indices_; - FillUninitializedF m_fill_uninitialized; - FillUninitializedIndicesF m_fill_uninitialized_indices; + FillUninitializedF fill_uninitialized_; + FillUninitializedIndicesF fill_uninitialized_indices_; - const void *m_default_value; - std::string m_name; + const void *default_value_; + std::string name_; }; /* -------------------------------------------------------------------- diff --git a/source/blender/functions/FN_generic_vector_array.hh b/source/blender/functions/FN_generic_vector_array.hh index 6be1b68da4d..065c8622b47 100644 --- a/source/blender/functions/FN_generic_vector_array.hh +++ b/source/blender/functions/FN_generic_vector_array.hh @@ -42,12 +42,12 @@ template<typename T> class GVectorArrayRef; class GVectorArray : NonCopyable, NonMovable { private: - const CPPType &m_type; - uint m_element_size; - Array<void *, 1> m_starts; - Array<uint, 1> m_lengths; - Array<uint, 1> m_capacities; - LinearAllocator<> m_allocator; + const CPPType &type_; + uint element_size_; + Array<void *, 1> starts_; + Array<uint, 1> lengths_; + Array<uint, 1> capacities_; + LinearAllocator<> allocator_; template<typename T> friend class GVectorArrayRef; @@ -55,73 +55,73 @@ class GVectorArray : NonCopyable, NonMovable { GVectorArray() = delete; GVectorArray(const CPPType &type, uint array_size) - : m_type(type), - m_element_size(type.size()), - m_starts(array_size), - m_lengths(array_size), - m_capacities(array_size) + : type_(type), + element_size_(type.size()), + starts_(array_size), + lengths_(array_size), + capacities_(array_size) { - m_starts.fill(nullptr); - m_lengths.fill(0); - m_capacities.fill(0); + starts_.fill(nullptr); + lengths_.fill(0); + capacities_.fill(0); } ~GVectorArray() { - if (m_type.is_trivially_destructible()) { + if (type_.is_trivially_destructible()) { return; } - for (uint i : m_starts.index_range()) { - m_type.destruct_n(m_starts[i], m_lengths[i]); + for (uint i : starts_.index_range()) { + type_.destruct_n(starts_[i], lengths_[i]); } } operator GVArraySpan() const { - return GVArraySpan(m_type, m_starts.as_span(), m_lengths); + return GVArraySpan(type_, starts_.as_span(), lengths_); } bool is_empty() const { - return m_starts.size() == 0; + return starts_.size() == 0; } uint size() const { - return m_starts.size(); + return starts_.size(); } const CPPType &type() const { - return m_type; + return type_; } Span<const void *> starts() const { - return m_starts.as_span(); + return starts_.as_span(); } Span<uint> lengths() const { - return m_lengths; + return lengths_; } void append(uint index, const void *src) { - uint old_length = m_lengths[index]; - if (old_length == m_capacities[index]) { + uint old_length = lengths_[index]; + if (old_length == capacities_[index]) { this->grow_at_least_one(index); } - void *dst = POINTER_OFFSET(m_starts[index], m_element_size * old_length); - m_type.copy_to_uninitialized(src, dst); - m_lengths[index]++; + void *dst = POINTER_OFFSET(starts_[index], element_size_ * old_length); + type_.copy_to_uninitialized(src, dst); + lengths_[index]++; } void extend(uint index, GVSpan span) { - BLI_assert(m_type == span.type()); + BLI_assert(type_ == span.type()); for (uint i = 0; i < span.size(); i++) { this->append(index, span[i]); } @@ -129,7 +129,7 @@ class GVectorArray : NonCopyable, NonMovable { void extend(IndexMask mask, GVArraySpan array_span) { - BLI_assert(m_type == array_span.type()); + BLI_assert(type_ == array_span.type()); BLI_assert(mask.min_array_size() <= array_span.size()); for (uint i : mask) { this->extend(i, array_span[i]); @@ -138,8 +138,8 @@ class GVectorArray : NonCopyable, NonMovable { GMutableSpan operator[](uint index) { - BLI_assert(index < m_starts.size()); - return GMutableSpan(m_type, m_starts[index], m_lengths[index]); + BLI_assert(index < starts_.size()); + return GMutableSpan(type_, starts_[index], lengths_[index]); } template<typename T> GVectorArrayRef<T> typed() { @@ -149,56 +149,56 @@ class GVectorArray : NonCopyable, NonMovable { private: void grow_at_least_one(uint index) { - BLI_assert(m_lengths[index] == m_capacities[index]); - uint new_capacity = m_lengths[index] * 2 + 1; + BLI_assert(lengths_[index] == capacities_[index]); + uint new_capacity = lengths_[index] * 2 + 1; - void *new_buffer = m_allocator.allocate(m_element_size * new_capacity, m_type.alignment()); - m_type.relocate_to_uninitialized_n(m_starts[index], new_buffer, m_lengths[index]); + void *new_buffer = allocator_.allocate(element_size_ * new_capacity, type_.alignment()); + type_.relocate_to_uninitialized_n(starts_[index], new_buffer, lengths_[index]); - m_starts[index] = new_buffer; - m_capacities[index] = new_capacity; + starts_[index] = new_buffer; + capacities_[index] = new_capacity; } }; template<typename T> class GVectorArrayRef { private: - GVectorArray *m_vector_array; + GVectorArray *vector_array_; public: - GVectorArrayRef(GVectorArray &vector_array) : m_vector_array(&vector_array) + GVectorArrayRef(GVectorArray &vector_array) : vector_array_(&vector_array) { - BLI_assert(vector_array.m_type.is<T>()); + BLI_assert(vector_array.type_.is<T>()); } void append(uint index, const T &value) { - m_vector_array->append(index, &value); + vector_array_->append(index, &value); } void extend(uint index, Span<T> values) { - m_vector_array->extend(index, values); + vector_array_->extend(index, values); } void extend(uint index, VSpan<T> values) { - m_vector_array->extend(index, GVSpan(values)); + vector_array_->extend(index, GVSpan(values)); } MutableSpan<T> operator[](uint index) { - BLI_assert(index < m_vector_array->m_starts.size()); - return MutableSpan<T>((T *)m_vector_array->m_starts[index], m_vector_array->m_lengths[index]); + BLI_assert(index < vector_array_->starts_.size()); + return MutableSpan<T>((T *)vector_array_->starts_[index], vector_array_->lengths_[index]); } uint size() const { - return m_vector_array->size(); + return vector_array_->size(); } bool is_empty() const { - return m_vector_array->is_empty(); + return vector_array_->is_empty(); } }; diff --git a/source/blender/functions/FN_multi_function.hh b/source/blender/functions/FN_multi_function.hh index a7e964b6651..dd5239a4730 100644 --- a/source/blender/functions/FN_multi_function.hh +++ b/source/blender/functions/FN_multi_function.hh @@ -53,7 +53,7 @@ namespace fn { class MultiFunction { private: - MFSignature m_signature; + MFSignature signature_; public: virtual ~MultiFunction() @@ -64,34 +64,34 @@ class MultiFunction { IndexRange param_indices() const { - return m_signature.param_types.index_range(); + return signature_.param_types.index_range(); } MFParamType param_type(uint param_index) const { - return m_signature.param_types[param_index]; + return signature_.param_types[param_index]; } StringRefNull param_name(uint param_index) const { - return m_signature.param_names[param_index]; + return signature_.param_names[param_index]; } StringRefNull name() const { - return m_signature.function_name; + return signature_.function_name; } const MFSignature &signature() const { - return m_signature; + return signature_; } protected: MFSignatureBuilder get_builder(std::string function_name) { - m_signature.function_name = std::move(function_name); - return MFSignatureBuilder(m_signature); + signature_.function_name = std::move(function_name); + return MFSignatureBuilder(signature_); } }; diff --git a/source/blender/functions/FN_multi_function_builder.hh b/source/blender/functions/FN_multi_function_builder.hh index 9fcf31443b2..dfe4a25029e 100644 --- a/source/blender/functions/FN_multi_function_builder.hh +++ b/source/blender/functions/FN_multi_function_builder.hh @@ -41,10 +41,10 @@ namespace fn { template<typename In1, typename Out1> class CustomMF_SI_SO : public MultiFunction { private: using FunctionT = std::function<void(IndexMask, VSpan<In1>, MutableSpan<Out1>)>; - FunctionT m_function; + FunctionT function_; public: - CustomMF_SI_SO(StringRef name, FunctionT function) : m_function(std::move(function)) + CustomMF_SI_SO(StringRef name, FunctionT function) : function_(std::move(function)) { MFSignatureBuilder signature = this->get_builder(name); signature.single_input<In1>("In1"); @@ -68,7 +68,7 @@ template<typename In1, typename Out1> class CustomMF_SI_SO : public MultiFunctio { VSpan<In1> in1 = params.readonly_single_input<In1>(0); MutableSpan<Out1> out1 = params.uninitialized_single_output<Out1>(1); - m_function(mask, in1, out1); + function_(mask, in1, out1); } }; @@ -82,10 +82,10 @@ template<typename In1, typename In2, typename Out1> class CustomMF_SI_SI_SO : public MultiFunction { private: using FunctionT = std::function<void(IndexMask, VSpan<In1>, VSpan<In2>, MutableSpan<Out1>)>; - FunctionT m_function; + FunctionT function_; public: - CustomMF_SI_SI_SO(StringRef name, FunctionT function) : m_function(std::move(function)) + CustomMF_SI_SI_SO(StringRef name, FunctionT function) : function_(std::move(function)) { MFSignatureBuilder signature = this->get_builder(name); signature.single_input<In1>("In1"); @@ -111,7 +111,7 @@ class CustomMF_SI_SI_SO : public MultiFunction { VSpan<In1> in1 = params.readonly_single_input<In1>(0); VSpan<In2> in2 = params.readonly_single_input<In2>(1); MutableSpan<Out1> out1 = params.uninitialized_single_output<Out1>(2); - m_function(mask, in1, in2, out1); + function_(mask, in1, in2, out1); } }; @@ -127,10 +127,10 @@ class CustomMF_SI_SI_SI_SO : public MultiFunction { private: using FunctionT = std::function<void(IndexMask, VSpan<In1>, VSpan<In2>, VSpan<In3>, MutableSpan<Out1>)>; - FunctionT m_function; + FunctionT function_; public: - CustomMF_SI_SI_SI_SO(StringRef name, FunctionT function) : m_function(std::move(function)) + CustomMF_SI_SI_SI_SO(StringRef name, FunctionT function) : function_(std::move(function)) { MFSignatureBuilder signature = this->get_builder(name); signature.single_input<In1>("In1"); @@ -163,7 +163,7 @@ class CustomMF_SI_SI_SI_SO : public MultiFunction { VSpan<In2> in2 = params.readonly_single_input<In2>(1); VSpan<In3> in3 = params.readonly_single_input<In3>(2); MutableSpan<Out1> out1 = params.uninitialized_single_output<Out1>(3); - m_function(mask, in1, in2, in3, out1); + function_(mask, in1, in2, in3, out1); } }; @@ -174,10 +174,10 @@ class CustomMF_SI_SI_SI_SO : public MultiFunction { template<typename Mut1> class CustomMF_SM : public MultiFunction { private: using FunctionT = std::function<void(IndexMask, MutableSpan<Mut1>)>; - FunctionT m_function; + FunctionT function_; public: - CustomMF_SM(StringRef name, FunctionT function) : m_function(std::move(function)) + CustomMF_SM(StringRef name, FunctionT function) : function_(std::move(function)) { MFSignatureBuilder signature = this->get_builder(name); signature.single_mutable<Mut1>("Mut1"); @@ -199,7 +199,7 @@ template<typename Mut1> class CustomMF_SM : public MultiFunction { void call(IndexMask mask, MFParams params, MFContext UNUSED(context)) const override { MutableSpan<Mut1> mut1 = params.single_mutable<Mut1>(0); - m_function(mask, mut1); + function_(mask, mut1); } }; @@ -208,21 +208,21 @@ template<typename Mut1> class CustomMF_SM : public MultiFunction { */ template<typename T> class CustomMF_Constant : public MultiFunction { private: - T m_value; + T value_; public: - template<typename U> CustomMF_Constant(U &&value) : m_value(std::forward<U>(value)) + template<typename U> CustomMF_Constant(U &&value) : value_(std::forward<U>(value)) { MFSignatureBuilder signature = this->get_builder("Constant"); std::stringstream ss; - ss << m_value; + ss << value_; signature.single_output<T>(ss.str()); } void call(IndexMask mask, MFParams params, MFContext UNUSED(context)) const override { MutableSpan<T> output = params.uninitialized_single_output<T>(0); - mask.foreach_index([&](uint i) { new (&output[i]) T(m_value); }); + mask.foreach_index([&](uint i) { new (&output[i]) T(value_); }); } }; diff --git a/source/blender/functions/FN_multi_function_data_type.hh b/source/blender/functions/FN_multi_function_data_type.hh index 1a7b179c6ae..8bf2b06a9cc 100644 --- a/source/blender/functions/FN_multi_function_data_type.hh +++ b/source/blender/functions/FN_multi_function_data_type.hh @@ -38,10 +38,10 @@ class MFDataType { }; private: - Category m_category; - const CPPType *m_type; + Category category_; + const CPPType *type_; - MFDataType(Category category, const CPPType &type) : m_category(category), m_type(&type) + MFDataType(Category category, const CPPType &type) : category_(category), type_(&type) { } @@ -70,29 +70,29 @@ class MFDataType { bool is_single() const { - return m_category == Single; + return category_ == Single; } bool is_vector() const { - return m_category == Vector; + return category_ == Vector; } Category category() const { - return m_category; + return category_; } const CPPType &single_type() const { BLI_assert(this->is_single()); - return *m_type; + return *type_; } const CPPType &vector_base_type() const { BLI_assert(this->is_vector()); - return *m_type; + return *type_; } friend bool operator==(const MFDataType &a, const MFDataType &b); @@ -100,11 +100,11 @@ class MFDataType { std::string to_string() const { - switch (m_category) { + switch (category_) { case Single: - return m_type->name(); + return type_->name(); case Vector: - return m_type->name() + " Vector"; + return type_->name() + " Vector"; } BLI_assert(false); return ""; @@ -113,7 +113,7 @@ class MFDataType { inline bool operator==(const MFDataType &a, const MFDataType &b) { - return a.m_category == b.m_category && a.m_type == b.m_type; + return a.category_ == b.category_ && a.type_ == b.type_; } inline bool operator!=(const MFDataType &a, const MFDataType &b) diff --git a/source/blender/functions/FN_multi_function_network.hh b/source/blender/functions/FN_multi_function_network.hh index bb0c870746b..2c374679939 100644 --- a/source/blender/functions/FN_multi_function_network.hh +++ b/source/blender/functions/FN_multi_function_network.hh @@ -59,11 +59,11 @@ class MFNetwork; class MFNode : NonCopyable, NonMovable { protected: - MFNetwork *m_network; - Span<MFInputSocket *> m_inputs; - Span<MFOutputSocket *> m_outputs; - bool m_is_dummy; - uint m_id; + MFNetwork *network_; + Span<MFInputSocket *> inputs_; + Span<MFOutputSocket *> outputs_; + bool is_dummy_; + uint id_; friend MFNetwork; @@ -106,9 +106,9 @@ class MFNode : NonCopyable, NonMovable { class MFFunctionNode : public MFNode { private: - const MultiFunction *m_function; - Span<uint> m_input_param_indices; - Span<uint> m_output_param_indices; + const MultiFunction *function_; + Span<uint> input_param_indices_; + Span<uint> output_param_indices_; friend MFNetwork; @@ -123,9 +123,9 @@ class MFFunctionNode : public MFNode { class MFDummyNode : public MFNode { private: - StringRefNull m_name; - MutableSpan<StringRefNull> m_input_names; - MutableSpan<StringRefNull> m_output_names; + StringRefNull name_; + MutableSpan<StringRefNull> input_names_; + MutableSpan<StringRefNull> output_names_; friend MFNetwork; @@ -138,12 +138,12 @@ class MFDummyNode : public MFNode { class MFSocket : NonCopyable, NonMovable { protected: - MFNode *m_node; - bool m_is_output; - uint m_index; - MFDataType m_data_type; - uint m_id; - StringRefNull m_name; + MFNode *node_; + bool is_output_; + uint index_; + MFDataType data_type_; + uint id_; + StringRefNull name_; friend MFNetwork; @@ -169,7 +169,7 @@ class MFSocket : NonCopyable, NonMovable { class MFInputSocket : public MFSocket { private: - MFOutputSocket *m_origin; + MFOutputSocket *origin_; friend MFNetwork; @@ -180,7 +180,7 @@ class MFInputSocket : public MFSocket { class MFOutputSocket : public MFSocket { private: - Vector<MFInputSocket *, 1> m_targets; + Vector<MFInputSocket *, 1> targets_; friend MFNetwork; @@ -191,13 +191,13 @@ class MFOutputSocket : public MFSocket { class MFNetwork : NonCopyable, NonMovable { private: - LinearAllocator<> m_allocator; + LinearAllocator<> allocator_; - VectorSet<MFFunctionNode *> m_function_nodes; - VectorSet<MFDummyNode *> m_dummy_nodes; + VectorSet<MFFunctionNode *> function_nodes_; + VectorSet<MFDummyNode *> dummy_nodes_; - Vector<MFNode *> m_node_or_null_by_id; - Vector<MFSocket *> m_socket_or_null_by_id; + Vector<MFNode *> node_or_null_by_id_; + Vector<MFSocket *> socket_or_null_by_id_; public: MFNetwork() = default; @@ -229,7 +229,7 @@ class MFNetwork : NonCopyable, NonMovable { inline StringRefNull MFNode::name() const { - if (m_is_dummy) { + if (is_dummy_) { return this->as_dummy().name(); } else { @@ -239,96 +239,96 @@ inline StringRefNull MFNode::name() const inline uint MFNode::id() const { - return m_id; + return id_; } inline MFNetwork &MFNode::network() { - return *m_network; + return *network_; } inline const MFNetwork &MFNode::network() const { - return *m_network; + return *network_; } inline bool MFNode::is_dummy() const { - return m_is_dummy; + return is_dummy_; } inline bool MFNode::is_function() const { - return !m_is_dummy; + return !is_dummy_; } inline MFDummyNode &MFNode::as_dummy() { - BLI_assert(m_is_dummy); + BLI_assert(is_dummy_); return *(MFDummyNode *)this; } inline const MFDummyNode &MFNode::as_dummy() const { - BLI_assert(m_is_dummy); + BLI_assert(is_dummy_); return *(const MFDummyNode *)this; } inline MFFunctionNode &MFNode::as_function() { - BLI_assert(!m_is_dummy); + BLI_assert(!is_dummy_); return *(MFFunctionNode *)this; } inline const MFFunctionNode &MFNode::as_function() const { - BLI_assert(!m_is_dummy); + BLI_assert(!is_dummy_); return *(const MFFunctionNode *)this; } inline MFInputSocket &MFNode::input(uint index) { - return *m_inputs[index]; + return *inputs_[index]; } inline const MFInputSocket &MFNode::input(uint index) const { - return *m_inputs[index]; + return *inputs_[index]; } inline MFOutputSocket &MFNode::output(uint index) { - return *m_outputs[index]; + return *outputs_[index]; } inline const MFOutputSocket &MFNode::output(uint index) const { - return *m_outputs[index]; + return *outputs_[index]; } inline Span<MFInputSocket *> MFNode::inputs() { - return m_inputs; + return inputs_; } inline Span<const MFInputSocket *> MFNode::inputs() const { - return m_inputs; + return inputs_; } inline Span<MFOutputSocket *> MFNode::outputs() { - return m_outputs; + return outputs_; } inline Span<const MFOutputSocket *> MFNode::outputs() const { - return m_outputs; + return outputs_; } template<typename FuncT> void MFNode::foreach_origin_socket(const FuncT &func) const { - for (const MFInputSocket *socket : m_inputs) { + for (const MFInputSocket *socket : inputs_) { const MFOutputSocket *origin = socket->origin(); if (origin != nullptr) { func(*origin); @@ -338,7 +338,7 @@ template<typename FuncT> void MFNode::foreach_origin_socket(const FuncT &func) c inline bool MFNode::all_inputs_have_origin() const { - for (const MFInputSocket *socket : m_inputs) { + for (const MFInputSocket *socket : inputs_) { if (socket->origin() == nullptr) { return false; } @@ -352,22 +352,22 @@ inline bool MFNode::all_inputs_have_origin() const inline StringRefNull MFFunctionNode::name() const { - return m_function->name(); + return function_->name(); } inline const MultiFunction &MFFunctionNode::function() const { - return *m_function; + return *function_; } inline const MFInputSocket &MFFunctionNode::input_for_param(uint param_index) const { - return this->input(m_input_param_indices.first_index(param_index)); + return this->input(input_param_indices_.first_index(param_index)); } inline const MFOutputSocket &MFFunctionNode::output_for_param(uint param_index) const { - return this->output(m_output_param_indices.first_index(param_index)); + return this->output(output_param_indices_.first_index(param_index)); } /* -------------------------------------------------------------------- @@ -376,17 +376,17 @@ inline const MFOutputSocket &MFFunctionNode::output_for_param(uint param_index) inline StringRefNull MFDummyNode::name() const { - return m_name; + return name_; } inline Span<StringRefNull> MFDummyNode::input_names() const { - return m_input_names; + return input_names_; } inline Span<StringRefNull> MFDummyNode::output_names() const { - return m_output_names; + return output_names_; } /* -------------------------------------------------------------------- @@ -395,37 +395,37 @@ inline Span<StringRefNull> MFDummyNode::output_names() const inline StringRefNull MFSocket::name() const { - return m_name; + return name_; } inline uint MFSocket::id() const { - return m_id; + return id_; } inline const MFDataType &MFSocket::data_type() const { - return m_data_type; + return data_type_; } inline MFNode &MFSocket::node() { - return *m_node; + return *node_; } inline const MFNode &MFSocket::node() const { - return *m_node; + return *node_; } inline bool MFSocket::is_input() const { - return !m_is_output; + return !is_output_; } inline bool MFSocket::is_output() const { - return m_is_output; + return is_output_; } inline MFInputSocket &MFSocket::as_input() @@ -458,12 +458,12 @@ inline const MFOutputSocket &MFSocket::as_output() const inline MFOutputSocket *MFInputSocket::origin() { - return m_origin; + return origin_; } inline const MFOutputSocket *MFInputSocket::origin() const { - return m_origin; + return origin_; } /* -------------------------------------------------------------------- @@ -472,12 +472,12 @@ inline const MFOutputSocket *MFInputSocket::origin() const inline Span<MFInputSocket *> MFOutputSocket::targets() { - return m_targets; + return targets_; } inline Span<const MFInputSocket *> MFOutputSocket::targets() const { - return m_targets.as_span(); + return targets_.as_span(); } /* -------------------------------------------------------------------- @@ -486,7 +486,7 @@ inline Span<const MFInputSocket *> MFOutputSocket::targets() const inline uint MFNetwork::max_socket_id() const { - return m_socket_or_null_by_id.size() - 1; + return socket_or_null_by_id_.size() - 1; } } // namespace fn diff --git a/source/blender/functions/FN_multi_function_network_evaluation.hh b/source/blender/functions/FN_multi_function_network_evaluation.hh index 85ccd1361ef..0b129930251 100644 --- a/source/blender/functions/FN_multi_function_network_evaluation.hh +++ b/source/blender/functions/FN_multi_function_network_evaluation.hh @@ -30,8 +30,8 @@ class MFNetworkEvaluationStorage; class MFNetworkEvaluator : public MultiFunction { private: - Vector<const MFOutputSocket *> m_inputs; - Vector<const MFInputSocket *> m_outputs; + Vector<const MFOutputSocket *> inputs_; + Vector<const MFInputSocket *> outputs_; public: MFNetworkEvaluator(Vector<const MFOutputSocket *> inputs, Vector<const MFInputSocket *> outputs); diff --git a/source/blender/functions/FN_multi_function_param_type.hh b/source/blender/functions/FN_multi_function_param_type.hh index d89c13505f9..e9125678270 100644 --- a/source/blender/functions/FN_multi_function_param_type.hh +++ b/source/blender/functions/FN_multi_function_param_type.hh @@ -56,12 +56,12 @@ class MFParamType { }; private: - InterfaceType m_interface_type; - MFDataType m_data_type; + InterfaceType interface_type_; + MFDataType data_type_; public: MFParamType(InterfaceType interface_type, MFDataType data_type) - : m_interface_type(interface_type), m_data_type(data_type) + : interface_type_(interface_type), data_type_(data_type) { } @@ -97,19 +97,19 @@ class MFParamType { MFDataType data_type() const { - return m_data_type; + return data_type_; } InterfaceType interface_type() const { - return m_interface_type; + return interface_type_; } Category category() const { - switch (m_data_type.category()) { + switch (data_type_.category()) { case MFDataType::Single: { - switch (m_interface_type) { + switch (interface_type_) { case Input: return SingleInput; case Output: @@ -120,7 +120,7 @@ class MFParamType { break; } case MFDataType::Vector: { - switch (m_interface_type) { + switch (interface_type_) { case Input: return VectorInput; case Output: @@ -137,12 +137,12 @@ class MFParamType { bool is_input_or_mutable() const { - return ELEM(m_interface_type, Input, Mutable); + return ELEM(interface_type_, Input, Mutable); } bool is_output_or_mutable() const { - return ELEM(m_interface_type, Output, Mutable); + return ELEM(interface_type_, Output, Mutable); } friend bool operator==(const MFParamType &a, const MFParamType &b); @@ -151,7 +151,7 @@ class MFParamType { inline bool operator==(const MFParamType &a, const MFParamType &b) { - return a.m_interface_type == b.m_interface_type && a.m_data_type == b.m_data_type; + return a.interface_type_ == b.interface_type_ && a.data_type_ == b.data_type_; } inline bool operator!=(const MFParamType &a, const MFParamType &b) diff --git a/source/blender/functions/FN_multi_function_params.hh b/source/blender/functions/FN_multi_function_params.hh index 6a0eb698250..570bad4fd86 100644 --- a/source/blender/functions/FN_multi_function_params.hh +++ b/source/blender/functions/FN_multi_function_params.hh @@ -34,18 +34,18 @@ namespace fn { class MFParamsBuilder { private: - const MFSignature *m_signature; - uint m_min_array_size; - Vector<GVSpan> m_virtual_spans; - Vector<GMutableSpan> m_mutable_spans; - Vector<GVArraySpan> m_virtual_array_spans; - Vector<GVectorArray *> m_vector_arrays; + const MFSignature *signature_; + uint min_array_size_; + Vector<GVSpan> virtual_spans_; + Vector<GMutableSpan> mutable_spans_; + Vector<GVArraySpan> virtual_array_spans_; + Vector<GVectorArray *> vector_arrays_; friend class MFParams; public: MFParamsBuilder(const MFSignature &signature, uint min_array_size) - : m_signature(&signature), m_min_array_size(min_array_size) + : signature_(&signature), min_array_size_(min_array_size) { } @@ -53,67 +53,66 @@ class MFParamsBuilder { template<typename T> void add_readonly_single_input(const T *value) { - this->add_readonly_single_input( - GVSpan::FromSingle(CPPType::get<T>(), value, m_min_array_size)); + this->add_readonly_single_input(GVSpan::FromSingle(CPPType::get<T>(), value, min_array_size_)); } void add_readonly_single_input(GVSpan ref) { this->assert_current_param_type(MFParamType::ForSingleInput(ref.type())); - BLI_assert(ref.size() >= m_min_array_size); - m_virtual_spans.append(ref); + BLI_assert(ref.size() >= min_array_size_); + virtual_spans_.append(ref); } void add_readonly_vector_input(GVArraySpan ref) { this->assert_current_param_type(MFParamType::ForVectorInput(ref.type())); - BLI_assert(ref.size() >= m_min_array_size); - m_virtual_array_spans.append(ref); + BLI_assert(ref.size() >= min_array_size_); + virtual_array_spans_.append(ref); } void add_uninitialized_single_output(GMutableSpan ref) { this->assert_current_param_type(MFParamType::ForSingleOutput(ref.type())); - BLI_assert(ref.size() >= m_min_array_size); - m_mutable_spans.append(ref); + BLI_assert(ref.size() >= min_array_size_); + mutable_spans_.append(ref); } void add_vector_output(GVectorArray &vector_array) { this->assert_current_param_type(MFParamType::ForVectorOutput(vector_array.type())); - BLI_assert(vector_array.size() >= m_min_array_size); - m_vector_arrays.append(&vector_array); + BLI_assert(vector_array.size() >= min_array_size_); + vector_arrays_.append(&vector_array); } void add_single_mutable(GMutableSpan ref) { this->assert_current_param_type(MFParamType::ForMutableSingle(ref.type())); - BLI_assert(ref.size() >= m_min_array_size); - m_mutable_spans.append(ref); + BLI_assert(ref.size() >= min_array_size_); + mutable_spans_.append(ref); } void add_vector_mutable(GVectorArray &vector_array) { this->assert_current_param_type(MFParamType::ForMutableVector(vector_array.type())); - BLI_assert(vector_array.size() >= m_min_array_size); - m_vector_arrays.append(&vector_array); + BLI_assert(vector_array.size() >= min_array_size_); + vector_arrays_.append(&vector_array); } GMutableSpan computed_array(uint param_index) { - BLI_assert(ELEM(m_signature->param_types[param_index].category(), + BLI_assert(ELEM(signature_->param_types[param_index].category(), MFParamType::SingleOutput, MFParamType::SingleMutable)); - uint data_index = m_signature->data_index(param_index); - return m_mutable_spans[data_index]; + uint data_index = signature_->data_index(param_index); + return mutable_spans_[data_index]; } GVectorArray &computed_vector_array(uint param_index) { - BLI_assert(ELEM(m_signature->param_types[param_index].category(), + BLI_assert(ELEM(signature_->param_types[param_index].category(), MFParamType::VectorOutput, MFParamType::VectorMutable)); - uint data_index = m_signature->data_index(param_index); - return *m_vector_arrays[data_index]; + uint data_index = signature_->data_index(param_index); + return *vector_arrays_[data_index]; } private: @@ -122,24 +121,24 @@ class MFParamsBuilder { UNUSED_VARS_NDEBUG(param_type); #ifdef DEBUG uint param_index = this->current_param_index(); - MFParamType expected_type = m_signature->param_types[param_index]; + MFParamType expected_type = signature_->param_types[param_index]; BLI_assert(expected_type == param_type); #endif } uint current_param_index() const { - return m_virtual_spans.size() + m_mutable_spans.size() + m_virtual_array_spans.size() + - m_vector_arrays.size(); + return virtual_spans_.size() + mutable_spans_.size() + virtual_array_spans_.size() + + vector_arrays_.size(); } }; class MFParams { private: - MFParamsBuilder *m_builder; + MFParamsBuilder *builder_; public: - MFParams(MFParamsBuilder &builder) : m_builder(&builder) + MFParams(MFParamsBuilder &builder) : builder_(&builder) { } @@ -150,8 +149,8 @@ class MFParams { GVSpan readonly_single_input(uint param_index, StringRef name = "") { this->assert_correct_param(param_index, name, MFParamType::SingleInput); - uint data_index = m_builder->m_signature->data_index(param_index); - return m_builder->m_virtual_spans[data_index]; + uint data_index = builder_->signature_->data_index(param_index); + return builder_->virtual_spans_[data_index]; } template<typename T> @@ -162,8 +161,8 @@ class MFParams { GMutableSpan uninitialized_single_output(uint param_index, StringRef name = "") { this->assert_correct_param(param_index, name, MFParamType::SingleOutput); - uint data_index = m_builder->m_signature->data_index(param_index); - return m_builder->m_mutable_spans[data_index]; + uint data_index = builder_->signature_->data_index(param_index); + return builder_->mutable_spans_[data_index]; } template<typename T> VArraySpan<T> readonly_vector_input(uint param_index, StringRef name = "") @@ -173,8 +172,8 @@ class MFParams { GVArraySpan readonly_vector_input(uint param_index, StringRef name = "") { this->assert_correct_param(param_index, name, MFParamType::VectorInput); - uint data_index = m_builder->m_signature->data_index(param_index); - return m_builder->m_virtual_array_spans[data_index]; + uint data_index = builder_->signature_->data_index(param_index); + return builder_->virtual_array_spans_[data_index]; } template<typename T> GVectorArrayRef<T> vector_output(uint param_index, StringRef name = "") @@ -184,8 +183,8 @@ class MFParams { GVectorArray &vector_output(uint param_index, StringRef name = "") { this->assert_correct_param(param_index, name, MFParamType::VectorOutput); - uint data_index = m_builder->m_signature->data_index(param_index); - return *m_builder->m_vector_arrays[data_index]; + uint data_index = builder_->signature_->data_index(param_index); + return *builder_->vector_arrays_[data_index]; } template<typename T> MutableSpan<T> single_mutable(uint param_index, StringRef name = "") @@ -195,8 +194,8 @@ class MFParams { GMutableSpan single_mutable(uint param_index, StringRef name = "") { this->assert_correct_param(param_index, name, MFParamType::SingleMutable); - uint data_index = m_builder->m_signature->data_index(param_index); - return m_builder->m_mutable_spans[data_index]; + uint data_index = builder_->signature_->data_index(param_index); + return builder_->mutable_spans_[data_index]; } template<typename T> GVectorArrayRef<T> vector_mutable(uint param_index, StringRef name = "") @@ -206,8 +205,8 @@ class MFParams { GVectorArray &vector_mutable(uint param_index, StringRef name = "") { this->assert_correct_param(param_index, name, MFParamType::VectorMutable); - uint data_index = m_builder->m_signature->data_index(param_index); - return *m_builder->m_vector_arrays[data_index]; + uint data_index = builder_->signature_->data_index(param_index); + return *builder_->vector_arrays_[data_index]; } private: @@ -215,9 +214,9 @@ class MFParams { { UNUSED_VARS_NDEBUG(param_index, name, param_type); #ifdef DEBUG - BLI_assert(m_builder->m_signature->param_types[param_index] == param_type); + BLI_assert(builder_->signature_->param_types[param_index] == param_type); if (name.size() > 0) { - BLI_assert(m_builder->m_signature->param_names[param_index] == name); + BLI_assert(builder_->signature_->param_names[param_index] == name); } #endif } @@ -226,9 +225,9 @@ class MFParams { { UNUSED_VARS_NDEBUG(param_index, name, category); #ifdef DEBUG - BLI_assert(m_builder->m_signature->param_types[param_index].category() == category); + BLI_assert(builder_->signature_->param_types[param_index].category() == category); if (name.size() > 0) { - BLI_assert(m_builder->m_signature->param_names[param_index] == name); + BLI_assert(builder_->signature_->param_names[param_index] == name); } #endif } diff --git a/source/blender/functions/FN_multi_function_signature.hh b/source/blender/functions/FN_multi_function_signature.hh index 77a8ce14c03..13bf662b21b 100644 --- a/source/blender/functions/FN_multi_function_signature.hh +++ b/source/blender/functions/FN_multi_function_signature.hh @@ -46,14 +46,14 @@ struct MFSignature { class MFSignatureBuilder { private: - MFSignature &m_data; - uint m_span_count = 0; - uint m_virtual_span_count = 0; - uint m_virtual_array_span_count = 0; - uint m_vector_array_count = 0; + MFSignature &data_; + uint span_count_ = 0; + uint virtual_span_count_ = 0; + uint virtual_array_span_count_ = 0; + uint vector_array_count_ = 0; public: - MFSignatureBuilder(MFSignature &data) : m_data(data) + MFSignatureBuilder(MFSignature &data) : data_(data) { BLI_assert(data.param_names.is_empty()); BLI_assert(data.param_types.is_empty()); @@ -80,15 +80,15 @@ class MFSignatureBuilder { } void input(StringRef name, MFDataType data_type) { - m_data.param_names.append(name); - m_data.param_types.append(MFParamType(MFParamType::Input, data_type)); + data_.param_names.append(name); + data_.param_types.append(MFParamType(MFParamType::Input, data_type)); switch (data_type.category()) { case MFDataType::Single: - m_data.param_data_indices.append(m_virtual_span_count++); + data_.param_data_indices.append(virtual_span_count_++); break; case MFDataType::Vector: - m_data.param_data_indices.append(m_virtual_array_span_count++); + data_.param_data_indices.append(virtual_array_span_count_++); break; } } @@ -113,15 +113,15 @@ class MFSignatureBuilder { } void output(StringRef name, MFDataType data_type) { - m_data.param_names.append(name); - m_data.param_types.append(MFParamType(MFParamType::Output, data_type)); + data_.param_names.append(name); + data_.param_types.append(MFParamType(MFParamType::Output, data_type)); switch (data_type.category()) { case MFDataType::Single: - m_data.param_data_indices.append(m_span_count++); + data_.param_data_indices.append(span_count_++); break; case MFDataType::Vector: - m_data.param_data_indices.append(m_vector_array_count++); + data_.param_data_indices.append(vector_array_count_++); break; } } @@ -146,15 +146,15 @@ class MFSignatureBuilder { } void mutable_(StringRef name, MFDataType data_type) { - m_data.param_names.append(name); - m_data.param_types.append(MFParamType(MFParamType::Mutable, data_type)); + data_.param_names.append(name); + data_.param_types.append(MFParamType(MFParamType::Mutable, data_type)); switch (data_type.category()) { case MFDataType::Single: - m_data.param_data_indices.append(m_span_count++); + data_.param_data_indices.append(span_count_++); break; case MFDataType::Vector: - m_data.param_data_indices.append(m_vector_array_count++); + data_.param_data_indices.append(vector_array_count_++); break; } } diff --git a/source/blender/functions/FN_spans.hh b/source/blender/functions/FN_spans.hh index b4607527fb5..0bb5ea7938d 100644 --- a/source/blender/functions/FN_spans.hh +++ b/source/blender/functions/FN_spans.hh @@ -51,13 +51,13 @@ namespace fn { */ class GSpan { private: - const CPPType *m_type; - const void *m_buffer; - uint m_size; + const CPPType *type_; + const void *buffer_; + uint size_; public: GSpan(const CPPType &type, const void *buffer, uint size) - : m_type(&type), m_buffer(buffer), m_size(size) + : type_(&type), buffer_(buffer), size_(size) { BLI_assert(buffer != nullptr || size == 0); BLI_assert(type.pointer_has_valid_alignment(buffer)); @@ -74,34 +74,34 @@ class GSpan { const CPPType &type() const { - return *m_type; + return *type_; } bool is_empty() const { - return m_size == 0; + return size_ == 0; } uint size() const { - return m_size; + return size_; } const void *buffer() const { - return m_buffer; + return buffer_; } const void *operator[](uint index) const { - BLI_assert(index < m_size); - return POINTER_OFFSET(m_buffer, m_type->size() * index); + BLI_assert(index < size_); + return POINTER_OFFSET(buffer_, type_->size() * index); } template<typename T> Span<T> typed() const { - BLI_assert(m_type->is<T>()); - return Span<T>((const T *)m_buffer, m_size); + BLI_assert(type_->is<T>()); + return Span<T>((const T *)buffer_, size_); } }; @@ -111,13 +111,13 @@ class GSpan { */ class GMutableSpan { private: - const CPPType *m_type; - void *m_buffer; - uint m_size; + const CPPType *type_; + void *buffer_; + uint size_; public: GMutableSpan(const CPPType &type, void *buffer, uint size) - : m_type(&type), m_buffer(buffer), m_size(size) + : type_(&type), buffer_(buffer), size_(size) { BLI_assert(buffer != nullptr || size == 0); BLI_assert(type.pointer_has_valid_alignment(buffer)); @@ -135,39 +135,39 @@ class GMutableSpan { operator GSpan() const { - return GSpan(*m_type, m_buffer, m_size); + return GSpan(*type_, buffer_, size_); } const CPPType &type() const { - return *m_type; + return *type_; } bool is_empty() const { - return m_size == 0; + return size_ == 0; } uint size() const { - return m_size; + return size_; } void *buffer() { - return m_buffer; + return buffer_; } void *operator[](uint index) { - BLI_assert(index < m_size); - return POINTER_OFFSET(m_buffer, m_type->size() * index); + BLI_assert(index < size_); + return POINTER_OFFSET(buffer_, type_->size() * index); } template<typename T> MutableSpan<T> typed() { - BLI_assert(m_type->is<T>()); - return MutableSpan<T>((T *)m_buffer, m_size); + BLI_assert(type_->is<T>()); + return MutableSpan<T>((T *)buffer_, size_); } }; @@ -179,8 +179,8 @@ enum class VSpanCategory { template<typename T> struct VSpanBase { protected: - uint m_virtual_size; - VSpanCategory m_category; + uint virtual_size_; + VSpanCategory category_; union { struct { const T *data; @@ -191,18 +191,18 @@ template<typename T> struct VSpanBase { struct { const T *const *data; } full_pointer_array; - } m_data; + } data_; public: bool is_single_element() const { - switch (m_category) { + switch (category_) { case VSpanCategory::Single: return true; case VSpanCategory::FullArray: - return m_virtual_size == 1; + return virtual_size_ == 1; case VSpanCategory::FullPointerArray: - return m_virtual_size == 1; + return virtual_size_ == 1; } BLI_assert(false); return false; @@ -210,12 +210,12 @@ template<typename T> struct VSpanBase { bool is_empty() const { - return this->m_virtual_size == 0; + return this->virtual_size_ == 0; } uint size() const { - return this->m_virtual_size; + return this->virtual_size_; } }; @@ -237,16 +237,16 @@ template<typename T> class VSpan : public VSpanBase<T> { public: VSpan() { - this->m_virtual_size = 0; - this->m_category = VSpanCategory::FullArray; - this->m_data.full_array.data = nullptr; + this->virtual_size_ = 0; + this->category_ = VSpanCategory::FullArray; + this->data_.full_array.data = nullptr; } VSpan(Span<T> values) { - this->m_virtual_size = values.size(); - this->m_category = VSpanCategory::FullArray; - this->m_data.full_array.data = values.begin(); + this->virtual_size_ = values.size(); + this->category_ = VSpanCategory::FullArray; + this->data_.full_array.data = values.begin(); } VSpan(MutableSpan<T> values) : VSpan(Span<T>(values)) @@ -255,33 +255,33 @@ template<typename T> class VSpan : public VSpanBase<T> { VSpan(Span<const T *> values) { - this->m_virtual_size = values.size(); - this->m_category = VSpanCategory::FullPointerArray; - this->m_data.full_pointer_array.data = values.begin(); + this->virtual_size_ = values.size(); + this->category_ = VSpanCategory::FullPointerArray; + this->data_.full_pointer_array.data = values.begin(); } static VSpan FromSingle(const T *value, uint virtual_size) { VSpan ref; - ref.m_virtual_size = virtual_size; - ref.m_category = VSpanCategory::Single; - ref.m_data.single.data = value; + ref.virtual_size_ = virtual_size; + ref.category_ = VSpanCategory::Single; + ref.data_.single.data = value; return ref; } const T &operator[](uint index) const { - BLI_assert(index < this->m_virtual_size); - switch (this->m_category) { + BLI_assert(index < this->virtual_size_); + switch (this->category_) { case VSpanCategory::Single: - return *this->m_data.single.data; + return *this->data_.single.data; case VSpanCategory::FullArray: - return this->m_data.full_array.data[index]; + return this->data_.full_array.data[index]; case VSpanCategory::FullPointerArray: - return *this->m_data.full_pointer_array.data[index]; + return *this->data_.full_pointer_array.data[index]; } BLI_assert(false); - return *this->m_data.single.data; + return *this->data_.single.data; } }; @@ -291,25 +291,25 @@ template<typename T> class VSpan : public VSpanBase<T> { */ class GVSpan : public VSpanBase<void> { private: - const CPPType *m_type; + const CPPType *type_; GVSpan() = default; public: GVSpan(const CPPType &type) { - this->m_type = &type; - this->m_virtual_size = 0; - this->m_category = VSpanCategory::FullArray; - this->m_data.full_array.data = nullptr; + this->type_ = &type; + this->virtual_size_ = 0; + this->category_ = VSpanCategory::FullArray; + this->data_.full_array.data = nullptr; } GVSpan(GSpan values) { - this->m_type = &values.type(); - this->m_virtual_size = values.size(); - this->m_category = VSpanCategory::FullArray; - this->m_data.full_array.data = values.buffer(); + this->type_ = &values.type(); + this->virtual_size_ = values.size(); + this->category_ = VSpanCategory::FullArray; + this->data_.full_array.data = values.buffer(); } GVSpan(GMutableSpan values) : GVSpan(GSpan(values)) @@ -318,7 +318,7 @@ class GVSpan : public VSpanBase<void> { template<typename T> GVSpan(const VSpanBase<T> &values) { - this->m_type = &CPPType::get<T>(); + this->type_ = &CPPType::get<T>(); memcpy(this, &values, sizeof(VSpanBase<void>)); } @@ -333,46 +333,46 @@ class GVSpan : public VSpanBase<void> { static GVSpan FromSingle(const CPPType &type, const void *value, uint virtual_size) { GVSpan ref; - ref.m_type = &type; - ref.m_virtual_size = virtual_size; - ref.m_category = VSpanCategory::Single; - ref.m_data.single.data = value; + ref.type_ = &type; + ref.virtual_size_ = virtual_size; + ref.category_ = VSpanCategory::Single; + ref.data_.single.data = value; return ref; } static GVSpan FromFullPointerArray(const CPPType &type, const void *const *values, uint size) { GVSpan ref; - ref.m_type = &type; - ref.m_virtual_size = size; - ref.m_category = VSpanCategory::FullPointerArray; - ref.m_data.full_pointer_array.data = values; + ref.type_ = &type; + ref.virtual_size_ = size; + ref.category_ = VSpanCategory::FullPointerArray; + ref.data_.full_pointer_array.data = values; return ref; } const CPPType &type() const { - return *this->m_type; + return *this->type_; } const void *operator[](uint index) const { - BLI_assert(index < this->m_virtual_size); - switch (this->m_category) { + BLI_assert(index < this->virtual_size_); + switch (this->category_) { case VSpanCategory::Single: - return this->m_data.single.data; + return this->data_.single.data; case VSpanCategory::FullArray: - return POINTER_OFFSET(this->m_data.full_array.data, index * m_type->size()); + return POINTER_OFFSET(this->data_.full_array.data, index * type_->size()); case VSpanCategory::FullPointerArray: - return this->m_data.full_pointer_array.data[index]; + return this->data_.full_pointer_array.data[index]; } BLI_assert(false); - return this->m_data.single.data; + return this->data_.single.data; } template<typename T> VSpan<T> typed() const { - BLI_assert(m_type->is<T>()); + BLI_assert(type_->is<T>()); return VSpan<T>(*this); } @@ -384,16 +384,16 @@ class GVSpan : public VSpanBase<void> { void materialize_to_uninitialized(void *dst) const { - this->materialize_to_uninitialized(IndexRange(m_virtual_size), dst); + this->materialize_to_uninitialized(IndexRange(virtual_size_), dst); } void materialize_to_uninitialized(IndexMask mask, void *dst) const { BLI_assert(this->size() >= mask.min_array_size()); - uint element_size = m_type->size(); + uint element_size = type_->size(); for (uint i : mask) { - m_type->copy_to_uninitialized((*this)[i], POINTER_OFFSET(dst, element_size * i)); + type_->copy_to_uninitialized((*this)[i], POINTER_OFFSET(dst, element_size * i)); } } }; diff --git a/source/blender/functions/intern/attributes_ref.cc b/source/blender/functions/intern/attributes_ref.cc index dc64f571596..047fa12adb4 100644 --- a/source/blender/functions/intern/attributes_ref.cc +++ b/source/blender/functions/intern/attributes_ref.cc @@ -21,50 +21,50 @@ namespace fn { AttributesInfoBuilder::~AttributesInfoBuilder() { - for (uint i : m_defaults.index_range()) { - m_types[i]->destruct(m_defaults[i]); + for (uint i : defaults_.index_range()) { + types_[i]->destruct(defaults_[i]); } } void AttributesInfoBuilder::add(StringRef name, const CPPType &type, const void *default_value) { - if (m_names.add_as(name)) { - m_types.append(&type); + if (names_.add_as(name)) { + types_.append(&type); if (default_value == nullptr) { default_value = type.default_value(); } - void *dst = m_allocator.allocate(type.size(), type.alignment()); + void *dst = allocator_.allocate(type.size(), type.alignment()); type.copy_to_uninitialized(default_value, dst); - m_defaults.append(dst); + defaults_.append(dst); } else { /* The same name can be added more than once as long as the type is always the same. */ - BLI_assert(m_types[m_names.index_of_as(name)] == &type); + BLI_assert(types_[names_.index_of_as(name)] == &type); } } AttributesInfo::AttributesInfo(const AttributesInfoBuilder &builder) { - for (uint i : builder.m_types.index_range()) { - StringRefNull name = m_allocator.copy_string(builder.m_names[i]); - const CPPType &type = *builder.m_types[i]; - const void *default_value = builder.m_defaults[i]; + for (uint i : builder.types_.index_range()) { + StringRefNull name = allocator_.copy_string(builder.names_[i]); + const CPPType &type = *builder.types_[i]; + const void *default_value = builder.defaults_[i]; - m_index_by_name.add_new(name, i); - m_name_by_index.append(name); - m_type_by_index.append(&type); + index_by_name_.add_new(name, i); + name_by_index_.append(name); + type_by_index_.append(&type); - void *dst = m_allocator.allocate(type.size(), type.alignment()); + void *dst = allocator_.allocate(type.size(), type.alignment()); type.copy_to_uninitialized(default_value, dst); - m_defaults.append(dst); + defaults_.append(dst); } } AttributesInfo::~AttributesInfo() { - for (uint i : m_defaults.index_range()) { - m_type_by_index[i]->destruct(m_defaults[i]); + for (uint i : defaults_.index_range()) { + type_by_index_[i]->destruct(defaults_[i]); } } diff --git a/source/blender/functions/intern/multi_function_network.cc b/source/blender/functions/intern/multi_function_network.cc index 93d062f3e5c..f2a28776660 100644 --- a/source/blender/functions/intern/multi_function_network.cc +++ b/source/blender/functions/intern/multi_function_network.cc @@ -22,11 +22,11 @@ namespace fn { MFNetwork::~MFNetwork() { - for (MFFunctionNode *node : m_function_nodes) { + for (MFFunctionNode *node : function_nodes_) { node->destruct_sockets(); node->~MFFunctionNode(); } - for (MFDummyNode *node : m_dummy_nodes) { + for (MFDummyNode *node : dummy_nodes_) { node->destruct_sockets(); node->~MFDummyNode(); } @@ -34,10 +34,10 @@ MFNetwork::~MFNetwork() void MFNode::destruct_sockets() { - for (MFInputSocket *socket : m_inputs) { + for (MFInputSocket *socket : inputs_) { socket->~MFInputSocket(); } - for (MFOutputSocket *socket : m_outputs) { + for (MFOutputSocket *socket : outputs_) { socket->~MFOutputSocket(); } } @@ -69,19 +69,19 @@ MFFunctionNode &MFNetwork::add_function(const MultiFunction &function) } } - MFFunctionNode &node = *m_allocator.construct<MFFunctionNode>(); - m_function_nodes.add_new(&node); + MFFunctionNode &node = *allocator_.construct<MFFunctionNode>(); + function_nodes_.add_new(&node); - node.m_network = this; - node.m_is_dummy = false; - node.m_id = m_node_or_null_by_id.append_and_get_index(&node); - node.m_function = &function; - node.m_input_param_indices = m_allocator.construct_array_copy<uint>(input_param_indices); - node.m_output_param_indices = m_allocator.construct_array_copy<uint>(output_param_indices); + node.network_ = this; + node.is_dummy_ = false; + node.id_ = node_or_null_by_id_.append_and_get_index(&node); + node.function_ = &function; + node.input_param_indices_ = allocator_.construct_array_copy<uint>(input_param_indices); + node.output_param_indices_ = allocator_.construct_array_copy<uint>(output_param_indices); - node.m_inputs = m_allocator.construct_elements_and_pointer_array<MFInputSocket>( + node.inputs_ = allocator_.construct_elements_and_pointer_array<MFInputSocket>( input_param_indices.size()); - node.m_outputs = m_allocator.construct_elements_and_pointer_array<MFOutputSocket>( + node.outputs_ = allocator_.construct_elements_and_pointer_array<MFOutputSocket>( output_param_indices.size()); for (uint i : input_param_indices.index_range()) { @@ -89,14 +89,14 @@ MFFunctionNode &MFNetwork::add_function(const MultiFunction &function) MFParamType param = function.param_type(param_index); BLI_assert(param.is_input_or_mutable()); - MFInputSocket &socket = *node.m_inputs[i]; - socket.m_data_type = param.data_type(); - socket.m_node = &node; - socket.m_index = i; - socket.m_is_output = false; - socket.m_name = function.param_name(param_index); - socket.m_origin = nullptr; - socket.m_id = m_socket_or_null_by_id.append_and_get_index(&socket); + MFInputSocket &socket = *node.inputs_[i]; + socket.data_type_ = param.data_type(); + socket.node_ = &node; + socket.index_ = i; + socket.is_output_ = false; + socket.name_ = function.param_name(param_index); + socket.origin_ = nullptr; + socket.id_ = socket_or_null_by_id_.append_and_get_index(&socket); } for (uint i : output_param_indices.index_range()) { @@ -104,13 +104,13 @@ MFFunctionNode &MFNetwork::add_function(const MultiFunction &function) MFParamType param = function.param_type(param_index); BLI_assert(param.is_output_or_mutable()); - MFOutputSocket &socket = *node.m_outputs[i]; - socket.m_data_type = param.data_type(); - socket.m_node = &node; - socket.m_index = i; - socket.m_is_output = true; - socket.m_name = function.param_name(param_index); - socket.m_id = m_socket_or_null_by_id.append_and_get_index(&socket); + MFOutputSocket &socket = *node.outputs_[i]; + socket.data_type_ = param.data_type(); + socket.node_ = &node; + socket.index_ = i; + socket.is_output_ = true; + socket.name_ = function.param_name(param_index); + socket.id_ = socket_or_null_by_id_.append_and_get_index(&socket); } return node; @@ -128,42 +128,42 @@ MFDummyNode &MFNetwork::add_dummy(StringRef name, assert_same_size(input_types, input_names); assert_same_size(output_types, output_names); - MFDummyNode &node = *m_allocator.construct<MFDummyNode>(); - m_dummy_nodes.add_new(&node); + MFDummyNode &node = *allocator_.construct<MFDummyNode>(); + dummy_nodes_.add_new(&node); - node.m_network = this; - node.m_is_dummy = true; - node.m_name = m_allocator.copy_string(name); - node.m_id = m_node_or_null_by_id.append_and_get_index(&node); + node.network_ = this; + node.is_dummy_ = true; + node.name_ = allocator_.copy_string(name); + node.id_ = node_or_null_by_id_.append_and_get_index(&node); - node.m_inputs = m_allocator.construct_elements_and_pointer_array<MFInputSocket>( + node.inputs_ = allocator_.construct_elements_and_pointer_array<MFInputSocket>( input_types.size()); - node.m_outputs = m_allocator.construct_elements_and_pointer_array<MFOutputSocket>( + node.outputs_ = allocator_.construct_elements_and_pointer_array<MFOutputSocket>( output_types.size()); - node.m_input_names = m_allocator.allocate_array<StringRefNull>(input_types.size()); - node.m_output_names = m_allocator.allocate_array<StringRefNull>(output_types.size()); + node.input_names_ = allocator_.allocate_array<StringRefNull>(input_types.size()); + node.output_names_ = allocator_.allocate_array<StringRefNull>(output_types.size()); for (uint i : input_types.index_range()) { - MFInputSocket &socket = *node.m_inputs[i]; - socket.m_data_type = input_types[i]; - socket.m_node = &node; - socket.m_index = i; - socket.m_is_output = false; - socket.m_name = m_allocator.copy_string(input_names[i]); - socket.m_id = m_socket_or_null_by_id.append_and_get_index(&socket); - node.m_input_names[i] = socket.m_name; + MFInputSocket &socket = *node.inputs_[i]; + socket.data_type_ = input_types[i]; + socket.node_ = &node; + socket.index_ = i; + socket.is_output_ = false; + socket.name_ = allocator_.copy_string(input_names[i]); + socket.id_ = socket_or_null_by_id_.append_and_get_index(&socket); + node.input_names_[i] = socket.name_; } for (uint i : output_types.index_range()) { - MFOutputSocket &socket = *node.m_outputs[i]; - socket.m_data_type = output_types[i]; - socket.m_node = &node; - socket.m_index = i; - socket.m_is_output = true; - socket.m_name = m_allocator.copy_string(output_names[i]); - socket.m_id = m_socket_or_null_by_id.append_and_get_index(&socket); - node.m_output_names[i] = socket.m_name; + MFOutputSocket &socket = *node.outputs_[i]; + socket.data_type_ = output_types[i]; + socket.node_ = &node; + socket.index_ = i; + socket.is_output_ = true; + socket.name_ = allocator_.copy_string(output_names[i]); + socket.id_ = socket_or_null_by_id_.append_and_get_index(&socket); + node.output_names_[i] = socket.name_; } return node; @@ -176,11 +176,11 @@ MFDummyNode &MFNetwork::add_dummy(StringRef name, */ void MFNetwork::add_link(MFOutputSocket &from, MFInputSocket &to) { - BLI_assert(to.m_origin == nullptr); - BLI_assert(from.m_node->m_network == to.m_node->m_network); - BLI_assert(from.m_data_type == to.m_data_type); - from.m_targets.append(&to); - to.m_origin = &from; + BLI_assert(to.origin_ == nullptr); + BLI_assert(from.node_->network_ == to.node_->network_); + BLI_assert(from.data_type_ == to.data_type_); + from.targets_.append(&to); + to.origin_ = &from; } MFOutputSocket &MFNetwork::add_input(StringRef name, MFDataType data_type) @@ -197,38 +197,38 @@ void MFNetwork::relink(MFOutputSocket &old_output, MFOutputSocket &new_output) { BLI_assert(&old_output != &new_output); for (MFInputSocket *input : old_output.targets()) { - input->m_origin = &new_output; + input->origin_ = &new_output; } - new_output.m_targets.extend(old_output.m_targets); - old_output.m_targets.clear(); + new_output.targets_.extend(old_output.targets_); + old_output.targets_.clear(); } void MFNetwork::remove(MFNode &node) { - for (MFInputSocket *socket : node.m_inputs) { - if (socket->m_origin != nullptr) { - socket->m_origin->m_targets.remove_first_occurrence_and_reorder(socket); + for (MFInputSocket *socket : node.inputs_) { + if (socket->origin_ != nullptr) { + socket->origin_->targets_.remove_first_occurrence_and_reorder(socket); } - m_socket_or_null_by_id[socket->m_id] = nullptr; + socket_or_null_by_id_[socket->id_] = nullptr; } - for (MFOutputSocket *socket : node.m_outputs) { - for (MFInputSocket *other : socket->m_targets) { - other->m_origin = nullptr; + for (MFOutputSocket *socket : node.outputs_) { + for (MFInputSocket *other : socket->targets_) { + other->origin_ = nullptr; } - m_socket_or_null_by_id[socket->m_id] = nullptr; + socket_or_null_by_id_[socket->id_] = nullptr; } node.destruct_sockets(); if (node.is_dummy()) { MFDummyNode &dummy_node = node.as_dummy(); dummy_node.~MFDummyNode(); - m_dummy_nodes.remove_contained(&dummy_node); + dummy_nodes_.remove_contained(&dummy_node); } else { MFFunctionNode &function_node = node.as_function(); function_node.~MFFunctionNode(); - m_function_nodes.remove_contained(&function_node); + function_nodes_.remove_contained(&function_node); } - m_node_or_null_by_id[node.m_id] = nullptr; + node_or_null_by_id_[node.id_] = nullptr; } std::string MFNetwork::to_dot() const @@ -239,17 +239,17 @@ std::string MFNetwork::to_dot() const Map<const MFNode *, dot::NodeWithSocketsRef> dot_nodes; Vector<const MFNode *> all_nodes; - all_nodes.extend(m_function_nodes.as_span()); - all_nodes.extend(m_dummy_nodes.as_span()); + all_nodes.extend(function_nodes_.as_span()); + all_nodes.extend(dummy_nodes_.as_span()); for (const MFNode *node : all_nodes) { dot::Node &dot_node = digraph.new_node(""); Vector<std::string> input_names, output_names; - for (const MFInputSocket *socket : node->m_inputs) { + for (const MFInputSocket *socket : node->inputs_) { input_names.append(socket->name() + "(" + socket->data_type().to_string() + ")"); } - for (const MFOutputSocket *socket : node->m_outputs) { + for (const MFOutputSocket *socket : node->outputs_) { output_names.append(socket->name() + " (" + socket->data_type().to_string() + ")"); } @@ -260,13 +260,13 @@ std::string MFNetwork::to_dot() const for (const MFNode *to_node : all_nodes) { dot::NodeWithSocketsRef to_dot_node = dot_nodes.lookup(to_node); - for (const MFInputSocket *to_socket : to_node->m_inputs) { - const MFOutputSocket *from_socket = to_socket->m_origin; + for (const MFInputSocket *to_socket : to_node->inputs_) { + const MFOutputSocket *from_socket = to_socket->origin_; if (from_socket != nullptr) { - const MFNode *from_node = from_socket->m_node; + const MFNode *from_node = from_socket->node_; dot::NodeWithSocketsRef from_dot_node = dot_nodes.lookup(from_node); - digraph.new_edge(from_dot_node.output(from_socket->m_index), - to_dot_node.input(to_socket->m_index)); + digraph.new_edge(from_dot_node.output(from_socket->index_), + to_dot_node.input(to_socket->index_)); } } } diff --git a/source/blender/functions/intern/multi_function_network_evaluation.cc b/source/blender/functions/intern/multi_function_network_evaluation.cc index 327a3a66561..187af4c8aa6 100644 --- a/source/blender/functions/intern/multi_function_network_evaluation.cc +++ b/source/blender/functions/intern/multi_function_network_evaluation.cc @@ -53,10 +53,10 @@ struct Value; */ class MFNetworkEvaluationStorage { private: - LinearAllocator<> m_allocator; - IndexMask m_mask; - Array<Value *> m_value_per_output_id; - uint m_min_array_size; + LinearAllocator<> allocator_; + IndexMask mask_; + Array<Value *> value_per_output_id_; + uint min_array_size_; public: MFNetworkEvaluationStorage(IndexMask mask, uint max_socket_id); @@ -102,12 +102,12 @@ class MFNetworkEvaluationStorage { MFNetworkEvaluator::MFNetworkEvaluator(Vector<const MFOutputSocket *> inputs, Vector<const MFInputSocket *> outputs) - : m_inputs(std::move(inputs)), m_outputs(std::move(outputs)) + : inputs_(std::move(inputs)), outputs_(std::move(outputs)) { - BLI_assert(m_outputs.size() > 0); + BLI_assert(outputs_.size() > 0); MFSignatureBuilder signature = this->get_builder("Function Tree"); - for (auto socket : m_inputs) { + for (auto socket : inputs_) { BLI_assert(socket->node().is_dummy()); MFDataType type = socket->data_type(); @@ -121,7 +121,7 @@ MFNetworkEvaluator::MFNetworkEvaluator(Vector<const MFOutputSocket *> inputs, } } - for (auto socket : m_outputs) { + for (auto socket : outputs_) { BLI_assert(socket->node().is_dummy()); MFDataType type = socket->data_type(); @@ -142,7 +142,7 @@ void MFNetworkEvaluator::call(IndexMask mask, MFParams params, MFContext context return; } - const MFNetwork &network = m_outputs[0]->node().network(); + const MFNetwork &network = outputs_[0]->node().network(); Storage storage(mask, network.max_socket_id()); Vector<const MFInputSocket *> outputs_to_initialize_in_the_end; @@ -156,9 +156,9 @@ void MFNetworkEvaluator::call(IndexMask mask, MFParams params, MFContext context BLI_NOINLINE void MFNetworkEvaluator::copy_inputs_to_storage(MFParams params, Storage &storage) const { - for (uint input_index : m_inputs.index_range()) { + for (uint input_index : inputs_.index_range()) { uint param_index = input_index + 0; - const MFOutputSocket &socket = *m_inputs[input_index]; + const MFOutputSocket &socket = *inputs_[input_index]; switch (socket.data_type().category()) { case MFDataType::Single: { GVSpan input_list = params.readonly_single_input(param_index); @@ -179,13 +179,13 @@ BLI_NOINLINE void MFNetworkEvaluator::copy_outputs_to_storage( Storage &storage, Vector<const MFInputSocket *> &outputs_to_initialize_in_the_end) const { - for (uint output_index : m_outputs.index_range()) { - uint param_index = output_index + m_inputs.size(); - const MFInputSocket &socket = *m_outputs[output_index]; + for (uint output_index : outputs_.index_range()) { + uint param_index = output_index + inputs_.size(); + const MFInputSocket &socket = *outputs_[output_index]; const MFOutputSocket &origin = *socket.origin(); if (origin.node().is_dummy()) { - BLI_assert(m_inputs.contains(&origin)); + BLI_assert(inputs_.contains(&origin)); /* Don't overwrite input buffers. */ outputs_to_initialize_in_the_end.append(&socket); continue; @@ -216,7 +216,7 @@ BLI_NOINLINE void MFNetworkEvaluator::evaluate_network_to_compute_outputs( MFContext &global_context, Storage &storage) const { Stack<const MFOutputSocket *, 32> sockets_to_compute; - for (const MFInputSocket *socket : m_outputs) { + for (const MFInputSocket *socket : outputs_) { sockets_to_compute.push(socket->origin()); } @@ -386,7 +386,7 @@ BLI_NOINLINE void MFNetworkEvaluator::initialize_remaining_outputs( MFParams params, Storage &storage, Span<const MFInputSocket *> remaining_outputs) const { for (const MFInputSocket *socket : remaining_outputs) { - uint param_index = m_inputs.size() + m_outputs.first_index_of(socket); + uint param_index = inputs_.size() + outputs_.first_index_of(socket); switch (socket->data_type().category()) { case MFDataType::Single: { @@ -509,15 +509,15 @@ struct OwnVectorValue : public Value { * \{ */ MFNetworkEvaluationStorage::MFNetworkEvaluationStorage(IndexMask mask, uint max_socket_id) - : m_mask(mask), - m_value_per_output_id(max_socket_id + 1, nullptr), - m_min_array_size(mask.min_array_size()) + : mask_(mask), + value_per_output_id_(max_socket_id + 1, nullptr), + min_array_size_(mask.min_array_size()) { } MFNetworkEvaluationStorage::~MFNetworkEvaluationStorage() { - for (Value *any_value : m_value_per_output_id) { + for (Value *any_value : value_per_output_id_) { if (any_value == nullptr) { continue; } @@ -529,7 +529,7 @@ MFNetworkEvaluationStorage::~MFNetworkEvaluationStorage() type.destruct(span.buffer()); } else { - type.destruct_indices(span.buffer(), m_mask); + type.destruct_indices(span.buffer(), mask_); MEM_freeN(span.buffer()); } } @@ -542,12 +542,12 @@ MFNetworkEvaluationStorage::~MFNetworkEvaluationStorage() IndexMask MFNetworkEvaluationStorage::mask() const { - return m_mask; + return mask_; } bool MFNetworkEvaluationStorage::socket_is_computed(const MFOutputSocket &socket) { - Value *any_value = m_value_per_output_id[socket.id()]; + Value *any_value = value_per_output_id_[socket.id()]; if (any_value == nullptr) { return false; } @@ -559,7 +559,7 @@ bool MFNetworkEvaluationStorage::socket_is_computed(const MFOutputSocket &socket bool MFNetworkEvaluationStorage::is_same_value_for_every_index(const MFOutputSocket &socket) { - Value *any_value = m_value_per_output_id[socket.id()]; + Value *any_value = value_per_output_id_[socket.id()]; switch (any_value->type) { case ValueType::OwnSingle: return ((OwnSingleValue *)any_value)->span.size() == 1; @@ -580,7 +580,7 @@ bool MFNetworkEvaluationStorage::is_same_value_for_every_index(const MFOutputSoc bool MFNetworkEvaluationStorage::socket_has_buffer_for_output(const MFOutputSocket &socket) { - Value *any_value = m_value_per_output_id[socket.id()]; + Value *any_value = value_per_output_id_[socket.id()]; if (any_value == nullptr) { return false; } @@ -601,7 +601,7 @@ void MFNetworkEvaluationStorage::finish_node(const MFFunctionNode &node) void MFNetworkEvaluationStorage::finish_output_socket(const MFOutputSocket &socket) { - Value *any_value = m_value_per_output_id[socket.id()]; + Value *any_value = value_per_output_id_[socket.id()]; if (any_value == nullptr) { return; } @@ -615,7 +615,7 @@ void MFNetworkEvaluationStorage::finish_input_socket(const MFInputSocket &socket { const MFOutputSocket &origin = *socket.origin(); - Value *any_value = m_value_per_output_id[origin.id()]; + Value *any_value = value_per_output_id_[origin.id()]; if (any_value == nullptr) { /* Can happen when a value has been forward to the next node. */ return; @@ -639,10 +639,10 @@ void MFNetworkEvaluationStorage::finish_input_socket(const MFInputSocket &socket type.destruct(span.buffer()); } else { - type.destruct_indices(span.buffer(), m_mask); + type.destruct_indices(span.buffer(), mask_); MEM_freeN(span.buffer()); } - m_value_per_output_id[origin.id()] = nullptr; + value_per_output_id_[origin.id()] = nullptr; } break; } @@ -652,7 +652,7 @@ void MFNetworkEvaluationStorage::finish_input_socket(const MFInputSocket &socket value->max_remaining_users--; if (value->max_remaining_users == 0) { delete value->vector_array; - m_value_per_output_id[origin.id()] = nullptr; + value_per_output_id_[origin.id()] = nullptr; } break; } @@ -662,53 +662,53 @@ void MFNetworkEvaluationStorage::finish_input_socket(const MFInputSocket &socket void MFNetworkEvaluationStorage::add_single_input_from_caller(const MFOutputSocket &socket, GVSpan virtual_span) { - BLI_assert(m_value_per_output_id[socket.id()] == nullptr); - BLI_assert(virtual_span.size() >= m_min_array_size); + BLI_assert(value_per_output_id_[socket.id()] == nullptr); + BLI_assert(virtual_span.size() >= min_array_size_); - auto *value = m_allocator.construct<InputSingleValue>(virtual_span); - m_value_per_output_id[socket.id()] = value; + auto *value = allocator_.construct<InputSingleValue>(virtual_span); + value_per_output_id_[socket.id()] = value; } void MFNetworkEvaluationStorage::add_vector_input_from_caller(const MFOutputSocket &socket, GVArraySpan virtual_array_span) { - BLI_assert(m_value_per_output_id[socket.id()] == nullptr); - BLI_assert(virtual_array_span.size() >= m_min_array_size); + BLI_assert(value_per_output_id_[socket.id()] == nullptr); + BLI_assert(virtual_array_span.size() >= min_array_size_); - auto *value = m_allocator.construct<InputVectorValue>(virtual_array_span); - m_value_per_output_id[socket.id()] = value; + auto *value = allocator_.construct<InputVectorValue>(virtual_array_span); + value_per_output_id_[socket.id()] = value; } void MFNetworkEvaluationStorage::add_single_output_from_caller(const MFOutputSocket &socket, GMutableSpan span) { - BLI_assert(m_value_per_output_id[socket.id()] == nullptr); - BLI_assert(span.size() >= m_min_array_size); + BLI_assert(value_per_output_id_[socket.id()] == nullptr); + BLI_assert(span.size() >= min_array_size_); - auto *value = m_allocator.construct<OutputSingleValue>(span); - m_value_per_output_id[socket.id()] = value; + auto *value = allocator_.construct<OutputSingleValue>(span); + value_per_output_id_[socket.id()] = value; } void MFNetworkEvaluationStorage::add_vector_output_from_caller(const MFOutputSocket &socket, GVectorArray &vector_array) { - BLI_assert(m_value_per_output_id[socket.id()] == nullptr); - BLI_assert(vector_array.size() >= m_min_array_size); + BLI_assert(value_per_output_id_[socket.id()] == nullptr); + BLI_assert(vector_array.size() >= min_array_size_); - auto *value = m_allocator.construct<OutputVectorValue>(vector_array); - m_value_per_output_id[socket.id()] = value; + auto *value = allocator_.construct<OutputVectorValue>(vector_array); + value_per_output_id_[socket.id()] = value; } GMutableSpan MFNetworkEvaluationStorage::get_single_output__full(const MFOutputSocket &socket) { - Value *any_value = m_value_per_output_id[socket.id()]; + Value *any_value = value_per_output_id_[socket.id()]; if (any_value == nullptr) { const CPPType &type = socket.data_type().single_type(); - void *buffer = MEM_mallocN_aligned(m_min_array_size * type.size(), type.alignment(), AT); - GMutableSpan span(type, buffer, m_min_array_size); + void *buffer = MEM_mallocN_aligned(min_array_size_ * type.size(), type.alignment(), AT); + GMutableSpan span(type, buffer, min_array_size_); - auto *value = m_allocator.construct<OwnSingleValue>(span, socket.targets().size(), false); - m_value_per_output_id[socket.id()] = value; + auto *value = allocator_.construct<OwnSingleValue>(span, socket.targets().size(), false); + value_per_output_id_[socket.id()] = value; return span; } @@ -720,14 +720,14 @@ GMutableSpan MFNetworkEvaluationStorage::get_single_output__full(const MFOutputS GMutableSpan MFNetworkEvaluationStorage::get_single_output__single(const MFOutputSocket &socket) { - Value *any_value = m_value_per_output_id[socket.id()]; + Value *any_value = value_per_output_id_[socket.id()]; if (any_value == nullptr) { const CPPType &type = socket.data_type().single_type(); - void *buffer = m_allocator.allocate(type.size(), type.alignment()); + void *buffer = allocator_.allocate(type.size(), type.alignment()); GMutableSpan span(type, buffer, 1); - auto *value = m_allocator.construct<OwnSingleValue>(span, socket.targets().size(), true); - m_value_per_output_id[socket.id()] = value; + auto *value = allocator_.construct<OwnSingleValue>(span, socket.targets().size(), true); + value_per_output_id_[socket.id()] = value; return value->span; } @@ -741,13 +741,13 @@ GMutableSpan MFNetworkEvaluationStorage::get_single_output__single(const MFOutpu GVectorArray &MFNetworkEvaluationStorage::get_vector_output__full(const MFOutputSocket &socket) { - Value *any_value = m_value_per_output_id[socket.id()]; + Value *any_value = value_per_output_id_[socket.id()]; if (any_value == nullptr) { const CPPType &type = socket.data_type().vector_base_type(); - GVectorArray *vector_array = new GVectorArray(type, m_min_array_size); + GVectorArray *vector_array = new GVectorArray(type, min_array_size_); - auto *value = m_allocator.construct<OwnVectorValue>(*vector_array, socket.targets().size()); - m_value_per_output_id[socket.id()] = value; + auto *value = allocator_.construct<OwnVectorValue>(*vector_array, socket.targets().size()); + value_per_output_id_[socket.id()] = value; return *value->vector_array; } @@ -759,13 +759,13 @@ GVectorArray &MFNetworkEvaluationStorage::get_vector_output__full(const MFOutput GVectorArray &MFNetworkEvaluationStorage::get_vector_output__single(const MFOutputSocket &socket) { - Value *any_value = m_value_per_output_id[socket.id()]; + Value *any_value = value_per_output_id_[socket.id()]; if (any_value == nullptr) { const CPPType &type = socket.data_type().vector_base_type(); GVectorArray *vector_array = new GVectorArray(type, 1); - auto *value = m_allocator.construct<OwnVectorValue>(*vector_array, socket.targets().size()); - m_value_per_output_id[socket.id()] = value; + auto *value = allocator_.construct<OwnVectorValue>(*vector_array, socket.targets().size()); + value_per_output_id_[socket.id()] = value; return *value->vector_array; } @@ -784,8 +784,8 @@ GMutableSpan MFNetworkEvaluationStorage::get_mutable_single__full(const MFInputS const MFOutputSocket &to = output; const CPPType &type = from.data_type().single_type(); - Value *from_any_value = m_value_per_output_id[from.id()]; - Value *to_any_value = m_value_per_output_id[to.id()]; + Value *from_any_value = value_per_output_id_[from.id()]; + Value *to_any_value = value_per_output_id_[to.id()]; BLI_assert(from_any_value != nullptr); BLI_assert(type == to.data_type().single_type()); @@ -793,28 +793,28 @@ GMutableSpan MFNetworkEvaluationStorage::get_mutable_single__full(const MFInputS BLI_assert(to_any_value->type == ValueType::OutputSingle); GMutableSpan span = ((OutputSingleValue *)to_any_value)->span; GVSpan virtual_span = this->get_single_input__full(input); - virtual_span.materialize_to_uninitialized(m_mask, span.buffer()); + virtual_span.materialize_to_uninitialized(mask_, span.buffer()); return span; } if (from_any_value->type == ValueType::OwnSingle) { OwnSingleValue *value = (OwnSingleValue *)from_any_value; if (value->max_remaining_users == 1 && !value->is_single_allocated) { - m_value_per_output_id[to.id()] = value; - m_value_per_output_id[from.id()] = nullptr; + value_per_output_id_[to.id()] = value; + value_per_output_id_[from.id()] = nullptr; value->max_remaining_users = to.targets().size(); return value->span; } } GVSpan virtual_span = this->get_single_input__full(input); - void *new_buffer = MEM_mallocN_aligned(m_min_array_size * type.size(), type.alignment(), AT); - GMutableSpan new_array_ref(type, new_buffer, m_min_array_size); - virtual_span.materialize_to_uninitialized(m_mask, new_array_ref.buffer()); + void *new_buffer = MEM_mallocN_aligned(min_array_size_ * type.size(), type.alignment(), AT); + GMutableSpan new_array_ref(type, new_buffer, min_array_size_); + virtual_span.materialize_to_uninitialized(mask_, new_array_ref.buffer()); - OwnSingleValue *new_value = m_allocator.construct<OwnSingleValue>( + OwnSingleValue *new_value = allocator_.construct<OwnSingleValue>( new_array_ref, to.targets().size(), false); - m_value_per_output_id[to.id()] = new_value; + value_per_output_id_[to.id()] = new_value; return new_array_ref; } @@ -825,8 +825,8 @@ GMutableSpan MFNetworkEvaluationStorage::get_mutable_single__single(const MFInpu const MFOutputSocket &to = output; const CPPType &type = from.data_type().single_type(); - Value *from_any_value = m_value_per_output_id[from.id()]; - Value *to_any_value = m_value_per_output_id[to.id()]; + Value *from_any_value = value_per_output_id_[from.id()]; + Value *to_any_value = value_per_output_id_[to.id()]; BLI_assert(from_any_value != nullptr); BLI_assert(type == to.data_type().single_type()); @@ -842,8 +842,8 @@ GMutableSpan MFNetworkEvaluationStorage::get_mutable_single__single(const MFInpu if (from_any_value->type == ValueType::OwnSingle) { OwnSingleValue *value = (OwnSingleValue *)from_any_value; if (value->max_remaining_users == 1) { - m_value_per_output_id[to.id()] = value; - m_value_per_output_id[from.id()] = nullptr; + value_per_output_id_[to.id()] = value; + value_per_output_id_[from.id()] = nullptr; value->max_remaining_users = to.targets().size(); BLI_assert(value->span.size() == 1); return value->span; @@ -852,13 +852,13 @@ GMutableSpan MFNetworkEvaluationStorage::get_mutable_single__single(const MFInpu GVSpan virtual_span = this->get_single_input__single(input); - void *new_buffer = m_allocator.allocate(type.size(), type.alignment()); + void *new_buffer = allocator_.allocate(type.size(), type.alignment()); type.copy_to_uninitialized(virtual_span.as_single_element(), new_buffer); GMutableSpan new_array_ref(type, new_buffer, 1); - OwnSingleValue *new_value = m_allocator.construct<OwnSingleValue>( + OwnSingleValue *new_value = allocator_.construct<OwnSingleValue>( new_array_ref, to.targets().size(), true); - m_value_per_output_id[to.id()] = new_value; + value_per_output_id_[to.id()] = new_value; return new_array_ref; } @@ -869,8 +869,8 @@ GVectorArray &MFNetworkEvaluationStorage::get_mutable_vector__full(const MFInput const MFOutputSocket &to = output; const CPPType &base_type = from.data_type().vector_base_type(); - Value *from_any_value = m_value_per_output_id[from.id()]; - Value *to_any_value = m_value_per_output_id[to.id()]; + Value *from_any_value = value_per_output_id_[from.id()]; + Value *to_any_value = value_per_output_id_[to.id()]; BLI_assert(from_any_value != nullptr); BLI_assert(base_type == to.data_type().vector_base_type()); @@ -878,15 +878,15 @@ GVectorArray &MFNetworkEvaluationStorage::get_mutable_vector__full(const MFInput BLI_assert(to_any_value->type == ValueType::OutputVector); GVectorArray &vector_array = *((OutputVectorValue *)to_any_value)->vector_array; GVArraySpan virtual_array_span = this->get_vector_input__full(input); - vector_array.extend(m_mask, virtual_array_span); + vector_array.extend(mask_, virtual_array_span); return vector_array; } if (from_any_value->type == ValueType::OwnVector) { OwnVectorValue *value = (OwnVectorValue *)from_any_value; if (value->max_remaining_users == 1) { - m_value_per_output_id[to.id()] = value; - m_value_per_output_id[from.id()] = nullptr; + value_per_output_id_[to.id()] = value; + value_per_output_id_[from.id()] = nullptr; value->max_remaining_users = to.targets().size(); return *value->vector_array; } @@ -894,12 +894,12 @@ GVectorArray &MFNetworkEvaluationStorage::get_mutable_vector__full(const MFInput GVArraySpan virtual_array_span = this->get_vector_input__full(input); - GVectorArray *new_vector_array = new GVectorArray(base_type, m_min_array_size); - new_vector_array->extend(m_mask, virtual_array_span); + GVectorArray *new_vector_array = new GVectorArray(base_type, min_array_size_); + new_vector_array->extend(mask_, virtual_array_span); - OwnVectorValue *new_value = m_allocator.construct<OwnVectorValue>(*new_vector_array, - to.targets().size()); - m_value_per_output_id[to.id()] = new_value; + OwnVectorValue *new_value = allocator_.construct<OwnVectorValue>(*new_vector_array, + to.targets().size()); + value_per_output_id_[to.id()] = new_value; return *new_vector_array; } @@ -911,8 +911,8 @@ GVectorArray &MFNetworkEvaluationStorage::get_mutable_vector__single(const MFInp const MFOutputSocket &to = output; const CPPType &base_type = from.data_type().vector_base_type(); - Value *from_any_value = m_value_per_output_id[from.id()]; - Value *to_any_value = m_value_per_output_id[to.id()]; + Value *from_any_value = value_per_output_id_[from.id()]; + Value *to_any_value = value_per_output_id_[to.id()]; BLI_assert(from_any_value != nullptr); BLI_assert(base_type == to.data_type().vector_base_type()); @@ -928,8 +928,8 @@ GVectorArray &MFNetworkEvaluationStorage::get_mutable_vector__single(const MFInp if (from_any_value->type == ValueType::OwnVector) { OwnVectorValue *value = (OwnVectorValue *)from_any_value; if (value->max_remaining_users == 1) { - m_value_per_output_id[to.id()] = value; - m_value_per_output_id[from.id()] = nullptr; + value_per_output_id_[to.id()] = value; + value_per_output_id_[from.id()] = nullptr; value->max_remaining_users = to.targets().size(); return *value->vector_array; } @@ -940,22 +940,22 @@ GVectorArray &MFNetworkEvaluationStorage::get_mutable_vector__single(const MFInp GVectorArray *new_vector_array = new GVectorArray(base_type, 1); new_vector_array->extend(0, virtual_array_span[0]); - OwnVectorValue *new_value = m_allocator.construct<OwnVectorValue>(*new_vector_array, - to.targets().size()); - m_value_per_output_id[to.id()] = new_value; + OwnVectorValue *new_value = allocator_.construct<OwnVectorValue>(*new_vector_array, + to.targets().size()); + value_per_output_id_[to.id()] = new_value; return *new_vector_array; } GVSpan MFNetworkEvaluationStorage::get_single_input__full(const MFInputSocket &socket) { const MFOutputSocket &origin = *socket.origin(); - Value *any_value = m_value_per_output_id[origin.id()]; + Value *any_value = value_per_output_id_[origin.id()]; BLI_assert(any_value != nullptr); if (any_value->type == ValueType::OwnSingle) { OwnSingleValue *value = (OwnSingleValue *)any_value; if (value->is_single_allocated) { - return GVSpan::FromSingle(value->span.type(), value->span.buffer(), m_min_array_size); + return GVSpan::FromSingle(value->span.type(), value->span.buffer(), min_array_size_); } else { return value->span; @@ -978,7 +978,7 @@ GVSpan MFNetworkEvaluationStorage::get_single_input__full(const MFInputSocket &s GVSpan MFNetworkEvaluationStorage::get_single_input__single(const MFInputSocket &socket) { const MFOutputSocket &origin = *socket.origin(); - Value *any_value = m_value_per_output_id[origin.id()]; + Value *any_value = value_per_output_id_[origin.id()]; BLI_assert(any_value != nullptr); if (any_value->type == ValueType::OwnSingle) { @@ -1005,14 +1005,14 @@ GVSpan MFNetworkEvaluationStorage::get_single_input__single(const MFInputSocket GVArraySpan MFNetworkEvaluationStorage::get_vector_input__full(const MFInputSocket &socket) { const MFOutputSocket &origin = *socket.origin(); - Value *any_value = m_value_per_output_id[origin.id()]; + Value *any_value = value_per_output_id_[origin.id()]; BLI_assert(any_value != nullptr); if (any_value->type == ValueType::OwnVector) { OwnVectorValue *value = (OwnVectorValue *)any_value; if (value->vector_array->size() == 1) { GSpan span = (*value->vector_array)[0]; - return GVArraySpan(span, m_min_array_size); + return GVArraySpan(span, min_array_size_); } else { return *value->vector_array; @@ -1034,7 +1034,7 @@ GVArraySpan MFNetworkEvaluationStorage::get_vector_input__full(const MFInputSock GVArraySpan MFNetworkEvaluationStorage::get_vector_input__single(const MFInputSocket &socket) { const MFOutputSocket &origin = *socket.origin(); - Value *any_value = m_value_per_output_id[origin.id()]; + Value *any_value = value_per_output_id_[origin.id()]; BLI_assert(any_value != nullptr); if (any_value->type == ValueType::OwnVector) { |