|
Blender V4.3
|
#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 11 of file BLI_index_ranges_builder_fwd.hh.
|
inline |
Definition at line 33 of file BLI_index_ranges_builder.hh.
|
inline |
Add a new index. It has to be larger than any previously added index.
Definition at line 43 of file BLI_index_ranges_builder.hh.
References blender::IndexRangesBuilder< T >::add_range().
|
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 52 of file BLI_index_ranges_builder.hh.
References BLI_assert, blender::IndexRangesBuilder< T >::capacity(), and blender::IndexRangesBuilder< T >::size().
Referenced by blender::IndexRangesBuilder< T >::add(), and blender::bits::bits_to_index_ranges().
|
inlinestaticconstexpr |
Definition at line 105 of file BLI_index_ranges_builder.hh.
|
inline |
How many ranges this container can hold at most.
Definition at line 81 of file BLI_index_ranges_builder.hh.
Referenced by blender::IndexRangesBuilder< T >::add_range().
|
inline |
Definition at line 92 of file BLI_index_ranges_builder.hh.
References blender::IndexRangesBuilder< T >::size().
Referenced by blender::index_mask::segments_from_batch_predicate().
|
inline |
True if there are no ranges yet.
Definition at line 87 of file BLI_index_ranges_builder.hh.
Referenced by blender::index_mask::segments_from_batch_predicate().
|
inline |
Get the i-th collected #IndexRange.
Definition at line 98 of file BLI_index_ranges_builder.hh.
References blender::IndexRange::from_begin_end().
|
inline |
Number of collected ranges.
Definition at line 75 of file BLI_index_ranges_builder.hh.
Referenced by blender::IndexRangesBuilder< T >::add_range(), blender::IndexRangesBuilder< T >::index_range(), blender::index_mask::segments_from_batch_predicate(), blender::bits::tests::TEST(), and blender::bits::tests::TEST().