|
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 25 of file BLI_index_ranges_builder.hh.
|
inline |
Definition at line 33 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 43 of file BLI_index_ranges_builder.hh.
References add_range(), and T.
Referenced by 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 52 of file BLI_index_ranges_builder.hh.
References BLI_assert, capacity(), size(), and T.
Referenced by add(), blender::bits::bits_to_index_ranges(), and blender::tests::TEST().
|
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 add_range().
|
inline |
Definition at line 92 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 87 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 98 of file BLI_index_ranges_builder.hh.
References blender::IndexRange::from_begin_end(), and T.
|
inline |
Number of collected ranges.
Definition at line 75 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().