Blender V4.3
blender::bits::BitSpan Class Reference

#include <BLI_bit_span.hh>

Inherited by blender::bits::BoundedBitSpan.

Public Member Functions

 BitSpan ()=default
 
 BitSpan (const BitInt *data, const int64_t size_in_bits)
 
 BitSpan (const BitInt *data, const IndexRange bit_range)
 
int64_t size () const
 
bool is_empty () const
 
IndexRange index_range () const
 
BitRef operator[] (const int64_t index) const
 
BitSpan slice (const IndexRange range) const
 
BitSpan take_front (const int64_t n) const
 
BitSpan take_back (const int64_t n) const
 
const BitIntdata () const
 
const IndexRangebit_range () const
 
BitIterator begin () const
 
BitIterator end () const
 

Protected Attributes

const BitIntdata_ = nullptr
 
IndexRange bit_range_ = {0, 0}
 

Detailed Description

Similar to #Span, but references a range of bits instead of normal C++ types (which must be at least one byte large). Use #MutableBitSpan if the values are supposed to be modified.

The beginning and end of a BitSpan does not have to be at byte/int boundaries. It can start and end at any bit.

Definition at line 68 of file BLI_bit_span.hh.

Constructor & Destructor Documentation

◆ BitSpan() [1/3]

blender::bits::BitSpan::BitSpan ( )
default

Construct an empty span.

◆ BitSpan() [2/3]

blender::bits::BitSpan::BitSpan ( const BitInt * data,
const int64_t size_in_bits )
inline

Definition at line 80 of file BLI_bit_span.hh.

◆ BitSpan() [3/3]

blender::bits::BitSpan::BitSpan ( const BitInt * data,
const IndexRange bit_range )
inline

Definition at line 84 of file BLI_bit_span.hh.

Member Function Documentation

◆ begin()

BitIterator blender::bits::BitSpan::begin ( ) const
inline

Definition at line 134 of file BLI_bit_span.hh.

References bit_range_, data_, and blender::IndexRange::start().

◆ bit_range()

const IndexRange & blender::bits::BitSpan::bit_range ( ) const
inline

◆ data()

◆ end()

BitIterator blender::bits::BitSpan::end ( ) const
inline

Definition at line 139 of file BLI_bit_span.hh.

References bit_range_, data_, and blender::IndexRange::one_after_last().

◆ index_range()

◆ is_empty()

◆ operator[]()

BitRef blender::bits::BitSpan::operator[] ( const int64_t index) const
inlinenodiscard

◆ size()

◆ slice()

BitSpan blender::bits::BitSpan::slice ( const IndexRange range) const
inlinenodiscard

◆ take_back()

BitSpan blender::bits::BitSpan::take_back ( const int64_t n) const
inline

Definition at line 119 of file BLI_bit_span.hh.

References bit_range_, data_, and blender::IndexRange::take_back().

◆ take_front()

BitSpan blender::bits::BitSpan::take_front ( const int64_t n) const
inline

Definition at line 114 of file BLI_bit_span.hh.

References bit_range_, data_, and blender::IndexRange::take_front().

Member Data Documentation

◆ bit_range_

◆ data_

const BitInt* blender::bits::BitSpan::data_ = nullptr
protected

Base pointer to the integers containing the bits. The actual bit span might start at a much higher address when bit_range_.start() is large.

Definition at line 72 of file BLI_bit_span.hh.

Referenced by begin(), data(), end(), operator[](), slice(), take_back(), take_front(), and blender::bits::BoundedBitSpan::take_front().


The documentation for this class was generated from the following file: