FirteX-高性能全文索引和检索平台API Documentation |
00001 // 00002 // Copyright(C) 2005--2006 Institute of Computing Tech, Chinese Academy of Sciences. 00003 // All rights reserved. 00004 // This file is part of FirteX (www.firtex.org) 00005 // 00006 // Use of the FirteX is subject to the terms of the software license set forth in 00007 // the LICENSE file included with this software, and also available at 00008 // http://www.firtex.org/license.html 00009 // 00010 // Author : 郭瑞杰(GuoRuijie) 00011 // Email : ruijieguo@software.ict.ac.cn 00012 // Created : 2006/2/23 00013 // 00014 00015 #ifndef _FIELDMERGER_H 00016 #define _FIELDMERGER_H 00017 00018 #include "FieldsInfo.h" 00019 #include "FieldIndexer.h" 00020 #include "BarrelsInfo.h" 00021 #include "../store/Directory.h" 00022 #include <string> 00023 using namespace std; 00024 using namespace firtex::store; 00025 00026 namespace firtex 00027 { 00028 namespace index 00029 { 00030 class CFieldMergeEntry 00031 { 00032 public: 00033 CFieldMergeEntry() 00034 { 00035 m_pFieldInfo = NULL; 00036 m_pBarrelInfo = NULL; 00037 } 00038 CFieldMergeEntry(CBarrelInfo* pBarrelInfo,CFieldInfo* pFieldInfo) 00039 { 00040 m_pBarrelInfo = pBarrelInfo; 00041 m_pFieldInfo = new CFieldInfo(*pFieldInfo); 00042 } 00043 ~CFieldMergeEntry() 00044 { 00045 if(m_pFieldInfo) 00046 { 00047 delete m_pFieldInfo; 00048 m_pFieldInfo = NULL; 00049 } 00050 m_pBarrelInfo = NULL; 00051 } 00052 protected: 00053 CBarrelInfo* m_pBarrelInfo; 00054 CFieldInfo* m_pFieldInfo; 00055 }; 00056 00057 00058 class CFieldMerger 00059 { 00060 public: 00061 CFieldMerger(void):m_buffer(NULL),m_bufsize(0) 00062 { 00063 } 00064 virtual ~CFieldMerger(void) 00065 { 00066 m_buffer = NULL; 00067 m_bufsize = 0; 00068 } 00069 public: 00070 virtual void addField(CBarrelInfo* pBarrelInfo,CFieldInfo* pFieldInfo) = 0; 00071 virtual count_t merge(CDirectory* pDirectory,CIndexOutputDescriptor* pDesc) = 0; 00072 void setBuffer(char* buf,size_t bufSize); 00073 protected: 00074 char* m_buffer; 00075 size_t m_bufsize; 00076 }; 00078 //inline 00079 inline void CFieldMerger::setBuffer(char* buf,size_t bufSize) 00080 { 00081 m_buffer = buf; 00082 m_bufsize = bufSize; 00083 } 00084 } 00085 } 00086 00087 #endif
http://www.firtex.org http://www.sourceforge.net/projects/firtex