tesseract  v4.0.0-17-g361f3264
Open Source OCR Engine
tesseract::BitVector Class Reference

#include <bitvector.h>

Public Member Functions

 BitVector ()
 
 BitVector (int length)
 
 BitVector (const BitVector &src)
 
BitVectoroperator= (const BitVector &src)
 
 ~BitVector ()
 
void Init (int length)
 
int size () const
 
bool Serialize (FILE *fp) const
 
bool DeSerialize (bool swap, FILE *fp)
 
void SetAllFalse ()
 
void SetAllTrue ()
 
void SetBit (int index)
 
void ResetBit (int index)
 
void SetValue (int index, bool value)
 
bool At (int index) const
 
bool operator[] (int index) const
 
int NextSetBit (int prev_bit) const
 
int NumSetBits () const
 
void operator|= (const BitVector &other)
 
void operator &= (const BitVector &other)
 
void operator^= (const BitVector &other)
 
void SetSubtract (const BitVector &v1, const BitVector &v2)
 

Static Public Attributes

static const uint8_t lsb_index_ [256]
 
static const uint8_t lsb_eroded_ [256]
 
static const int hamming_table_ [256]
 

Private Member Functions

void Alloc (int length)
 
int WordIndex (int index) const
 
uint32_t BitMask (int index) const
 
int WordLength () const
 
int ByteLength () const
 

Private Attributes

int32_t bit_size_
 
uint32_t * array_
 

Static Private Attributes

static const int kBitFactor = sizeof(uint32_t) * 8
 

Constructor & Destructor Documentation

◆ BitVector() [1/3]

tesseract::BitVector::BitVector ( )

◆ BitVector() [2/3]

tesseract::BitVector::BitVector ( int  length)
explicit

◆ BitVector() [3/3]

tesseract::BitVector::BitVector ( const BitVector src)

◆ ~BitVector()

tesseract::BitVector::~BitVector ( )

Member Function Documentation

◆ Alloc()

void tesseract::BitVector::Alloc ( int  length)
private

◆ At()

bool tesseract::BitVector::At ( int  index) const
inline

◆ BitMask()

uint32_t tesseract::BitVector::BitMask ( int  index) const
inlineprivate

◆ ByteLength()

int tesseract::BitVector::ByteLength ( ) const
inlineprivate

◆ DeSerialize()

bool tesseract::BitVector::DeSerialize ( bool  swap,
FILE *  fp 
)

◆ Init()

void tesseract::BitVector::Init ( int  length)

◆ NextSetBit()

int tesseract::BitVector::NextSetBit ( int  prev_bit) const

◆ NumSetBits()

int tesseract::BitVector::NumSetBits ( ) const

◆ operator &=()

void tesseract::BitVector::operator&= ( const BitVector other)

◆ operator=()

BitVector & tesseract::BitVector::operator= ( const BitVector src)

◆ operator[]()

bool tesseract::BitVector::operator[] ( int  index) const
inline

◆ operator^=()

void tesseract::BitVector::operator^= ( const BitVector other)

◆ operator|=()

void tesseract::BitVector::operator|= ( const BitVector other)

◆ ResetBit()

void tesseract::BitVector::ResetBit ( int  index)
inline

◆ Serialize()

bool tesseract::BitVector::Serialize ( FILE *  fp) const

◆ SetAllFalse()

void tesseract::BitVector::SetAllFalse ( )

◆ SetAllTrue()

void tesseract::BitVector::SetAllTrue ( )

◆ SetBit()

void tesseract::BitVector::SetBit ( int  index)
inline

◆ SetSubtract()

void tesseract::BitVector::SetSubtract ( const BitVector v1,
const BitVector v2 
)

◆ SetValue()

void tesseract::BitVector::SetValue ( int  index,
bool  value 
)
inline

◆ size()

int tesseract::BitVector::size ( ) const
inline

◆ WordIndex()

int tesseract::BitVector::WordIndex ( int  index) const
inlineprivate

◆ WordLength()

int tesseract::BitVector::WordLength ( ) const
inlineprivate

Member Data Documentation

◆ array_

uint32_t* tesseract::BitVector::array_
private

◆ bit_size_

int32_t tesseract::BitVector::bit_size_
private

◆ hamming_table_

const int tesseract::BitVector::hamming_table_
static
Initial value:
= {
0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4,
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8
}

◆ kBitFactor

const int tesseract::BitVector::kBitFactor = sizeof(uint32_t) * 8
staticprivate

◆ lsb_eroded_

const uint8_t tesseract::BitVector::lsb_eroded_
static

◆ lsb_index_

const uint8_t tesseract::BitVector::lsb_index_
static
Initial value:
= {
255, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
7, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0
}

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