Blender V5.0
blender::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
BitSpan drop_front (const int64_t n) const
BitSpan drop_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 72 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 84 of file BLI_bit_span.hh.

◆ BitSpan() [3/3]

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

Definition at line 88 of file BLI_bit_span.hh.

Member Function Documentation

◆ begin()

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

Definition at line 148 of file BLI_bit_span.hh.

◆ bit_range()

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

Definition at line 143 of file BLI_bit_span.hh.

◆ data()

const BitInt * blender::bits::BitSpan::data ( ) const
inline

Definition at line 138 of file BLI_bit_span.hh.

◆ drop_back()

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

Definition at line 133 of file BLI_bit_span.hh.

◆ drop_front()

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

Definition at line 128 of file BLI_bit_span.hh.

◆ end()

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

Definition at line 153 of file BLI_bit_span.hh.

◆ index_range()

IndexRange blender::bits::BitSpan::index_range ( ) const
inline

Definition at line 101 of file BLI_bit_span.hh.

◆ is_empty()

bool blender::bits::BitSpan::is_empty ( ) const
inline

Definition at line 96 of file BLI_bit_span.hh.

◆ operator[]()

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

Definition at line 106 of file BLI_bit_span.hh.

◆ size()

int64_t blender::bits::BitSpan::size ( ) const
inline

Number of bits referenced by the span.

Definition at line 91 of file BLI_bit_span.hh.

◆ slice()

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

Definition at line 113 of file BLI_bit_span.hh.

◆ take_back()

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

Definition at line 123 of file BLI_bit_span.hh.

◆ take_front()

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

Definition at line 118 of file BLI_bit_span.hh.

Member Data Documentation

◆ bit_range_

IndexRange blender::bits::BitSpan::bit_range_ = {0, 0}
protected

The range of referenced bits.

Definition at line 78 of file BLI_bit_span.hh.

◆ 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 76 of file BLI_bit_span.hh.


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