Blender V5.0
BLI_generic_virtual_array.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
13
14#include "BLI_generic_array.hh"
15#include "BLI_generic_span.hh"
16#include "BLI_virtual_array.hh"
17
18namespace blender {
19
20/* -------------------------------------------------------------------- */
23
24class GVArray;
25class GVArrayImpl;
26class GVMutableArray;
28
29/* A generically typed version of #VArrayImpl. */
31 protected:
32 const CPPType *type_;
34
35 public:
37 virtual ~GVArrayImpl() = default;
38
39 const CPPType &type() const;
40
41 int64_t size() const;
42
43 virtual void get(int64_t index, void *r_value) const;
44 virtual void get_to_uninitialized(int64_t index, void *r_value) const = 0;
45
46 virtual CommonVArrayInfo common_info() const;
47
48 virtual void materialize(const IndexMask &mask, void *dst, bool dst_is_uninitialized) const;
49 virtual void materialize_compressed(const IndexMask &mask,
50 void *dst,
51 bool dst_is_uninitialized) const;
52
53 virtual bool try_assign_VArray(void *varray) const;
54};
55
56/* A generic version of #VMutableArrayImpl. */
58 public:
60
61 virtual void set_by_copy(int64_t index, const void *value);
62 virtual void set_by_relocate(int64_t index, void *value);
63 virtual void set_by_move(int64_t index, void *value) = 0;
64
65 virtual void set_all(const void *src);
66
67 virtual bool try_assign_VMutableArray(void *varray) const;
68};
69
71
72/* -------------------------------------------------------------------- */
75
76namespace detail {
78 const GVArrayImpl *(*get_varray)(const void *buffer) =
79 [](const void * /*buffer*/) -> const GVArrayImpl * { return nullptr; };
80
81 template<typename StorageT> static constexpr GVArrayAnyExtraInfo get();
82};
83} // namespace detail
84
85class GVMutableArray;
86
92 protected:
98
99 const GVArrayImpl *impl_ = nullptr;
101
102 GVArrayCommon() = default;
103 GVArrayCommon(const GVArrayCommon &other);
104 GVArrayCommon(GVArrayCommon &&other) noexcept;
105 GVArrayCommon(const GVArrayImpl *impl);
106 GVArrayCommon(std::shared_ptr<const GVArrayImpl> impl);
108
109 template<typename ImplT, typename... Args> void emplace(Args &&...args);
110
111 void copy_from(const GVArrayCommon &other);
112 void move_from(GVArrayCommon &&other) noexcept;
113
114 const GVArrayImpl *impl_from_storage() const;
115
116 public:
117 const CPPType &type() const;
118 operator bool() const;
119
120 int64_t size() const;
121 bool is_empty() const;
122 IndexRange index_range() const;
123
124 template<typename T> bool try_assign_VArray(VArray<T> &varray) const;
125 bool may_have_ownership() const;
126
127 void materialize(void *dst) const;
128 void materialize(const IndexMask &mask, void *dst) const;
129
130 void materialize_to_uninitialized(void *dst) const;
131 void materialize_to_uninitialized(const IndexMask &mask, void *dst) const;
132
133 void materialize_compressed(const IndexMask &mask, void *dst) const;
134 void materialize_compressed_to_uninitialized(const IndexMask &mask, void *dst) const;
135
137
141 bool is_span() const;
146 GSpan get_internal_span() const;
147
151 bool is_single() const;
157 void get_internal_single(void *r_value) const;
161 void get_internal_single_to_uninitialized(void *r_value) const;
162
163 void get(int64_t index, void *r_value) const;
168 template<typename T> T get(int64_t index) const;
169 void get_to_uninitialized(int64_t index, void *r_value) const;
170};
171
173class GVArray : public GVArrayCommon {
174 private:
175 friend GVMutableArray;
176
177 public:
178 GVArray() = default;
179
180 GVArray(const GVArray &other);
181 GVArray(GVArray &&other) noexcept;
182 GVArray(const GVArrayImpl *impl);
183 GVArray(std::shared_ptr<const GVArrayImpl> impl);
184
185 GVArray(varray_tag::span /*tag*/, GSpan span);
186 GVArray(varray_tag::single_ref /*tag*/, const CPPType &type, int64_t size, const void *value);
187 GVArray(varray_tag::single /*tag*/, const CPPType &type, int64_t size, const void *value);
188
189 template<typename T> GVArray(const VArray<T> &varray);
190 template<typename T> GVArray(VArray<T> &&varray);
191 template<typename T> VArray<T> typed() const;
192
193 template<typename ImplT, typename... Args> static GVArray from(Args &&...args);
194
195 static GVArray from_single(const CPPType &type, int64_t size, const void *value);
196 static GVArray from_single_ref(const CPPType &type, int64_t size, const void *value);
198 static GVArray from_span(GSpan span);
200 static GVArray from_empty(const CPPType &type);
201
203
204 GVArray &operator=(const GVArray &other);
205 GVArray &operator=(GVArray &&other) noexcept;
206
208 {
209 return impl_;
210 }
211};
212
215 public:
216 GVMutableArray() = default;
220 GVMutableArray(std::shared_ptr<GVMutableArrayImpl> impl);
221
222 template<typename T> GVMutableArray(const VMutableArray<T> &varray);
223 template<typename T> VMutableArray<T> typed() const;
224
225 template<typename ImplT, typename... Args> static GVMutableArray from(Args &&...args);
226
228
229 operator GVArray() const &;
230 operator GVArray() && noexcept;
231
232 GVMutableArray &operator=(const GVMutableArray &other);
233 GVMutableArray &operator=(GVMutableArray &&other) noexcept;
234
236
237 template<typename T> bool try_assign_VMutableArray(VMutableArray<T> &varray) const;
238
239 void set_by_copy(int64_t index, const void *value);
240 void set_by_move(int64_t index, void *value);
241 void set_by_relocate(int64_t index, void *value);
242
243 void fill(const void *value);
247 void set_all(const void *src);
248
250
251 private:
252 GVMutableArrayImpl *get_impl() const;
253};
254
256
257/* -------------------------------------------------------------------- */
260
261/* A generic version of VArraySpan. */
262class GVArraySpan : public GSpan {
263 private:
264 GVArray varray_;
265 void *owned_data_ = nullptr;
266
267 public:
269 GVArraySpan(GVArray varray);
270 template<typename T> GVArraySpan(VArray<T> varray) : GVArraySpan(GVArray(varray)) {}
271 GVArraySpan(GVArraySpan &&other);
272 ~GVArraySpan();
274};
275
276/* A generic version of MutableVArraySpan. */
278 private:
279 GVMutableArray varray_;
280 void *owned_data_ = nullptr;
281 bool save_has_been_called_ = false;
282 bool show_not_saved_warning_ = true;
283
284 public:
286 GMutableVArraySpan(GVMutableArray varray, bool copy_values_to_span = true);
290
291 const GVMutableArray &varray() const;
292
293 void save();
295};
296
298
299/* -------------------------------------------------------------------- */
302
303/* Used to convert a typed virtual array into a generic one. */
304template<typename T> class GVArrayImpl_For_VArray : public GVArrayImpl {
305 protected:
307
308 public:
310 : GVArrayImpl(CPPType::get<T>(), varray.size()), varray_(std::move(varray))
311 {
312 }
313
314 protected:
315 void get(const int64_t index, void *r_value) const override
316 {
317 *static_cast<T *>(r_value) = varray_[index];
318 }
319
320 void get_to_uninitialized(const int64_t index, void *r_value) const override
321 {
322 new (r_value) T(varray_[index]);
323 }
324
326 void *dst,
327 const bool dst_is_uninitialized) const override
328 {
329 varray_.get_implementation()->materialize(mask, static_cast<T *>(dst), dst_is_uninitialized);
330 }
331
333 void *dst,
334 const bool dst_is_uninitialized) const override
335 {
336 varray_.get_implementation()->materialize_compressed(
337 mask, static_cast<T *>(dst), dst_is_uninitialized);
338 }
339
340 bool try_assign_VArray(void *varray) const override
341 {
342 *(VArray<T> *)varray = varray_;
343 return true;
344 }
345
347 {
348 return varray_.common_info();
349 }
350};
351
352/* Used to convert any generic virtual array into a typed one. */
353template<typename T> class VArrayImpl_For_GVArray : public VArrayImpl<T> {
354 protected:
356
357 public:
358 VArrayImpl_For_GVArray(GVArray varray) : VArrayImpl<T>(varray.size()), varray_(std::move(varray))
359 {
361 BLI_assert(varray_.type().template is<T>());
362 }
363
364 protected:
365 T get(const int64_t index) const override
366 {
367 T value;
368 varray_.get(index, &value);
369 return value;
370 }
371
373 {
374 return varray_.common_info();
375 }
376
377 bool try_assign_GVArray(GVArray &varray) const override
378 {
379 varray = varray_;
380 return true;
381 }
382
383 void materialize(const IndexMask &mask, T *dst, const bool dst_is_uninitialized) const override
384 {
385 varray_.get_implementation()->materialize(mask, dst, dst_is_uninitialized);
386 }
387
389 T *dst,
390 const bool dst_is_uninitialized) const override
391 {
392 varray_.get_implementation()->materialize_compressed(mask, dst, dst_is_uninitialized);
393 }
394};
395
396/* Used to convert any typed virtual mutable array into a generic one. */
397template<typename T> class GVMutableArrayImpl_For_VMutableArray : public GVMutableArrayImpl {
398 protected:
400
401 public:
403 : GVMutableArrayImpl(CPPType::get<T>(), varray.size()), varray_(std::move(varray))
404 {
405 }
406
407 protected:
408 void get(const int64_t index, void *r_value) const override
409 {
410 *static_cast<T *>(r_value) = varray_[index];
411 }
412
413 void get_to_uninitialized(const int64_t index, void *r_value) const override
414 {
415 new (r_value) T(varray_[index]);
416 }
417
419 {
420 return varray_.common_info();
421 }
422
423 void set_by_copy(const int64_t index, const void *value) override
424 {
425 const T &value_ = *(const T *)value;
426 varray_.set(index, value_);
427 }
428
429 void set_by_relocate(const int64_t index, void *value) override
430 {
431 T &value_ = *static_cast<T *>(value);
432 varray_.set(index, std::move(value_));
433 value_.~T();
434 }
435
436 void set_by_move(const int64_t index, void *value) override
437 {
438 T &value_ = *static_cast<T *>(value);
439 varray_.set(index, std::move(value_));
440 }
441
442 void set_all(const void *src) override
443 {
444 varray_.set_all(Span(static_cast<const T *>(src), size_));
445 }
446
448 void *dst,
449 const bool dst_is_uninitialized) const override
450 {
451 varray_.get_implementation()->materialize(mask, static_cast<T *>(dst), dst_is_uninitialized);
452 }
453
455 void *dst,
456 const bool dst_is_uninitialized) const override
457 {
458 varray_.get_implementation()->materialize_compressed(
459 mask, static_cast<T *>(dst), dst_is_uninitialized);
460 }
461
462 bool try_assign_VArray(void *varray) const override
463 {
464 *(VArray<T> *)varray = varray_;
465 return true;
466 }
467
468 bool try_assign_VMutableArray(void *varray) const override
469 {
470 *(VMutableArray<T> *)varray = varray_;
471 return true;
472 }
473};
474
475/* Used to convert an generic mutable virtual array into a typed one. */
476template<typename T> class VMutableArrayImpl_For_GVMutableArray : public VMutableArrayImpl<T> {
477 protected:
479
480 public:
482 : VMutableArrayImpl<T>(varray.size()), varray_(varray)
483 {
485 BLI_assert(varray_.type().template is<T>());
486 }
487
488 private:
489 T get(const int64_t index) const override
490 {
491 T value;
492 varray_.get(index, &value);
493 return value;
494 }
495
496 void set(const int64_t index, T value) override
497 {
498 varray_.set_by_relocate(index, &value);
499 }
500
501 CommonVArrayInfo common_info() const override
502 {
503 return varray_.common_info();
504 }
505
506 bool try_assign_GVArray(GVArray &varray) const override
507 {
508 varray = varray_;
509 return true;
510 }
511
512 bool try_assign_GVMutableArray(GVMutableArray &varray) const override
513 {
514 varray = varray_;
515 return true;
516 }
517
518 void materialize(const IndexMask &mask, T *dst, const bool dst_is_uninitialized) const override
519 {
520 varray_.get_implementation()->materialize(mask, dst, dst_is_uninitialized);
521 }
522
523 void materialize_compressed(const IndexMask &mask,
524 T *dst,
525 const bool dst_is_uninitialized) const override
526 {
527 varray_.get_implementation()->materialize_compressed(mask, dst, dst_is_uninitialized);
528 }
529};
530
532
533/* -------------------------------------------------------------------- */
536
538 protected:
539 void *data_ = nullptr;
541
542 public:
544 : GVMutableArrayImpl(span.type(), span.size()),
545 data_(span.data()),
546 element_size_(span.type().size)
547 {
548 }
549
550 protected:
555
556 public:
557 void get(int64_t index, void *r_value) const override;
558 void get_to_uninitialized(int64_t index, void *r_value) const override;
559
560 void set_by_copy(int64_t index, const void *value) override;
561 void set_by_move(int64_t index, void *value) override;
562 void set_by_relocate(int64_t index, void *value) override;
563
564 CommonVArrayInfo common_info() const override;
565
566 void materialize(const IndexMask &mask, void *dst, bool dst_is_uninitialized) const override;
567
568 void materialize_compressed(const IndexMask &mask,
569 void *dst,
570 bool dst_is_uninitialized) const override;
571};
572
574 public:
576
577 private:
578 CommonVArrayInfo common_info() const override;
579};
580
581template<> inline constexpr bool is_trivial_extended_v<GVArrayImpl_For_GSpan_final> = true;
582
584
585/* -------------------------------------------------------------------- */
588
590 protected:
591 const void *value_ = nullptr;
592
593 public:
594 GVArrayImpl_For_SingleValueRef(const CPPType &type, const int64_t size, const void *value)
595 : GVArrayImpl(type, size), value_(value)
596 {
597 }
598
599 protected:
603
604 void get(const int64_t index, void *r_value) const override;
605 void get_to_uninitialized(const int64_t index, void *r_value) const override;
606 CommonVArrayInfo common_info() const override;
607 void materialize(const IndexMask &mask, void *dst, bool dst_is_uninitialized) const override;
608 void materialize_compressed(const IndexMask &mask,
609 void *dst,
610 bool dst_is_uninitialized) const override;
611};
612
614 public:
616
617 private:
618 CommonVArrayInfo common_info() const override;
619};
620
621template<>
623
625
626/* -------------------------------------------------------------------- */
629
631 : type_(&type), size_(size)
632{
633 BLI_assert(size_ >= 0);
634}
635
636inline const CPPType &GVArrayImpl::type() const
637{
638 return *type_;
639}
640
642{
643 return size_;
644}
645
647
648/* -------------------------------------------------------------------- */
651
652inline void GVMutableArray::set_by_copy(const int64_t index, const void *value)
653{
654 BLI_assert(index >= 0);
655 BLI_assert(index < this->size());
656 this->get_impl()->set_by_copy(index, value);
657}
658
659inline void GVMutableArray::set_by_move(const int64_t index, void *value)
660{
661 BLI_assert(index >= 0);
662 BLI_assert(index < this->size());
663 this->get_impl()->set_by_move(index, value);
664}
665
666inline void GVMutableArray::set_by_relocate(const int64_t index, void *value)
667{
668 BLI_assert(index >= 0);
669 BLI_assert(index < this->size());
670 this->get_impl()->set_by_relocate(index, value);
671}
672
673template<typename T>
675{
676 BLI_assert(impl_->type().is<T>());
677 return this->get_impl()->try_assign_VMutableArray(&varray);
678}
679
680inline GVMutableArrayImpl *GVMutableArray::get_impl() const
681{
682 return const_cast<GVMutableArrayImpl *>(static_cast<const GVMutableArrayImpl *>(impl_));
683}
684
686
687/* -------------------------------------------------------------------- */
690
691template<typename ImplT, typename... Args> inline void GVArrayCommon::emplace(Args &&...args)
692{
693 static_assert(std::is_base_of_v<GVArrayImpl, ImplT>);
694 if constexpr (std::is_copy_constructible_v<ImplT> && Storage::template is_inline_v<ImplT>) {
695 impl_ = &storage_.template emplace<ImplT>(std::forward<Args>(args)...);
696 }
697 else {
698 std::shared_ptr<const GVArrayImpl> ptr = std::make_shared<ImplT>(std::forward<Args>(args)...);
699 impl_ = &*ptr;
700 storage_ = std::move(ptr);
701 }
702}
703
704/* Copies the value at the given index into the provided storage. The `r_value` pointer is
705 * expected to point to initialized memory. */
706inline void GVArrayCommon::get(const int64_t index, void *r_value) const
707{
708 BLI_assert(index >= 0);
709 BLI_assert(index < this->size());
710 impl_->get(index, r_value);
711}
712
713template<typename T> inline T GVArrayCommon::get(const int64_t index) const
714{
715 BLI_assert(index >= 0);
716 BLI_assert(index < this->size());
717 BLI_assert(this->type().is<T>());
718 T value{};
719 impl_->get(index, &value);
720 return value;
721}
722
723/* Same as `get`, but `r_value` is expected to point to uninitialized memory. */
724inline void GVArrayCommon::get_to_uninitialized(const int64_t index, void *r_value) const
725{
726 BLI_assert(index >= 0);
727 BLI_assert(index < this->size());
728 impl_->get_to_uninitialized(index, r_value);
729}
730
731template<typename T> inline bool GVArrayCommon::try_assign_VArray(VArray<T> &varray) const
732{
733 BLI_assert(impl_->type().is<T>());
734 return impl_->try_assign_VArray(&varray);
735}
736
737inline const CPPType &GVArrayCommon::type() const
738{
739 return impl_->type();
740}
741
742inline GVArrayCommon::operator bool() const
743{
744 return impl_ != nullptr;
745}
746
748{
749 return impl_->common_info();
750}
751
753{
754 if (impl_ == nullptr) {
755 return 0;
756 }
757 return impl_->size();
758}
759
760inline bool GVArrayCommon::is_empty() const
761{
762 return this->size() == 0;
763}
764
766
768template<typename T, bool UseSingle, bool UseSpan> struct GVArrayDevirtualizer {
770
771 template<typename Fn> bool devirtualize(const Fn &fn) const
772 {
773 const CommonVArrayInfo info = this->varray_impl.common_info();
774 const int64_t size = this->varray_impl.size();
775 if constexpr (UseSingle) {
777 return fn(SingleAsSpan<T>(*static_cast<const T *>(info.data), size));
778 }
779 }
780 if constexpr (UseSpan) {
782 return fn(Span<T>(static_cast<const T *>(info.data), size));
783 }
784 }
785 return false;
786 }
787};
788
789/* -------------------------------------------------------------------- */
792
793inline GVArray::GVArray(varray_tag::span /*tag*/, const GSpan span)
794{
795 /* Use const-cast because the underlying virtual array implementation is shared between const
796 * and non const data. */
797 GMutableSpan mutable_span{span.type(), const_cast<void *>(span.data()), span.size()};
798 this->emplace<GVArrayImpl_For_GSpan_final>(mutable_span);
799}
800
802 const CPPType &type,
803 const int64_t size,
804 const void *value)
805{
807}
808
809namespace detail {
810template<typename StorageT> constexpr GVArrayAnyExtraInfo GVArrayAnyExtraInfo::get()
811{
812 static_assert(std::is_base_of_v<GVArrayImpl, StorageT> ||
814
815 if constexpr (std::is_base_of_v<GVArrayImpl, StorageT>) {
816 return {[](const void *buffer) {
817 return static_cast<const GVArrayImpl *>((const StorageT *)buffer);
818 }};
819 }
820 else if constexpr (std::is_same_v<StorageT, const GVArrayImpl *>) {
821 return {[](const void *buffer) { return *(const StorageT *)buffer; }};
822 }
823 else if constexpr (std::is_same_v<StorageT, std::shared_ptr<const GVArrayImpl>>) {
824 return {[](const void *buffer) { return ((const StorageT *)buffer)->get(); }};
825 }
826 else {
828 return {};
829 }
830}
831} // namespace detail
832
833template<typename ImplT, typename... Args> inline GVArray GVArray::from(Args &&...args)
834{
835 static_assert(std::is_base_of_v<GVArrayImpl, ImplT>);
836 GVArray varray;
837 varray.template emplace<ImplT>(std::forward<Args>(args)...);
838 return varray;
839}
840
841template<typename T> inline GVArray::GVArray(const VArray<T> &varray) : GVArray(VArray<T>(varray))
842{
843}
844
845template<typename T> inline GVArray::GVArray(VArray<T> &&varray)
846{
847 if (!varray) {
848 return;
849 }
850 const CommonVArrayInfo info = varray.common_info();
852 *this = GVArray::from_single(CPPType::get<T>(), varray.size(), info.data);
853 return;
854 }
855 /* Need to check for ownership, because otherwise the referenced data can be destructed when
856 * #this is destructed. */
858 *this = GVArray::from_span(GSpan(CPPType::get<T>(), info.data, varray.size()));
859 return;
860 }
861 if (varray.try_assign_GVArray(*this)) {
862 return;
863 }
864 *this = GVArray::from<GVArrayImpl_For_VArray<T>>(std::move(varray));
865}
866
867template<typename T> inline VArray<T> GVArray::typed() const
868{
869 if (!*this) {
870 return {};
871 }
872 BLI_assert(impl_->type().is<T>());
873 const CommonVArrayInfo info = this->common_info();
875 return VArray<T>::from_single(*static_cast<const T *>(info.data), this->size());
876 }
877 /* Need to check for ownership, because otherwise the referenced data can be destructed when
878 * #this is destructed. */
880 return VArray<T>::from_span(Span<T>(static_cast<const T *>(info.data), this->size()));
881 }
882 VArray<T> varray;
883 if (this->try_assign_VArray(varray)) {
884 return varray;
885 }
887}
888
890
891/* -------------------------------------------------------------------- */
894
895template<typename ImplT, typename... Args>
897{
898 static_assert(std::is_base_of_v<GVMutableArrayImpl, ImplT>);
899 GVMutableArray varray;
900 varray.emplace<ImplT>(std::forward<Args>(args)...);
901 return varray;
902}
903
904template<typename T> inline GVMutableArray::GVMutableArray(const VMutableArray<T> &varray)
905{
906 if (!varray) {
907 return;
908 }
909 const CommonVArrayInfo info = varray.common_info();
912 GMutableSpan(CPPType::get<T>(), const_cast<void *>(info.data), varray.size()));
913 return;
914 }
915 if (varray.try_assign_GVMutableArray(*this)) {
916 return;
917 }
919}
920
921template<typename T> inline VMutableArray<T> GVMutableArray::typed() const
922{
923 if (!*this) {
924 return {};
925 }
926 BLI_assert(this->type().is<T>());
927 const CommonVArrayInfo info = this->common_info();
930 MutableSpan<T>(const_cast<T *>(static_cast<const T *>(info.data)), this->size()));
931 }
932 VMutableArray<T> varray;
933 if (this->try_assign_VMutableArray(varray)) {
934 return varray;
935 }
937}
938
940
941} // namespace blender
#define BLI_assert_unreachable()
Definition BLI_assert.h:93
#define BLI_assert(a)
Definition BLI_assert.h:46
#define final(a, b, c)
Definition BLI_hash.h:19
BMesh const char void * data
long long int int64_t
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition btDbvt.cpp:52
btGeneric6DofConstraint & operator=(btGeneric6DofConstraint &other)
static const CPPType & get()
const GVMutableArray & varray() const
const CPPType & type() const
GSpan()=default
const void * data() const
int64_t size() const
CommonVArrayInfo common_info() const
bool may_have_ownership() const
void materialize_compressed_to_uninitialized(const IndexMask &mask, void *dst) const
const GVArrayImpl * impl_from_storage() const
bool try_assign_VArray(VArray< T > &varray) const
void copy_from(const GVArrayCommon &other)
void move_from(GVArrayCommon &&other) noexcept
void get_to_uninitialized(int64_t index, void *r_value) const
void materialize(void *dst) const
void get_internal_single_to_uninitialized(void *r_value) const
void materialize_to_uninitialized(void *dst) const
void get(int64_t index, void *r_value) const
Any< detail::GVArrayAnyExtraInfo, 40, 8 > Storage
void materialize_compressed(const IndexMask &mask, void *dst) const
void get_internal_single(void *r_value) const
GVArrayImpl_For_GSpan(const CPPType &type, int64_t size)
GVArrayImpl_For_GSpan(const GMutableSpan span)
GVArrayImpl_For_SingleValueRef(const CPPType &type, const int64_t size, const void *value)
GVArrayImpl_For_SingleValueRef(const CPPType &type, const int64_t size, const void *value)
GVArrayImpl_For_SingleValueRef(const CPPType &type, const int64_t size)
bool try_assign_VArray(void *varray) const override
void materialize(const IndexMask &mask, void *dst, const bool dst_is_uninitialized) const override
void get(const int64_t index, void *r_value) const override
void get_to_uninitialized(const int64_t index, void *r_value) const override
CommonVArrayInfo common_info() const override
void materialize_compressed(const IndexMask &mask, void *dst, const bool dst_is_uninitialized) const override
virtual void materialize(const IndexMask &mask, void *dst, bool dst_is_uninitialized) const
virtual void get_to_uninitialized(int64_t index, void *r_value) const =0
virtual void get(int64_t index, void *r_value) const
virtual bool try_assign_VArray(void *varray) const
virtual void materialize_compressed(const IndexMask &mask, void *dst, bool dst_is_uninitialized) const
GVArrayImpl(const CPPType &type, int64_t size)
virtual CommonVArrayInfo common_info() const
const CPPType & type() const
virtual ~GVArrayImpl()=default
GVArray slice(IndexRange slice) const
GVArray()=default
GVArray & operator=(const GVArray &other)
GVArray(const GVArray &other)
static GVArray from_empty(const CPPType &type)
const GVArrayImpl * get_implementation() const
GVArray(GVArray &&other) noexcept
static GVArray from(Args &&...args)
static GVArray from_single_default(const CPPType &type, int64_t size)
static GVArray from_garray(GArray<> array)
static GVArray from_single(const CPPType &type, int64_t size, const void *value)
static GVArray from_span(GSpan span)
static GVArray from_single_ref(const CPPType &type, int64_t size, const void *value)
void materialize(const IndexMask &mask, void *dst, const bool dst_is_uninitialized) const override
void set_by_copy(const int64_t index, const void *value) override
bool try_assign_VMutableArray(void *varray) const override
void get(const int64_t index, void *r_value) const override
void get_to_uninitialized(const int64_t index, void *r_value) const override
void set_by_relocate(const int64_t index, void *value) override
void materialize_compressed(const IndexMask &mask, void *dst, const bool dst_is_uninitialized) const override
void set_by_move(const int64_t index, void *value) override
virtual bool try_assign_VMutableArray(void *varray) const
virtual void set_all(const void *src)
virtual void set_by_copy(int64_t index, const void *value)
GVMutableArrayImpl(const CPPType &type, int64_t size)
virtual void set_by_relocate(int64_t index, void *value)
virtual void set_by_move(int64_t index, void *value)=0
GVMutableArray(GVMutableArray &&other) noexcept
void set_by_move(int64_t index, void *value)
void set_all(const void *src)
void set_by_copy(int64_t index, const void *value)
GVMutableArray(const GVMutableArray &other)
GVMutableArrayImpl * get_implementation() const
static GVMutableArray from_span(GMutableSpan span)
GMutableSpan get_internal_span() const
bool try_assign_VMutableArray(VMutableArray< T > &varray) const
GVMutableArray & operator=(const GVMutableArray &other)
void fill(const void *value)
static GVMutableArray from(Args &&...args)
VMutableArray< T > typed() const
void set_by_relocate(int64_t index, void *value)
NonCopyable(const NonCopyable &other)=delete
NonMovable(NonMovable &&other)=delete
CommonVArrayInfo common_info() const
void materialize(const IndexMask &mask, T *dst, const bool dst_is_uninitialized) const override
void materialize_compressed(const IndexMask &mask, T *dst, const bool dst_is_uninitialized) const override
bool try_assign_GVArray(GVArray &varray) const override
CommonVArrayInfo common_info() const override
T get(const int64_t index) const override
VArrayImpl(const int64_t size)
static VArray from_single(T value, const int64_t size)
static VArray from_span(Span< T > values)
bool try_assign_GVMutableArray(GVMutableArray &varray) const
static VMutableArray from_span(MutableSpan< T > values)
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
#define T
constexpr bool is_same_any_v
constexpr bool is_trivial_extended_v
static constexpr GVArrayAnyExtraInfo get()
PointerRNA * ptr
Definition wm_files.cc:4238