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

#include <sortflts.h>

Public Member Functions

 SORTED_FLOATS ()
 
SORTED_FLOATS::add

Add a new entry to the sorted lsit of floats.

void add (float value, inT32 key)
 
SORTED_FLOATS::remove

Remove an entry from the sorted lsit of floats.

void remove (inT32 key)
 
SORTED_FLOATS::operator[]

Return the floating point value of the given index into the list.

float operator[] (inT32 index)
 

Detailed Description

Definition at line 46 of file sortflts.h.

Constructor & Destructor Documentation

SORTED_FLOATS::SORTED_FLOATS ( )
inline

empty constructor

Definition at line 50 of file sortflts.h.

50  {
51  it.set_to_list (&list);
52  }

Member Function Documentation

void SORTED_FLOATS::add ( float  value,
inT32  key 
)

add sample

Parameters
valuesample float
keyretrieval key

Definition at line 30 of file sortflts.cpp.

32  {
33  SORTED_FLOAT *new_float = new SORTED_FLOAT (value, key);
34 
35  if (list.empty ())
36  it.add_after_stay_put (new_float);
37  else {
38  it.move_to_first ();
39  while (!it.at_last () && it.data ()->entry < value)
40  it.forward ();
41  if (it.data ()->entry < value)
42  it.add_after_stay_put (new_float);
43  else
44  it.add_before_stay_put (new_float);
45  }
46 }
float SORTED_FLOATS::operator[] ( inT32  index)

index to list

Parameters
indexitem to get

Definition at line 75 of file sortflts.cpp.

77  {
78  it.move_to_first ();
79  return it.data_relative (index)->entry;
80 }
void SORTED_FLOATS::remove ( inT32  key)

delete sample

Parameters
keykey to delete

Definition at line 55 of file sortflts.cpp.

56  {
57  if (!list.empty ()) {
58  for (it.mark_cycle_pt (); !it.cycled_list (); it.forward ()) {
59  if (it.data ()->address == key) {
60  delete it.extract ();
61  return;
62  }
63  }
64  }
65 }

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