Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "mfcpch.h"
00021 #include "sortflts.h"
00022 #include "notdll.h"
00023
00024 ELISTIZE (SORTED_FLOAT)
00030 void SORTED_FLOATS::add(
00031 float value,
00032 inT32 key) {
00033 SORTED_FLOAT *new_float = new SORTED_FLOAT (value, key);
00034
00035 if (list.empty ())
00036 it.add_after_stay_put (new_float);
00037 else {
00038 it.move_to_first ();
00039 while (!it.at_last () && it.data ()->entry < value)
00040 it.forward ();
00041 if (it.data ()->entry < value)
00042 it.add_after_stay_put (new_float);
00043 else
00044 it.add_before_stay_put (new_float);
00045 }
00046 }
00047
00048
00055 void SORTED_FLOATS::remove(
00056 inT32 key) {
00057 if (!list.empty ()) {
00058 for (it.mark_cycle_pt (); !it.cycled_list (); it.forward ()) {
00059 if (it.data ()->address == key) {
00060 delete it.extract ();
00061 return;
00062 }
00063 }
00064 }
00065 }
00066
00067
00074 float
00075 SORTED_FLOATS::operator[] (
00076 inT32 index
00077 ) {
00078 it.move_to_first ();
00079 return it.data_relative (index)->entry;
00080 }