00001 /*========================================================================== 00002 * Copyright (c) 2002-2003 University of Massachusetts. All Rights Reserved. 00003 * 00004 * Use of the Lemur Toolkit for Language Modeling and Information Retrieval 00005 * is subject to the terms of the software license set forth in the LICENSE 00006 * file included with this software, and also available at 00007 * http://www.lemurproject.org/license.html 00008 * 00009 *========================================================================== 00010 */ 00011 /* 00012 author: fff, dmf 00013 * split out into separate header. Rewrite to use DocInfoList w/o copy. 00014 */ 00015 #ifndef _PROXINFO_HPP_ 00016 #define _PROXINFO_HPP_ 00017 00018 #include "InvFPDocList.hpp" 00019 #include "InvFPTypes.hpp" 00020 00021 00022 namespace lemur 00023 { 00024 namespace retrieval 00025 { 00026 00028 00033 class ProxInfo { 00034 public: 00036 ProxInfo() : nextPos(0), posList(NULL), size(0), 00037 dList(NULL), listSize(0) { } 00039 ProxInfo(int num, int tf, const lemur::api::DocInfoList *dl); 00040 00042 ProxInfo(int num, int tf, lemur::api::LOC_T *pl); 00044 ~ProxInfo() { delete(dList); delete[](posList);} 00045 00047 int id() const {return currEntry.docID();} 00049 lemur::api::COUNT_T count() const {return currEntry.termCount();} 00051 const lemur::api::LOC_T *positions() const {return currEntry.positions();} 00054 lemur::api::LOC_T position(int k) const {return *(positions() + k);} 00056 void startIteration() { 00057 if (dList != NULL) dList->startIteration(); 00058 } 00060 bool hasMore() {return(dList != NULL && dList->hasMore());} 00062 bool nextDoc(); 00065 bool nextDoc(lemur::api::DOCID_T did); 00067 int posSize() const; 00069 int size; 00072 int nextPos; 00073 private: 00075 lemur::api::LOC_T *posList; // internally allocated, must use delete[]() 00077 const lemur::index::InvFPDocList *dList; 00078 lemur::index::InvFPDocInfo currEntry; 00079 int listSize; 00080 }; 00081 } 00082 } 00083 00084 #endif