Blender V4.3
blender::VMutableArray< T > Class Template Reference

#include <BLI_virtual_array.hh>

Inherits blender::VArrayCommon< T >.

Public Member Functions

 VMutableArray ()=default
 
 VMutableArray (const VMutableArray &other)=default
 
 VMutableArray (VMutableArray &&other) noexcept=default
 
 VMutableArray (const VMutableArrayImpl< T > *impl)
 
 VMutableArray (std::shared_ptr< const VMutableArrayImpl< T > > impl)
 
 operator VArray< T > () const &
 
 operator VArray< T > () &&noexcept
 
VMutableArrayoperator= (const VMutableArray &other)
 
VMutableArrayoperator= (VMutableArray &&other) noexcept
 
MutableSpan< Tget_internal_span () const
 
void set (const int64_t index, T value)
 
void set_all (Span< T > src)
 
bool try_assign_GVMutableArray (GVMutableArray &varray) const
 
- Public Member Functions inherited from blender::VArrayCommon< T >
 operator bool () const
 
T operator[] (const int64_t index) const
 
T get (const int64_t index) const
 
int64_t size () const
 
T first () const
 
T last (const int64_t n=0) const
 
bool is_empty () const
 
IndexRange index_range () const
 
CommonVArrayInfo common_info () const
 
bool is_span () const
 
Span< Tget_internal_span () const
 
bool is_single () const
 
T get_internal_single () const
 
std::optional< Tget_if_single () const
 
void materialize (MutableSpan< T > r_span) const
 
void materialize (const IndexMask &mask, MutableSpan< T > r_span) const
 
void materialize_to_uninitialized (MutableSpan< T > r_span) const
 
void materialize_to_uninitialized (const IndexMask &mask, MutableSpan< T > r_span) const
 
void materialize_compressed (const IndexMask &mask, MutableSpan< T > r_span) const
 
void materialize_compressed_to_uninitialized (const IndexMask &mask, MutableSpan< T > r_span) const
 
bool try_assign_GVArray (GVArray &varray) const
 
const VArrayImpl< T > * get_implementation () const
 

Static Public Member Functions

template<typename ImplT , typename... Args>
static VMutableArray For (Args &&...args)
 
static VMutableArray ForSpan (MutableSpan< T > values)
 
template<typename StructT , T(*)(const StructT &) GetFunc, void(*)(StructT &, T) SetFunc>
static VMutableArray ForDerivedSpan (MutableSpan< StructT > values)
 

Additional Inherited Members

- Protected Types inherited from blender::VArrayCommon< T >
using Storage = Any<blender::detail::VArrayAnyExtraInfo<T>, 24, 8>
 
- Protected Member Functions inherited from blender::VArrayCommon< T >
 VArrayCommon ()=default
 
 VArrayCommon (const VArrayCommon &other)
 
 VArrayCommon (VArrayCommon &&other) noexcept
 
 VArrayCommon (const VArrayImpl< T > *impl)
 
 VArrayCommon (std::shared_ptr< const VArrayImpl< T > > impl)
 
template<typename ImplT , typename... Args>
void emplace (Args &&...args)
 
void copy_from (const VArrayCommon &other)
 
void move_from (VArrayCommon &&other) noexcept
 
const VArrayImpl< T > * impl_from_storage () const
 
- Protected Attributes inherited from blender::VArrayCommon< T >
const VArrayImpl< T > * impl_ = nullptr
 
Storage storage_
 

Detailed Description

template<typename T>
class blender::VMutableArray< T >

Similar to #VArray but references a virtual array that can be modified.

Definition at line 10 of file BLI_virtual_array_fwd.hh.

Constructor & Destructor Documentation

◆ VMutableArray() [1/5]

template<typename T >
blender::VMutableArray< T >::VMutableArray ( )
default

◆ VMutableArray() [2/5]

template<typename T >
blender::VMutableArray< T >::VMutableArray ( const VMutableArray< T > & other)
default

◆ VMutableArray() [3/5]

template<typename T >
blender::VMutableArray< T >::VMutableArray ( VMutableArray< T > && other)
defaultnoexcept

◆ VMutableArray() [4/5]

template<typename T >
blender::VMutableArray< T >::VMutableArray ( const VMutableArrayImpl< T > * impl)
inline

Definition at line 903 of file BLI_virtual_array.hh.

◆ VMutableArray() [5/5]

template<typename T >
blender::VMutableArray< T >::VMutableArray ( std::shared_ptr< const VMutableArrayImpl< T > > impl)
inline

Definition at line 905 of file BLI_virtual_array.hh.

Member Function Documentation

◆ For()

template<typename T >
template<typename ImplT , typename... Args>
static VMutableArray blender::VMutableArray< T >::For ( Args &&... args)
inlinestatic

Construct a new virtual array for a custom #VMutableArrayImpl.

Definition at line 913 of file BLI_virtual_array.hh.

References blender::VArrayCommon< T >::emplace().

Referenced by blender::VMutableArray< T >::ForDerivedSpan(), and blender::VMutableArray< T >::ForSpan().

◆ ForDerivedSpan()

template<typename T >
template<typename StructT , T(*)(const StructT &) GetFunc, void(*)(StructT &, T) SetFunc>
static VMutableArray blender::VMutableArray< T >::ForDerivedSpan ( MutableSpan< StructT > values)
inlinestatic

Construct a new virtual array for an existing span with a mapping function. This does not take ownership of the span.

Definition at line 934 of file BLI_virtual_array.hh.

References blender::VMutableArray< T >::For().

Referenced by blender::bke::instance_position_varray_for_write().

◆ ForSpan()

template<typename T >
static VMutableArray blender::VMutableArray< T >::ForSpan ( MutableSpan< T > values)
inlinestatic

Construct a new virtual array for an existing span. This does not take ownership of the span.

Definition at line 924 of file BLI_virtual_array.hh.

References blender::VMutableArray< T >::For().

Referenced by blender::tests::TEST(), and blender::GVMutableArray::typed().

◆ get_internal_span()

template<typename T >
MutableSpan< T > blender::VMutableArray< T >::get_internal_span ( ) const
inline

Get access to the internal span. This invokes undefined behavior if the is_span returned false.

Definition at line 971 of file BLI_virtual_array.hh.

References BLI_assert, blender::CommonVArrayInfo::data, and blender::VArrayCommon< T >::is_span().

◆ operator VArray< T >() [1/2]

template<typename T >
blender::VMutableArray< T >::operator VArray< T > ( ) &&
inlinenoexcept

Convert to a #VArray by moving.

Definition at line 948 of file BLI_virtual_array.hh.

◆ operator VArray< T >() [2/2]

template<typename T >
blender::VMutableArray< T >::operator VArray< T > ( ) const &
inline

Convert to a #VArray by copying.

Definition at line 940 of file BLI_virtual_array.hh.

◆ operator=() [1/2]

template<typename T >
VMutableArray & blender::VMutableArray< T >::operator= ( const VMutableArray< T > & other)
inline

Definition at line 955 of file BLI_virtual_array.hh.

References blender::VArrayCommon< T >::copy_from().

◆ operator=() [2/2]

template<typename T >
VMutableArray & blender::VMutableArray< T >::operator= ( VMutableArray< T > && other)
inlinenoexcept

Definition at line 961 of file BLI_virtual_array.hh.

References blender::VArrayCommon< T >::move_from().

◆ set()

◆ set_all()

template<typename T >
void blender::VMutableArray< T >::set_all ( Span< T > src)
inline

Copy the values from the source span to all elements in the virtual array.

Definition at line 991 of file BLI_virtual_array.hh.

References BLI_assert, and blender::Span< T >::size().

Referenced by blender::GVMutableArrayImpl_For_VMutableArray< T >::set_all().

◆ try_assign_GVMutableArray()

template<typename T >
bool blender::VMutableArray< T >::try_assign_GVMutableArray ( GVMutableArray< T > & varray) const
inline

See #GVMutableArrayImpl::try_assign_GVMutableArray.

Definition at line 998 of file BLI_virtual_array.hh.

Referenced by blender::GVMutableArray::GVMutableArray().


The documentation for this class was generated from the following files: