bit_visitor_functor Struct Reference

Visitor calss for bm::for_each_bit() algorithm It is NOT a classic functor (with function call operator() overload) For efficiency it needs to support two methods: add_bits and add_range which corresponds to different internal methods of representation of sets in the bm::bvector<> (bit-stream and D-GAP/RLE representation). More...

## Public Types

using | size_type = bm::bvector<>::size_type

## Public Member Functions

int | add_bits (size_type offset, const unsigned char *bits, unsigned size)
| Decoded bits callback.
int | add_range (size_type offset, size_type size)
| Decoded range callback.

## Data Fields

unsigned | cnt = 0

## Detailed Description

Visitor calss for bm::for_each_bit() algorithm It is NOT a classic functor (with function call operator() overload) For efficiency it needs to support two methods: add_bits and add_range which corresponds to different internal methods of representation of sets in the bm::bvector<> (bit-stream and D-GAP/RLE representation).

This method somewhat exposes internals and requires writing a custom object, but it is also the fastest method, used inside BitMagic library a lot.

Examples
  sample25.cpp.

Definition at line 75 of file sample25.cpp.

## Member Typedef Documentation

## size_type

using bit_visitor_functor::size_type = bm::bvector<>::size_type

Examples
  sample25.cpp.

Definition at line 77 of file sample25.cpp.

## Member Function Documentation

## add_bits()

int bit_visitor_functor::add_bits | ( | size_type | offset,
|  | const unsigned char * | bits,
|  | unsigned | size )

inline

Decoded bits callback.

Parameters

  offset | - index offset in the bit-vector (decoding address context)
  bits | - array of set bit indexes within the address context offset + bits[i] gives us global index in the bit_vector
  size | - number of decoded bits (size of bits array)

Examples
  sample25.cpp.

Definition at line 86 of file sample25.cpp.

References cnt.

## add_range()

int bit_visitor_functor::add_range | ( | size_type | offset,
|  | size_type | size )

inline

Decoded range callback.

Parameters

  offset | - index offset in the bit-vector (decoding address context)
  size | - number of consequitive ON bits (size of bits array)

Examples
  sample25.cpp.

Definition at line 106 of file sample25.cpp.

References cnt.

## Field Documentation

## cnt

unsigned bit_visitor_functor::cnt = 0

Examples
  sample25.cpp.

Definition at line 117 of file sample25.cpp.

Referenced by add_bits(), and add_range().

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

- sample25.cpp