00001 /*========================================================================== 00002 * Copyright (c) 2001 Carnegie Mellon University. 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.cs.cmu.edu/~lemur/license.html 00008 * 00009 *========================================================================== 00010 */ 00011 00012 00013 #ifndef _BASICDOCINFOLIST_HPP 00014 #define _BASICDOCINFOLIST_HPP 00015 00016 #include "DocInfoList.hpp" 00017 00019 00020 class BasicDocInfoList : public DocInfoList { 00021 public: 00022 BasicDocInfoList(int *tmpDocArray, int size); 00023 00024 virtual ~BasicDocInfoList() {} 00025 virtual void startIteration() const { 00026 it = 0; 00027 prevDocID = 0; 00028 } 00029 00030 virtual bool hasMore() const { return (it<sz); } 00031 00032 virtual DocInfo * nextEntry() const; 00033 00034 protected: 00035 // Helper functions for iterator, subclasses should override 00037 virtual DocInfo* getElement(DocInfo* elem, POS_T position) const; 00039 virtual POS_T beginPosition() const { return (POS_T) 0; } 00041 virtual POS_T endPosition() const { return (POS_T) sz; } 00043 virtual POS_T nextPosition(POS_T position) const; 00044 00045 private: 00046 int sz; 00047 mutable int it; 00048 mutable int prevDocID; 00049 int *tmpdarr; 00050 }; 00051 00052 #endif 00053