00001 /*========================================================================== 00002 * Copyright (c) 2004 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 00013 // 00014 // DocListInfo 00015 // 00016 // 9 January 2004 - tds 00017 // 00018 00019 #ifndef INDRI_DOCLISTINFO_HPP 00020 #define INDRI_DOCLISTINFO_HPP 00021 00022 #include "indri/DocPositionInfoList.hpp" 00023 #include <indri/greedy_vector> 00024 00032 00033 namespace indri { 00034 namespace index { 00035 class DocListInfo : public DocInfo { 00036 private: 00037 DOCID_T _documentID; 00038 TERMID_T _termID; 00039 greedy_vector<LOC_T,32> _positions; 00040 00041 public: 00042 // DocInfo interface 00043 DOCID_T docID() const { 00044 return _documentID; 00045 } 00046 00047 COUNT_T termCount() const { 00048 return COUNT_T(_positions.size()); 00049 } 00050 00051 virtual const LOC_T* positions() const { 00052 return &_positions.front(); 00053 } 00054 00055 // Internal index use 00056 TERMID_T termID() const { 00057 return _termID; 00058 } 00059 00060 void setDocID( DOCID_T documentID ) { 00061 _documentID = documentID; 00062 } 00063 00064 void setTermID( TERMID_T termID ) { 00065 _termID = termID; 00066 } 00067 00068 void addPosition( LOC_T position ) { 00069 _positions.push_back( position ); 00070 } 00071 00072 void addPositions( LOC_T* positions, int count ) { 00073 _positions.append( positions, positions + count ); 00074 } 00075 00076 void clear() { 00077 _positions.clear(); 00078 } 00079 }; 00080 } 00081 } 00082 00083 #endif // KEYFILE_DOCLISTINFO_HPP 00084