|
Blender
V2.93
|
#include <BLI_index_mask.hh>
Public Member Functions | |
| IndexMask ()=default | |
| IndexMask (Span< int64_t > indices) | |
| IndexMask (IndexRange range) | |
| IndexMask (const std::initializer_list< int64_t > &indices) | |
| IndexMask (int64_t n) | |
| operator Span< int64_t > () const | |
| const int64_t * | begin () const |
| const int64_t * | end () const |
| int64_t | operator[] (int64_t n) const |
| int64_t | min_array_size () const |
| Span< int64_t > | indices () const |
| bool | is_range () const |
| IndexRange | as_range () const |
| template<typename CallbackT > | |
| void | foreach_index (const CallbackT &callback) const |
| IndexRange | index_range () const |
| int64_t | last () const |
| int64_t | size () const |
Definition at line 45 of file BLI_index_mask.hh.
|
default |
Create an IndexMask using the given integer array. This constructor asserts that the given integers are in ascending order and that there are no duplicates.
Definition at line 59 of file BLI_index_mask.hh.
References BLI_assert, indices(), and blender::Span< T >::size().
|
inline |
Use this method when you know that no indices are skipped. It is more efficient than preparing an integer array all the time.
Definition at line 72 of file BLI_index_mask.hh.
|
inline |
Construct an IndexMask from a sorted list of indices. Note, the created IndexMask is only valid as long as the initializer_list is valid.
Don't do this: IndexMask mask = {3, 4, 5};
Do this: do_something_with_an_index_mask({3, 4, 5});
Definition at line 86 of file BLI_index_mask.hh.
|
inlineexplicit |
Creates an IndexMask that references the indices [0, n-1].
Definition at line 93 of file BLI_index_mask.hh.
|
inline |
Returns the IndexRange referenced by this IndexMask. This method should only be called after the caller made sure that this IndexMask is actually a range.
Definition at line 152 of file BLI_index_mask.hh.
References BLI_assert, blender::Span< T >::first(), is_range(), and blender::Span< T >::size().
Referenced by foreach_index().
|
inline |
Definition at line 102 of file BLI_index_mask.hh.
References blender::Span< T >::begin().
|
inline |
Definition at line 107 of file BLI_index_mask.hh.
References blender::Span< T >::end().
|
inline |
Calls the given callback for every referenced index. The callback has to take one unsigned integer as parameter.
This method implements different code paths for the cases when the IndexMask represents a range or not.
Definition at line 165 of file BLI_index_mask.hh.
References as_range(), callback, and is_range().
|
inline |
Returns an IndexRange that can be used to index this IndexMask.
The range is [0, number of indices - 1].
This is not to be confused with the as_range method.
Definition at line 187 of file BLI_index_mask.hh.
References blender::Span< T >::index_range().
Definition at line 135 of file BLI_index_mask.hh.
Referenced by IndexMask().
|
inline |
Returns true if this IndexMask does not skip any indices. This check requires O(1) time.
Definition at line 143 of file BLI_index_mask.hh.
References blender::Span< T >::first(), blender::Span< T >::last(), and blender::Span< T >::size().
Referenced by as_range(), and foreach_index().
|
inline |
Returns the largest index that is referenced by this IndexMask.
Definition at line 195 of file BLI_index_mask.hh.
References blender::Span< T >::last().
|
inline |
Returns the minimum size an array has to have, if the integers in this IndexMask are going to be used as indices in that array.
Definition at line 125 of file BLI_index_mask.hh.
References blender::Span< T >::last(), and blender::Span< T >::size().
Definition at line 97 of file BLI_index_mask.hh.
Returns the n-th index referenced by this IndexMask. The index_mask method returns an IndexRange containing all indices that can be used as parameter here.
Definition at line 116 of file BLI_index_mask.hh.
|
inline |
Returns the number of indices referenced by this IndexMask.
Definition at line 203 of file BLI_index_mask.hh.
References blender::Span< T >::size().