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 */ 00042 #ifndef _CDOCUMENTFREQUENCYLIST 00043 #define _CDOCUMENTFREQUENCYLIST 00044 #include "libGIFTAcInvertedFile/include/uses-declarations.h" 00045 #include "libGIFTAcInvertedFile/include/CDocumentFrequencyElement.h" 00046 00047 //#define _CDocumentFrequencyListIsVector 00048 //#define _CDocumentFrequencyListIsList 00049 #define _CDocumentFrequencyListIsArray 00050 00051 #ifdef _CDocumentFrequencyListIsVector 00052 #include <vector> 00053 #else 00054 #include <list> 00055 #endif 00056 00058 class CDocumentFrequencyList 00059 #ifdef _CDocumentFrequencyListIsVector 00060 :public vector<CDocumentFrequencyElement> 00061 #endif 00062 #ifdef _CDocumentFrequencyListIsList 00063 :public list<CDocumentFrequencyElement> 00064 #endif 00065 { 00067 int mSize; 00069 CDocumentFrequencyElement* mEnd; 00070 00071 #ifdef _CDocumentFrequencyListIsArray 00072 CDocumentFrequencyElement* mContent; 00073 #endif 00074 public: 00080 CDocumentFrequencyList(size_t inSize); 00086 CDocumentFrequencyList(); 00092 ~CDocumentFrequencyList(); 00099 bool writeBinary(ostream& outStream)const; 00106 bool readBinary(istream& inStream); 00107 #ifdef _CDocumentFrequencyListIsArray 00108 00109 typedef CDocumentFrequencyElement* iterator; 00111 typedef CDocumentFrequencyElement const* const_iterator; 00113 iterator begin(); 00115 iterator end(); 00117 const_iterator begin()const; 00119 const_iterator end()const; 00121 size_t size()const; 00123 void setEnd(CDocumentFrequencyElement*); 00124 #endif 00125 }; 00126 00127 #endif