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,ruijieguo@gmail.com 00012 // Created : 2006/7/14 00013 // 00014 #ifndef _SORTFIELDCACHEIMPL_H 00015 #define _SORTFIELDCACHEIMPL_H 00016 00017 #if _MSC_VER > 1000 00018 #pragma once 00019 #endif // _MSC_VER > 1000 00020 00021 #include "SortFieldCache.h" 00022 #include <map> 00023 using namespace std; 00024 00025 namespace firtex 00026 { 00027 namespace search 00028 { 00029 class CSortFieldCacheImpl : public CSortFieldCache 00030 { 00031 public: 00032 CSortFieldCacheImpl(void); 00033 virtual ~CSortFieldCacheImpl(void); 00034 public: 00035 CSortFieldCompArray* getCompArray(CIndexReader* pReader, const tchar* field); 00036 protected: 00037 CSortFieldCompArray* getI1(CIndexReader* pReader, CFieldInfo* pFieldInfo); 00038 CSortFieldCompArray* getUI1(CIndexReader* pReader, CFieldInfo* pFieldInfo); 00039 CSortFieldCompArray* getI2(CIndexReader* pReader, CFieldInfo* pFieldInfo); 00040 CSortFieldCompArray* getUI2(CIndexReader* pReader, CFieldInfo* pFieldInfo); 00041 CSortFieldCompArray* getI4(CIndexReader* pReader, CFieldInfo* pFieldInfo); 00042 CSortFieldCompArray* getUI4(CIndexReader* pReader, CFieldInfo* pFieldInfo); 00043 CSortFieldCompArray* getI8(CIndexReader* pReader, CFieldInfo* pFieldInfo); 00044 CSortFieldCompArray* getUI8(CIndexReader* pReader, CFieldInfo* pFieldInfo); 00045 CSortFieldCompArray* getR4(CIndexReader* pReader, CFieldInfo* pFieldInfo); 00046 CSortFieldCompArray* getR8(CIndexReader* pReader, CFieldInfo* pFieldInfo); 00047 00048 CSortFieldCompArray* getCachedArray(const tstring& field); 00049 void storeInCache(const tstring& field,CSortFieldCompArray* pArray); 00050 private: 00051 map<tstring,CSortFieldCompArray*> m_cacheArray; 00052 }; 00054 //inline functions 00055 inline CSortFieldCompArray* CSortFieldCacheImpl::getCachedArray(const tstring& field) 00056 { 00057 map<tstring,CSortFieldCompArray*>::iterator iter = m_cacheArray.find(field); 00058 if(iter != m_cacheArray.end()) 00059 { 00060 return iter->second; 00061 } 00062 return NULL; 00063 } 00064 inline void CSortFieldCacheImpl::storeInCache(const tstring& field,CSortFieldCompArray* pArray) 00065 { 00066 m_cacheArray.insert(make_pair(field,pArray)); 00067 } 00068 00069 } 00070 } 00071 00072 #endif
http://www.firtex.org http://www.sourceforge.net/projects/firtex