Tesseract  3.02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
tesseract::AltList Class Reference

#include <altlist.h>

Inheritance diagram for tesseract::AltList:
tesseract::CharAltList tesseract::WordAltList

List of all members.

Public Member Functions

 AltList (int max_alt)
virtual ~AltList ()
virtual void Sort ()=0
int BestCost (int *best_alt) const
int AltCount () const
int AltCost (int alt_idx) const
double AltProb (int alt_idx) const
void * AltTag (int alt_idx) const

Protected Attributes

int max_alt_
int alt_cnt_
int * alt_cost_
void ** alt_tag_

Detailed Description

Definition at line 30 of file altlist.h.


Constructor & Destructor Documentation

tesseract::AltList::AltList ( int  max_alt)
explicit

Definition at line 25 of file altlist.cpp.

{
max_alt_ = max_alt;
alt_cnt_ = 0;
}
tesseract::AltList::~AltList ( )
virtual

Definition at line 32 of file altlist.cpp.

{
if (alt_cost_ != NULL) {
delete []alt_cost_;
}
if (alt_tag_ != NULL) {
delete []alt_tag_;
}
}

Member Function Documentation

int tesseract::AltList::AltCost ( int  alt_idx) const
inline

Definition at line 41 of file altlist.h.

{ return alt_cost_[alt_idx]; }
int tesseract::AltList::AltCount ( ) const
inline

Definition at line 39 of file altlist.h.

{ return alt_cnt_; }
double tesseract::AltList::AltProb ( int  alt_idx) const
inline

Definition at line 43 of file altlist.h.

{
return CubeUtils::Cost2Prob(AltCost(alt_idx));
}
void* tesseract::AltList::AltTag ( int  alt_idx) const
inline

Definition at line 47 of file altlist.h.

{ return alt_tag_[alt_idx]; }
int tesseract::AltList::BestCost ( int *  best_alt) const

Definition at line 45 of file altlist.cpp.

{
if (alt_cnt_ <= 0) {
(*best_alt) = -1;
return -1;
}
int best_alt_idx = 0;
for (int alt_idx = 1; alt_idx < alt_cnt_; alt_idx++) {
if (alt_cost_[alt_idx] < alt_cost_[best_alt_idx]) {
best_alt_idx = alt_idx;
}
}
(*best_alt) = best_alt_idx;
return alt_cost_[best_alt_idx];
}
virtual void tesseract::AltList::Sort ( )
pure virtual

Member Data Documentation

int tesseract::AltList::alt_cnt_
protected

Definition at line 53 of file altlist.h.

int* tesseract::AltList::alt_cost_
protected

Definition at line 55 of file altlist.h.

void** tesseract::AltList::alt_tag_
protected

Definition at line 57 of file altlist.h.

int tesseract::AltList::max_alt_
protected

Definition at line 51 of file altlist.h.


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