All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
tesseract::AltList Class Referenceabstract

#include <altlist.h>

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

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.

25  {
26  max_alt_ = max_alt;
27  alt_cnt_ = 0;
28  alt_cost_ = NULL;
29  alt_tag_ = NULL;
30 }
void ** alt_tag_
Definition: altlist.h:57
#define NULL
Definition: host.h:144
tesseract::AltList::~AltList ( )
virtual

Definition at line 32 of file altlist.cpp.

32  {
33  if (alt_cost_ != NULL) {
34  delete []alt_cost_;
35  alt_cost_ = NULL;
36  }
37 
38  if (alt_tag_ != NULL) {
39  delete []alt_tag_;
40  alt_tag_ = NULL;
41  }
42 }
void ** alt_tag_
Definition: altlist.h:57
#define NULL
Definition: host.h:144

Member Function Documentation

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

Definition at line 41 of file altlist.h.

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

Definition at line 39 of file altlist.h.

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

Definition at line 43 of file altlist.h.

43  {
44  return CubeUtils::Cost2Prob(AltCost(alt_idx));
45  }
int AltCost(int alt_idx) const
Definition: altlist.h:41
static double Cost2Prob(int cost)
Definition: cube_utils.cpp:47
void* tesseract::AltList::AltTag ( int  alt_idx) const
inline

Definition at line 47 of file altlist.h.

47 { return alt_tag_[alt_idx]; }
void ** alt_tag_
Definition: altlist.h:57
int tesseract::AltList::BestCost ( int *  best_alt) const

Definition at line 45 of file altlist.cpp.

45  {
46  if (alt_cnt_ <= 0) {
47  (*best_alt) = -1;
48  return -1;
49  }
50 
51  int best_alt_idx = 0;
52  for (int alt_idx = 1; alt_idx < alt_cnt_; alt_idx++) {
53  if (alt_cost_[alt_idx] < alt_cost_[best_alt_idx]) {
54  best_alt_idx = alt_idx;
55  }
56  }
57  (*best_alt) = best_alt_idx;
58  return alt_cost_[best_alt_idx];
59 }
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: