#include <bitvector.h>
Definition at line 34 of file bitvector.h.
| tesseract::BitVector::BitVector |
( |
| ) |
|
| tesseract::BitVector::BitVector |
( |
int |
length | ) |
|
|
explicit |
| tesseract::BitVector::BitVector |
( |
const BitVector & |
src | ) |
|
Definition at line 35 of file bitvector.cpp.
35 : bit_size_(src.bit_size_) {
36 array_ =
new uinT32[WordLength()];
37 memcpy(array_, src.array_, ByteLength());
| tesseract::BitVector::~BitVector |
( |
| ) |
|
| bool tesseract::BitVector::At |
( |
int |
index | ) |
const |
|
inline |
Definition at line 75 of file bitvector.h.
76 return (array_[WordIndex(index)] & BitMask(index)) != 0;
| bool tesseract::BitVector::DeSerialize |
( |
bool |
swap, |
|
|
FILE * |
fp |
|
) |
| |
Definition at line 66 of file bitvector.cpp.
68 if (fread(&new_bit_size,
sizeof(new_bit_size), 1, fp) != 1)
return false;
70 ReverseN(&new_bit_size,
sizeof(new_bit_size));
73 int wordlen = WordLength();
74 if (fread(array_,
sizeof(*array_), wordlen, fp) != wordlen)
return false;
76 for (
int i = 0; i < wordlen; ++i)
77 ReverseN(&array_[i],
sizeof(array_[i]));
void ReverseN(void *ptr, int num_bytes)
| void tesseract::BitVector::Init |
( |
int |
length | ) |
|
Definition at line 40 of file bitvector.cpp.
42 memcpy(array_, src.array_, ByteLength());
| bool tesseract::BitVector::operator[] |
( |
int |
index | ) |
const |
|
inline |
Definition at line 78 of file bitvector.h.
79 return (array_[WordIndex(index)] & BitMask(index)) != 0;
| void tesseract::BitVector::ResetBit |
( |
int |
index | ) |
|
|
inline |
Definition at line 66 of file bitvector.h.
67 array_[WordIndex(index)] &= ~BitMask(index);
| bool tesseract::BitVector::Serialize |
( |
FILE * |
fp | ) |
const |
Definition at line 57 of file bitvector.cpp.
58 if (fwrite(&bit_size_,
sizeof(bit_size_), 1, fp) != 1)
return false;
59 int wordlen = WordLength();
60 if (fwrite(array_,
sizeof(*array_), wordlen, fp) != wordlen)
return false;
| void tesseract::BitVector::SetAllFalse |
( |
| ) |
|
Definition at line 82 of file bitvector.cpp.
83 memset(array_, 0, ByteLength());
| void tesseract::BitVector::SetAllTrue |
( |
| ) |
|
Definition at line 85 of file bitvector.cpp.
86 memset(array_, ~0, ByteLength());
| void tesseract::BitVector::SetBit |
( |
int |
index | ) |
|
|
inline |
Definition at line 63 of file bitvector.h.
64 array_[WordIndex(index)] |= BitMask(index);
| void tesseract::BitVector::SetValue |
( |
int |
index, |
|
|
bool |
value |
|
) |
| |
|
inline |
| int tesseract::BitVector::size |
( |
| ) |
const |
|
inline |
The documentation for this class was generated from the following files:
- /home/abuild/rpmbuild/BUILD/tesseract-ocr-3.02.02/ccutil/bitvector.h
- /home/abuild/rpmbuild/BUILD/tesseract-ocr-3.02.02/ccutil/bitvector.cpp