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 "InvFPIndex.hpp" 00019 00023 class ProxInfo { 00024 public: 00026 ProxInfo() : nextPos(0), posList(NULL), size(0), 00027 dList(NULL), listSize(0) { } 00029 ProxInfo::ProxInfo(int num, int tf, const DocInfoList *dl); 00030 00032 ProxInfo(int num, int tf, LOC_T *pl); 00034 ~ProxInfo() { delete(dList); delete[](posList);} 00035 00037 int id() const {return currEntry.docID();} 00039 COUNT_T count() const {return currEntry.termCount();} 00041 const LOC_T *positions() const {return currEntry.positions();} 00044 LOC_T position(int k) const {return *(positions() + k);} 00046 void startIteration() { 00047 if (dList != NULL) dList->startIteration(); 00048 } 00050 bool hasMore() {return(dList != NULL && dList->hasMore());} 00052 bool nextDoc(); 00055 bool nextDoc(DOCID_T did); 00057 int posSize() const; 00059 int size; 00062 int nextPos; 00063 private: 00065 LOC_T *posList; // internally allocated, must use delete[]() 00067 const InvFPDocList *dList; 00068 InvFPDocInfo currEntry; 00069 int listSize; 00070 }; 00071 #endif