Blender
V3.3
|
#include <BLI_virtual_array.hh>
Public Member Functions | |
operator bool () const | |
T | operator[] (const int64_t index) const |
T | get (const int64_t index) const |
int64_t | size () const |
bool | is_empty () const |
IndexRange | index_range () const |
CommonVArrayInfo | common_info () const |
bool | is_span () const |
Span< T > | get_internal_span () const |
bool | is_single () const |
T | get_internal_single () const |
bool | is_same (const VArrayCommon< T > &other) const |
void | materialize (MutableSpan< T > r_span) const |
void | materialize (IndexMask mask, MutableSpan< T > r_span) const |
void | materialize_to_uninitialized (MutableSpan< T > r_span) const |
void | materialize_to_uninitialized (IndexMask mask, MutableSpan< T > r_span) const |
void | materialize_compressed (IndexMask mask, MutableSpan< T > r_span) const |
void | materialize_compressed_to_uninitialized (IndexMask mask, MutableSpan< T > r_span) const |
bool | try_assign_GVArray (GVArray &varray) const |
Protected Types | |
using | Storage = Any< detail::VArrayAnyExtraInfo< T >, 24, 8 > |
Protected Member Functions | |
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 | |
const VArrayImpl< T > * | impl_ = nullptr |
Storage | storage_ |
Utility class to reduce code duplication for methods available on #VArray and #VMutableArray. Deriving #VMutableArray from #VArray would have some issues:
Definition at line 589 of file BLI_virtual_array.hh.
|
protected |
Store the virtual array implementation in an #Any. This makes it easy to avoid a memory allocation if the implementation is small enough and is copyable. This is the case for the most common virtual arrays. Other virtual array implementations are typically stored as #std::shared_ptr. That works even when the implementation itself is not copyable and makes copying VArrayCommon cheaper.
Definition at line 598 of file BLI_virtual_array.hh.
|
protecteddefault |
|
inlineprotected |
Copy constructor.
Definition at line 617 of file BLI_virtual_array.hh.
|
inlineprotectednoexcept |
Move constructor.
Definition at line 623 of file BLI_virtual_array.hh.
|
inlineprotected |
Wrap an existing #VArrayImpl and don't take ownership of it. This should rarely be used in practice.
Definition at line 634 of file BLI_virtual_array.hh.
|
inlineprotected |
Wrap an existing #VArrayImpl that is contained in a #std::shared_ptr. This takes ownership.
Definition at line 642 of file BLI_virtual_array.hh.
References impl.
|
inline |
Definition at line 755 of file BLI_virtual_array.hh.
References BLI_assert, and blender::VArrayImpl< T >::common_info().
Referenced by blender::GVArrayImpl_For_VArray< T >::common_info(), blender::GVMutableArrayImpl_For_VMutableArray< T >::common_info(), blender::GVArray::GVArray(), blender::GVMutableArray::GVMutableArray(), blender::MutableVArraySpan< T >::MutableVArraySpan(), and blender::VArraySpan< T >::VArraySpan().
|
inlineprotected |
Utility to implement a copy assignment operator in a subclass.
Definition at line 672 of file BLI_virtual_array.hh.
References blender::VArrayCommon< T >::storage_.
Referenced by blender::VMutableArray< T >::operator VArray< T >(), blender::VArray< T >::operator=(), and blender::VMutableArray< T >::operator=().
|
inlineprotected |
Replace the contained #VArrayImpl.
Definition at line 652 of file BLI_virtual_array.hh.
References ptr.
|
inline |
Same as the operator[] but is sometimes easier to use when one has a pointer to a virtual array.
Definition at line 727 of file BLI_virtual_array.hh.
Referenced by blender::fn::tests::TEST(), and blender::tests::TEST().
|
inline |
Return the value that is returned for every index. This invokes undefined behavior if the virtual array would not return the same value for every index.
Definition at line 792 of file BLI_virtual_array.hh.
References BLI_assert, blender::VArrayImpl< T >::common_info(), blender::CommonVArrayInfo::data, and T.
Referenced by blender::nodes::node_geo_instance_on_points_cc::add_instances_from_component(), blender::nodes::node_geo_curve_sample_cc::SampleCurveFunction::call(), blender::bke::CurvesGeometry::evaluated_normals(), everything_selected(), blender::fn::materialize_detail::execute_materialized(), blender::index_mask_ops::find_indices_from_virtual_array(), blender::fn::FieldEvaluator::get_evaluated_as_mask(), blender::nodes::node_geo_input_curve_handles_cc::HandlePositionFieldInput::get_varray_for_context(), blender::ed::sculpt_paint::retrieve_selected_curves(), blender::ed::sculpt_paint::retrieve_selected_points(), and blender::nodes::node_geo_delete_geometry_cc::separate_mesh_selection().
|
inline |
Returns the internally used span of the virtual array. This invokes undefined behavior if the virtual array is not stored as a span internally.
Definition at line 773 of file BLI_virtual_array.hh.
References BLI_assert, blender::VArrayImpl< T >::common_info(), blender::CommonVArrayInfo::data, and T.
Referenced by blender::bke::CurvesGeometry::evaluated_normals(), blender::fn::materialize_detail::execute_materialized(), blender::index_mask_ops::find_indices_from_virtual_array(), blender::geometry::preprocess_pointclouds(), blender::tests::TEST(), blender::nodes::node_geo_curve_trim_cc::to_single_point_nurbs(), and blender::nodes::node_geo_curve_trim_cc::trim_nurbs_spline().
|
inlineprotected |
Get a pointer to the virtual array implementation that is currently stored in storage_, or null.
Definition at line 695 of file BLI_virtual_array.hh.
References blender::Any< ExtraInfo, InlineBufferCapacity, Alignment >::extra_info(), blender::Any< ExtraInfo, InlineBufferCapacity, Alignment >::get(), and blender::Any< ExtraInfo, InlineBufferCapacity, Alignment >::has_value().
|
inline |
Definition at line 750 of file BLI_virtual_array.hh.
References size().
Referenced by curves_to_curve_eval(), blender::nodes::node_geo_accumulate_field_cc::AccumulateFieldInput< T >::get_varray_for_context(), blender::nodes::node_geo_accumulate_field_cc::TotalFieldInput< T >::get_varray_for_context(), and blender::ed::sculpt_paint::select_grow::select_grow_invoke_per_curve().
|
inline |
True when the size is zero or when there is no virtual array.
Definition at line 745 of file BLI_virtual_array.hh.
References size().
Referenced by blender::nodes::node_geo_transfer_attribute_cc::copy_with_indices_and_comparison(), blender::nodes::node_geo_delete_geometry_cc::separate_mesh_selection(), and blender::tests::TEST().
|
inline |
Return true when the other virtual references the same underlying memory.
Definition at line 802 of file BLI_virtual_array.hh.
References blender::VArrayCommon< T >::impl_, and blender::VArrayImpl< T >::is_same().
Referenced by blender::nodes::node_geo_set_position_cc::set_computed_position_and_offset().
|
inline |
Return true when the virtual array returns the same value for every index.
Definition at line 781 of file BLI_virtual_array.hh.
References BLI_assert, blender::VArrayImpl< T >::common_info(), blender::CommonVArrayInfo::Single, and blender::CommonVArrayInfo::type.
Referenced by blender::nodes::node_geo_instance_on_points_cc::add_instances_from_component(), blender::nodes::node_geo_curve_sample_cc::SampleCurveFunction::call(), blender::bke::CurvesGeometry::evaluated_normals(), everything_selected(), blender::fn::materialize_detail::execute_materialized(), blender::nodes::node_geo_extrude_mesh_cc::extrude_mesh_edges(), blender::nodes::node_geo_extrude_mesh_cc::extrude_mesh_face_regions(), blender::index_mask_ops::find_indices_from_virtual_array(), blender::fn::FieldEvaluator::get_evaluated_as_mask(), blender::nodes::node_geo_input_curve_handles_cc::HandlePositionFieldInput::get_varray_for_context(), blender::ed::sculpt_paint::retrieve_selected_curves(), blender::ed::sculpt_paint::retrieve_selected_points(), blender::nodes::node_geo_delete_geometry_cc::separate_mesh_selection(), and blender::tests::TEST().
|
inline |
Return true when the virtual array is stored as a span internally.
Definition at line 762 of file BLI_virtual_array.hh.
References BLI_assert, blender::VArrayImpl< T >::common_info(), blender::CommonVArrayInfo::Span, and blender::CommonVArrayInfo::type.
Referenced by blender::fn::materialize_detail::execute_materialized(), blender::index_mask_ops::find_indices_from_virtual_array(), blender::VMutableArray< T >::get_internal_span(), and blender::tests::TEST().
|
inline |
Copy some indices of the virtual array into a span.
Definition at line 825 of file BLI_virtual_array.hh.
References BLI_assert, mask(), and blender::VArrayImpl< T >::materialize().
|
inline |
Copy the entire virtual array into a span.
Definition at line 819 of file BLI_virtual_array.hh.
References size().
Referenced by BKE_pointcloud_from_mesh(), blender::ed::curves::set_selection_domain::curves_set_selection_domain_exec(), NURBSpline::evaluated_positions(), blender::geometry::execute_realize_curve_task(), blender::ed::geometry::geometry_attribute_convert_exec(), blender::GVArrayImpl_For_VArray< T >::materialize(), blender::GVMutableArrayImpl_For_VMutableArray< T >::materialize(), blender::ed::sculpt_paint::select_grow::select_grow_invoke_per_curve(), and blender::nodes::node_geo_set_id_cc::set_id_in_component().
|
inline |
Copy some elements of the virtual array into a span.
Definition at line 843 of file BLI_virtual_array.hh.
References mask(), and blender::VArrayImpl< T >::materialize_compressed().
Referenced by blender::GVArrayImpl_For_VArray< T >::materialize_compressed(), blender::GVMutableArrayImpl_For_VMutableArray< T >::materialize_compressed(), and blender::tests::TEST().
|
inline |
Definition at line 848 of file BLI_virtual_array.hh.
References mask(), and blender::VArrayImpl< T >::materialize_compressed_to_uninitialized().
Referenced by blender::fn::materialize_detail::execute_materialized(), blender::GVArrayImpl_For_VArray< T >::materialize_compressed_to_uninitialized(), blender::GVMutableArrayImpl_For_VMutableArray< T >::materialize_compressed_to_uninitialized(), and blender::tests::TEST().
|
inline |
Definition at line 836 of file BLI_virtual_array.hh.
References BLI_assert, mask(), and blender::VArrayImpl< T >::materialize_to_uninitialized().
|
inline |
Definition at line 831 of file BLI_virtual_array.hh.
References size().
Referenced by blender::GVArrayImpl_For_VArray< T >::materialize_to_uninitialized(), blender::GVMutableArrayImpl_For_VMutableArray< T >::materialize_to_uninitialized(), blender::MutableVArraySpan< T >::MutableVArraySpan(), and blender::VArraySpan< T >::VArraySpan().
|
inlineprotectednoexcept |
Utility to implement a move assignment operator in a subclass.
Definition at line 682 of file BLI_virtual_array.hh.
Referenced by blender::VMutableArray< T >::operator VArray< T >(), blender::VArray< T >::operator=(), and blender::VMutableArray< T >::operator=().
|
inline |
Return false when there is no virtual array implementation currently.
Definition at line 705 of file BLI_virtual_array.hh.
|
inline |
Get the element at a specific index.
Definition at line 715 of file BLI_virtual_array.hh.
References BLI_assert, blender::VArrayImpl< T >::get(), and size().
|
inline |
Return the size of the virtual array. It's allowed to call this method even when there is no virtual array. In this case 0 is returned.
Definition at line 736 of file BLI_virtual_array.hh.
References blender::VArrayImpl< T >::size().
Referenced by blender::VArray< T >::ForFunc(), blender::VArray< T >::ForSingle(), blender::fn::FieldEvaluator::get_evaluated_as_mask(), blender::GVArray::GVArray(), blender::GVMutableArray::GVMutableArray(), blender::MutableVArraySpan< T >::MutableVArraySpan(), blender::ed::sculpt_paint::select_grow::select_grow_invoke_per_curve(), blender::VMutableArray< T >::set(), blender::tests::TEST(), blender::VArray< T >::VArray(), and blender::VArraySpan< T >::VArraySpan().
|
inline |
See #GVArrayImpl::try_assign_GVArray.
Definition at line 854 of file BLI_virtual_array.hh.
References blender::VArrayImpl< T >::try_assign_GVArray().
Referenced by blender::GVArray::GVArray().
|
protected |
Pointer to the currently contained virtual array implementation. This is allowed to be null.
Definition at line 603 of file BLI_virtual_array.hh.
Referenced by blender::VArrayCommon< T >::is_same().
|
protected |
Does the memory management for the virtual array implementation. It contains one of the following:
Definition at line 611 of file BLI_virtual_array.hh.
Referenced by blender::VArrayCommon< T >::copy_from().