|
Blender V5.0
|
#include <BLI_index_ranges_builder.hh>
Inherits blender::NonCopyable, and blender::NonMovable.
Public Member Functions | |
| IndexRangesBuilder (MutableSpan< T > data) | |
| bool | add (const T index) |
| bool | add_range (const T start, const T end) |
| int64_t | size () const |
| int64_t | capacity () const |
| bool | is_empty () const |
| IndexRange | index_range () const |
| IndexRange | operator[] (const int64_t i) const |
Static Public Member Functions | |
| static constexpr int64_t | buffer_size_for_ranges_num (const int64_t ranges_num) |
A data structure that is designed to allow building many index ranges efficiently.
One first has to add individual indices or ranges in ascending order. Internally, consecutive indices and ranges are automatically joined.
Definition at line 29 of file BLI_index_ranges_builder.hh.
|
inline |
Definition at line 37 of file BLI_index_ranges_builder.hh.
References data.
|
inline |
Add a new index. It has to be larger than any previously added index.
Definition at line 47 of file BLI_index_ranges_builder.hh.
References add_range(), and T.
Referenced by blender::geometry::face_tris_mask(), blender::tests::TEST(), blender::tests::TEST(), and blender::tests::TEST().
|
inline |
Add a range of indices. It has to start after any previously added index. By design, this is branchless and requires O(1) time.
Definition at line 56 of file BLI_index_ranges_builder.hh.
References BLI_assert, capacity(), size(), and T.
Referenced by add(), blender::bits::bits_to_index_ranges(), blender::geometry::face_tris_mask(), and blender::tests::TEST().
|
inlinestaticconstexpr |
Definition at line 109 of file BLI_index_ranges_builder.hh.
|
inline |
How many ranges this container can hold at most.
Definition at line 85 of file BLI_index_ranges_builder.hh.
Referenced by add_range().
|
inline |
Definition at line 96 of file BLI_index_ranges_builder.hh.
References size().
Referenced by blender::index_mask::segments_from_batch_predicate().
|
inline |
True if there are no ranges yet.
Definition at line 91 of file BLI_index_ranges_builder.hh.
Referenced by blender::index_mask::segments_from_batch_predicate(), and blender::tests::TEST().
|
inline |
Get the i-th collected IndexRange.
Definition at line 102 of file BLI_index_ranges_builder.hh.
References blender::IndexRange::from_begin_end(), i, and T.
|
inline |
Number of collected ranges.
Definition at line 79 of file BLI_index_ranges_builder.hh.
Referenced by add_range(), index_range(), blender::index_mask::segments_from_batch_predicate(), blender::bits::tests::TEST(), blender::bits::tests::TEST(), blender::tests::TEST(), blender::tests::TEST(), blender::tests::TEST(), and blender::tests::TEST().