00001
00020 #include "mfcpch.h"
00021 #include "sortflts.h"
00022 #include "notdll.h"
00023
00024 ELISTIZE (SORTED_FLOAT)
00028 void SORTED_FLOATS::add(
00029 float value,
00030 INT32 key) {
00031 SORTED_FLOAT *new_float = new SORTED_FLOAT (value, key);
00032
00033 if (list.empty ())
00034 it.add_after_stay_put (new_float);
00035 else {
00036 it.move_to_first ();
00037 while (!it.at_last () && it.data ()->entry < value)
00038 it.forward ();
00039 if (it.data ()->entry < value)
00040 it.add_after_stay_put (new_float);
00041 else
00042 it.add_before_stay_put (new_float);
00043 }
00044 }
00045
00046
00050 void SORTED_FLOATS::remove(
00051 INT32 key) {
00052 if (!list.empty ()) {
00053 for (it.mark_cycle_pt (); !it.cycled_list (); it.forward ()) {
00054 if (it.data ()->address == key) {
00055 delete it.extract ();
00056 return;
00057 }
00058 }
00059 }
00060 }
00061
00062
00068 float
00069 SORTED_FLOATS::operator[] (
00070 INT32 index
00071 ) {
00072 it.move_to_first ();
00073 return it.data_relative (index)->entry;
00074 }