21 const bool dst_is_uninitialized)
const
23 if (dst_is_uninitialized) {
32 this->
get(
i, elem_dst);
39 const bool dst_is_uninitialized)
const
41 if (dst_is_uninitialized) {
50 this->
get(i, elem_dst);
57 type_->destruct(r_value);
80 type_->copy_construct(value, buffer);
82 type_->destruct(buffer);
88 type_->destruct(value);
160 const bool dst_is_uninitialized)
const
162 if (dst_is_uninitialized) {
172 const bool dst_is_uninitialized)
const
174 if (dst_is_uninitialized) {
207 const bool dst_is_uninitialized)
const
209 if (dst_is_uninitialized) {
219 const bool dst_is_uninitialized)
const
221 if (dst_is_uninitialized) {
277 type.copy_construct(value, &buffer_);
281 void get(
const int64_t index,
void *r_value)
const final
283 this->get_to_uninitialized(index, r_value);
285 void get_to_uninitialized(
const int64_t ,
void *r_value)
const final
290 void materialize(
const IndexMask &
mask,
292 const bool )
const final
294 type_->fill_construct_indices(buffer_, dst,
mask);
297 void materialize_compressed(
const IndexMask &
mask,
299 const bool )
const final
301 type_->fill_construct_n(buffer_, dst,
mask.size());
325 size_ = varray_.size();
331 owned_data_ = MEM_mallocN_aligned(type_->size * size_, type_->alignment, __func__);
332 varray_.materialize_to_uninitialized(IndexRange(size_), owned_data_);
338 :
GSpan(other.
type_ptr()), varray_(std::move(other.varray_)), owned_data_(other.owned_data_)
344 size_ = varray_.size();
352 other.owned_data_ =
nullptr;
353 other.data_ =
nullptr;
359 if (owned_data_ !=
nullptr) {
367 if (
this == &other) {
370 std::destroy_at(
this);
389 size_ = varray_.size();
392 data_ = const_cast<void *>(info.data);
395 owned_data_ = MEM_mallocN_aligned(type_->size * size_, type_->alignment, __func__);
396 if (copy_values_to_span) {
397 varray_.materialize_to_uninitialized(IndexRange(size_), owned_data_);
400 type_->default_construct_n(owned_data_, size_);
408 varray_(std::move(other.varray_)),
409 owned_data_(other.owned_data_),
410 show_not_saved_warning_(other.show_not_saved_warning_)
415 size_ = varray_.size();
418 data_ = const_cast<void *>(info.data);
423 other.owned_data_ =
nullptr;
424 other.data_ =
nullptr;
431 if (show_not_saved_warning_) {
432 if (!save_has_been_called_) {
433 std::cout <<
"Warning: Call `save()` to make sure that changes persist in all cases.\n";
437 if (owned_data_ !=
nullptr) {
445 if (
this == &other) {
448 std::destroy_at(
this);
455 save_has_been_called_ =
true;
456 if (
data_ != owned_data_) {
459 varray_.set_all(owned_data_);
464 show_not_saved_warning_ =
false;
507 switch (internal_info.
type) {
517 return internal_info;
529 varray_.get_implementation()->materialize(shifted_mask, shifted_dst, dst_is_uninitialized);
534 const bool dst_is_uninitialized)
const final
538 varray_.get_implementation()->materialize_compressed(shifted_mask, dst, dst_is_uninitialized);
556 other.storage_.reset();
557 other.impl_ =
nullptr;
597 impl_->materialize_compressed(
mask, dst,
false);
602 impl_->materialize_compressed(
mask, dst,
true);
607 if (
this == &other) {
616 if (
this == &other) {
619 storage_ = std::move(other.storage_);
621 other.storage_.reset();
622 other.impl_ =
nullptr;
653 impl_->type().default_construct(r_value);
686 if (
type.is_trivial &&
type.size <= 16 &&
type.alignment <= 8) {
810 return this->get_impl();
815 this->get_impl()->set_all(src);
#define BLI_assert_unreachable()
#define BUFFER_FOR_CPP_TYPE_VALUE(type, variable_name)
#define POINTER_OFFSET(v, ofs)
void fill_assign_n(const void *value, void *dst, int64_t n) const
void copy_assign(const void *src, void *dst) const
const CPPType * type_ptr() const
const CPPType & type() const
const GVMutableArray & varray() const
GMutableVArraySpan & operator=(GMutableVArraySpan &&other)
void disable_not_applied_warning()
const CPPType * type_ptr() const
const CPPType & type() const
GSpan slice(const int64_t start, int64_t size) const
CommonVArrayInfo common_info() const
void emplace(Args &&...args)
GSpan get_internal_span() const
void materialize_compressed_to_uninitialized(const IndexMask &mask, void *dst) const
const GVArrayImpl * impl_from_storage() const
void copy_from(const GVArrayCommon &other)
const CPPType & type() const
void move_from(GVArrayCommon &&other) noexcept
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
IndexRange index_range() const
const GVArrayImpl * impl_
void materialize_compressed(const IndexMask &mask, void *dst) const
void get_internal_single(void *r_value) const
GVArrayImpl_For_GArray(GArray<> array)
void materialize(const IndexMask &mask, void *dst, bool dst_is_uninitialized) const override
CommonVArrayInfo common_info() const override
void set_by_move(int64_t index, void *value) override
void get_to_uninitialized(int64_t index, void *r_value) const override
void set_by_relocate(int64_t index, void *value) override
void materialize_compressed(const IndexMask &mask, void *dst, bool dst_is_uninitialized) const override
const int64_t element_size_
GVArrayImpl_For_GSpan(const GMutableSpan span)
void get(int64_t index, void *r_value) const override
void set_by_copy(int64_t index, const void *value) override
void get(const int64_t index, void *r_value) const override
void materialize_compressed(const IndexMask &mask, void *dst, bool dst_is_uninitialized) const override
void get_to_uninitialized(const int64_t index, void *r_value) const override
CommonVArrayInfo common_info() const override
GVArrayImpl_For_SingleValueRef(const CPPType &type, const int64_t size, const void *value)
void materialize(const IndexMask &mask, void *dst, bool dst_is_uninitialized) const override
GVArrayImpl_For_SingleValue(const CPPType &type, const int64_t size, const void *value)
~GVArrayImpl_For_SingleValue() override
CommonVArrayInfo common_info() const override
void materialize_compressed(const IndexMask &mask, void *dst, const bool dst_is_uninitialized) const final
void get(const int64_t index, void *r_value) const override
GVArrayImpl_For_SlicedGVArray(GVArray varray, const IndexRange slice)
void get_to_uninitialized(const int64_t index, void *r_value) const override
void materialize(const IndexMask &mask, void *dst, const bool dst_is_uninitialized) const final
GVArrayImpl_For_SmallTrivialSingleValue(const CPPType &type, const int64_t size, const void *value)
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
GVArraySpan & operator=(GVArraySpan &&other)
GVArray slice(IndexRange slice) const
GVArray & operator=(const GVArray &other)
static GVArray from_empty(const CPPType &type)
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)
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)
virtual void set_by_relocate(int64_t index, void *value)
virtual void set_by_move(int64_t index, void *value)=0
void set_all(const void *src)
void set_by_copy(int64_t index, const void *value)
GVMutableArrayImpl * get_implementation() const
static GVMutableArray from_span(GMutableSpan span)
GMutableSpan get_internal_span() const
GVMutableArray & operator=(const GVMutableArray &other)
void fill(const void *value)
static GVMutableArray from(Args &&...args)
constexpr int64_t one_after_last() const
constexpr int64_t size() const
NonCopyable(const NonCopyable &other)=delete
NonMovable(NonMovable &&other)=delete
void * MEM_mallocN_aligned(size_t len, size_t alignment, const char *str)
void MEM_freeN(void *vmemh)
ccl_device_inline float2 mask(const MaskType mask, const float2 a)