Tesseract
3.02
|
#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) |
Definition at line 46 of file sortflts.h.
SORTED_FLOATS::SORTED_FLOATS | ( | ) | [inline] |
void SORTED_FLOATS::add | ( | float | value, |
inT32 | key | ||
) |
add sample
value | sample float |
key | retrieval key |
Definition at line 30 of file sortflts.cpp.
{ SORTED_FLOAT *new_float = new SORTED_FLOAT (value, key); if (list.empty ()) it.add_after_stay_put (new_float); else { it.move_to_first (); while (!it.at_last () && it.data ()->entry < value) it.forward (); if (it.data ()->entry < value) it.add_after_stay_put (new_float); else it.add_before_stay_put (new_float); } }
float SORTED_FLOATS::operator[] | ( | inT32 | index | ) |
index to list
index | item to get |
Definition at line 75 of file sortflts.cpp.
{
it.move_to_first ();
return it.data_relative (index)->entry;
}
void SORTED_FLOATS::remove | ( | inT32 | key | ) |
delete sample
key | key to delete |
Definition at line 55 of file sortflts.cpp.
{ if (!list.empty ()) { for (it.mark_cycle_pt (); !it.cycled_list (); it.forward ()) { if (it.data ()->address == key) { delete it.extract (); return; } } } }