Tesseract  3.02
tesseract::IndexMap Class Reference

#include <indexmapbidi.h>

Inheritance diagram for tesseract::IndexMap:
tesseract::IndexMapBiDi

List of all members.

Public Member Functions

virtual ~IndexMap ()
virtual int SparseToCompact (int sparse_index) const
int CompactToSparse (int compact_index) const
virtual int SparseSize () const
int CompactSize () const
void CopyFrom (const IndexMap &src)
void CopyFrom (const IndexMapBiDi &src)
bool Serialize (FILE *fp) const
bool DeSerialize (bool swap, FILE *fp)

Protected Attributes

int sparse_size_
GenericVector< inT32compact_map_

Detailed Description

Definition at line 42 of file indexmapbidi.h.


Constructor & Destructor Documentation

virtual tesseract::IndexMap::~IndexMap ( ) [inline, virtual]

Definition at line 44 of file indexmapbidi.h.

{}

Member Function Documentation

int tesseract::IndexMap::CompactSize ( ) const [inline]

Definition at line 61 of file indexmapbidi.h.

                          {
    return compact_map_.size();
  }
int tesseract::IndexMap::CompactToSparse ( int  compact_index) const [inline]

Definition at line 53 of file indexmapbidi.h.

                                               {
    return compact_map_[compact_index];
  }
void tesseract::IndexMap::CopyFrom ( const IndexMap src)

Definition at line 33 of file indexmapbidi.cpp.

                                           {
  sparse_size_ = src.sparse_size_;
  compact_map_ = src.compact_map_;
}
void tesseract::IndexMap::CopyFrom ( const IndexMapBiDi src)

Reimplemented in tesseract::IndexMapBiDi.

Definition at line 37 of file indexmapbidi.cpp.

                                               {
  sparse_size_ = src.SparseSize();
  compact_map_ = src.compact_map_;
}
bool tesseract::IndexMap::DeSerialize ( bool  swap,
FILE *  fp 
)

Reimplemented in tesseract::IndexMapBiDi.

Definition at line 52 of file indexmapbidi.cpp.

                                              {
  inT32 sparse_size;
  if (fread(&sparse_size, sizeof(sparse_size), 1, fp) != 1) return false;
  if (swap)
    ReverseN(&sparse_size, sizeof(sparse_size));
  sparse_size_ = sparse_size;
  if (!compact_map_.DeSerialize(swap, fp)) return false;
  return true;
}
bool tesseract::IndexMap::Serialize ( FILE *  fp) const

Reimplemented in tesseract::IndexMapBiDi.

Definition at line 43 of file indexmapbidi.cpp.

                                       {
  inT32 sparse_size = sparse_size_;
  if (fwrite(&sparse_size, sizeof(sparse_size), 1, fp) != 1) return false;
  if (!compact_map_.Serialize(fp)) return false;
  return true;
}
virtual int tesseract::IndexMap::SparseSize ( ) const [inline, virtual]

Reimplemented in tesseract::IndexMapBiDi.

Definition at line 57 of file indexmapbidi.h.

                                 {
    return sparse_size_;
  }
int tesseract::IndexMap::SparseToCompact ( int  sparse_index) const [virtual]

Reimplemented in tesseract::IndexMapBiDi.

Definition at line 27 of file indexmapbidi.cpp.

                                                    {
  int result = compact_map_.binary_search(sparse_index);
  return compact_map_[result] == sparse_index ? result : -1;
}

Member Data Documentation

Definition at line 80 of file indexmapbidi.h.

Definition at line 77 of file indexmapbidi.h.


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