tesseract  3.03
/usr/local/google/home/jbreiden/tesseract-ocr-read-only/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 
00025 class SORTED_FLOAT:public ELIST_LINK
00026 {
00027   friend class SORTED_FLOATS;
00028 
00029   public:
00030     SORTED_FLOAT() {
00031     }                            //empty constructor
00032     SORTED_FLOAT(              //create one
00033                  float value,  //value of entry
00034                  inT32 key) {  //reference
00035       entry = value;
00036       address = key;
00037     }
00038   private:
00039     float entry;                 //value of float
00040     inT32 address;               //key
00041 };
00042 
00043 ELISTIZEH (SORTED_FLOAT)
00044 class SORTED_FLOATS
00045 {
00046   public:
00048     SORTED_FLOATS() {
00049       it.set_to_list (&list);
00050     }
00056     void add(float value,
00057              inT32 key);
00062     void remove(inT32 key);
00067     float operator[] (inT32 index);
00068 
00069   private:
00070     SORTED_FLOAT_LIST list;      //list of floats
00071     SORTED_FLOAT_IT it;          //iterator built-in
00072 };
00073 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines