System documentation of the GNU Image-Finding Tool

CDocumentFrequencyElement.h

00001 /* -*- mode: c++ -*- 
00002 */
00003 /* 
00004 
00005     GIFT, a flexible content based image retrieval system.
00006     Copyright (C) 1998, 1999, 2000, 2001, 2002, CUI University of Geneva
00007 
00008      Copyright (C) 2003, 2004 Bayreuth University
00009       2005 Bamberg University
00010     This program is free software; you can redistribute it and/or modify
00011     it under the terms of the GNU General Public License as published by
00012     the Free Software Foundation; either version 2 of the License, or
00013     (at your option) any later version.
00014 
00015     This program is distributed in the hope that it will be useful,
00016     but WITHOUT ANY WARRANTY; without even the implied warranty of
00017     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018     GNU General Public License for more details.
00019 
00020     You should have received a copy of the GNU General Public License
00021     along with this program; if not, write to the Free Software
00022     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00023 
00024 */
00041 #ifndef _CDOCUMENTFREQUENCYELEMENT
00042 #define _CDOCUMENTFREQUENCYELEMENT
00043 #include "libGIFTAcInvertedFile/include/uses-declarations.h"
00044 #include <iostream>
00045 #include <functional>
00046 #include "libMRML/include/TID.h"
00047 
00049 class CDocumentFrequencyElement{
00050   struct{
00052     TID mID;
00054     float mDocumentFrequency;
00055   } mContent;
00056 public:
00064   CDocumentFrequencyElement();
00065 
00073   CDocumentFrequencyElement(TID inID,
00074                             float inDocumentFrequency);
00075 
00081   CDocumentFrequencyElement(istream& inStream);
00082 
00088   CDocumentFrequencyElement(const CDocumentFrequencyElement& inElement);
00089 
00096 
00099 
00101   bool input(istream& inStream);
00102   
00108   bool output(ostream& outStream)const;
00109 
00115   bool writeBinary(ostream& outStream)const;
00116 
00118 
00126   TID getID()const;
00127 
00133   unsigned int getIntegerDocumentFrequency()const;
00134 
00140   float getDocumentFrequency()const;
00141 
00147   void setDocumentFrequency(float);
00148 
00154   void divideDocumentFrequency(float);
00155 
00157 
00158 };
00159 
00160 
00169 class CSortByID_DFE:
00170   public binary_function
00171 <CDocumentFrequencyElement,CDocumentFrequencyElement,bool>{
00172  public:
00174   inline bool operator()(const CDocumentFrequencyElement& l,
00175                          const CDocumentFrequencyElement& t){
00176     return l.getID()<t.getID();
00177   }
00178 };
00179 
00180 
00181 
00189 class CSortByDocumentFrequency_DFE:
00190   public binary_function
00191 <CDocumentFrequencyElement,CDocumentFrequencyElement,bool>{
00192 public:
00194   inline bool operator()(const CDocumentFrequencyElement& l,
00195                          const CDocumentFrequencyElement& t){
00196     return t.getDocumentFrequency()<l.getDocumentFrequency();
00197   }
00198 };
00199 
00200 #endif
00201 
00202 

Need for discussion? Want to contribute? Contact
help-gift@gnu.org Generated using Doxygen