Tesseract  3.02
tesseract-ocr/textord/sortflts.h
Go to the documentation of this file.
00001 /**********************************************************************
00002  * File:        sortflts.h  (Formerly sfloats.h)
00003  * Description: Code to maintain a sorted list of floats.
00004  * Author:              Ray Smith
00005  * Created:             Mon Oct  4 16:15:40 BST 1993
00006  *
00007  * (C) Copyright 1993, Hewlett-Packard Ltd.
00008  ** Licensed under the Apache License, Version 2.0 (the "License");
00009  ** you may not use this file except in compliance with the License.
00010  ** You may obtain a copy of the License at
00011  ** http://www.apache.org/licenses/LICENSE-2.0
00012  ** Unless required by applicable law or agreed to in writing, software
00013  ** distributed under the License is distributed on an "AS IS" BASIS,
00014  ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00015  ** See the License for the specific language governing permissions and
00016  ** limitations under the License.
00017  *
00018  **********************************************************************/
00019 
00020 #ifndef           SORTFLTS_H
00021 #define           SORTFLTS_H
00022 
00023 #include          "elst.h"
00024 #include          "notdll.h"
00025 #include          "notdll.h"
00026 
00027 class SORTED_FLOAT:public ELIST_LINK
00028 {
00029   friend class SORTED_FLOATS;
00030 
00031   public:
00032     SORTED_FLOAT() {
00033     }                            //empty constructor
00034     SORTED_FLOAT(              //create one
00035                  float value,  //value of entry
00036                  inT32 key) {  //reference
00037       entry = value;
00038       address = key;
00039     }
00040   private:
00041     float entry;                 //value of float
00042     inT32 address;               //key
00043 };
00044 
00045 ELISTIZEH (SORTED_FLOAT)
00046 class SORTED_FLOATS
00047 {
00048   public:
00050     SORTED_FLOATS() {
00051       it.set_to_list (&list);
00052     }
00058     void add(float value,
00059              inT32 key);
00064     void remove(inT32 key);
00069     float operator[] (inT32 index);
00070 
00071   private:
00072     SORTED_FLOAT_LIST list;      //list of floats
00073     SORTED_FLOAT_IT it;          //iterator built-in
00074 };
00075 #endif