20 #ifndef TESSERACT_CCUTIL_INDEXMAPBIDI_H_ 21 #define TESSERACT_CCUTIL_INDEXMAPBIDI_H_ 111 void InitAndSetupRange(
int sparse_size,
int start,
int end);
117 void Init(
int size,
bool all_mapped);
119 void SetMap(
int sparse_index,
bool mapped);
128 bool Merge(
int compact_index1,
int compact_index2);
131 return MasterCompactIndex(index) < 0;
135 void CompleteMerges();
139 return sparse_map_[sparse_index];
143 return sparse_map_.size();
167 int MasterCompactIndex(
int compact_index)
const {
168 while (compact_index >= 0 &&
169 sparse_map_[
compact_map_[compact_index]] != compact_index)
170 compact_index = sparse_map_[
compact_map_[compact_index]];
171 return compact_index;
180 #endif // TESSERACT_CCUTIL_INDEXMAPBIDI_H_
bool DeSerialize(bool swap, FILE *fp)
virtual int SparseToCompact(int sparse_index) const
int CompactToSparse(int compact_index) const
bool IsCompactDeleted(int index) const
GenericVector< inT32 > compact_map_
virtual int SparseSize() const
bool Serialize(FILE *fp) const
virtual int SparseToCompact(int sparse_index) const
virtual int SparseSize() const
void CopyFrom(const IndexMap &src)