FirteX-高性能全文索引和检索平台

API Documentation


首页 | 名字空间列表 | 类继承关系 | 组合类型列表 | $(BL\录(B | 文件列表 | 名字空间成员 | 组合类型成员 | 文件成员

SortFieldCache.h

浏览该文件的文档。
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/13
00013 //
00014 #ifndef _SORTFIELDCACHE_H
00015 #define _SORTFIELDCACHE_H
00016 
00017 #if _MSC_VER > 1000
00018 #pragma once
00019 #endif // _MSC_VER > 1000
00020 
00021 #include "SortFieldComparator.h"
00022 #include "../index/IndexReader.h"
00023 using namespace firtex::index;
00024 
00025 namespace firtex
00026 {
00027         namespace search
00028         {
00029                 class CSortFieldCompArray;
00030                 class CSortFieldCache
00031                 {
00032                 public:
00033                         CSortFieldCache(void);
00034                         virtual ~CSortFieldCache(void);
00035                 public:
00036                         static CSortFieldCache* DEFAULT;
00037                 public:
00045                         virtual CSortFieldComparator*   getComparator(CIndexReader* pReader, const tchar* field);
00046 
00052                         virtual CSortFieldCompArray*    getCompArray(CIndexReader* pReader, const tchar* field) = 0;
00053                 };
00054 
00055                 class CSortFieldCompArray
00056                 {
00057                 public:
00058                         CSortFieldCompArray()
00059                         {
00060                                 i8array = NULL;
00061                         }                       
00062                         ~CSortFieldCompArray()
00063                         {
00064                                 switch(arrayType)
00065                                 {
00066                                 case I1_ARRAY:
00067                                         delete[] i8array;
00068                                         break;
00069                                 case UI1_ARRAY:
00070                                         delete[] ui8array;
00071                                         break;
00072                                 case I2_ARRAY:
00073                                         delete[] i16array;
00074                                         break;
00075                                 case UI2_ARRAY:
00076                                         delete[] ui16array;
00077                                         break;
00078                                 case I4_ARRAY:
00079                                         delete[] i32array;
00080                                         break;
00081                                 case UI4_ARRAY:
00082                                         delete[] ui32array;
00083                                         break;
00084                                 case I8_ARRAY:
00085                                         delete[] i64array;
00086                                         break;
00087                                 case UI8_ARRAY:
00088                                         delete[] ui64array;
00089                                         break;
00090                                 case R4_ARRAY:
00091                                         delete[] farray;
00092                                         break;
00093                                 case R8_ARRAY:
00094                                         delete[] dbarray;
00095                                         break;
00096                                 }
00097                         }
00098 
00099                         enum ARRAYENUM
00100                         {                               
00101                                 I1_ARRAY                = 1,
00102                                 UI1_ARRAY               = 2,
00103                                 I2_ARRAY                = 3,
00104                                 UI2_ARRAY               = 4,
00105                                 I4_ARRAY                = 5,
00106                                 UI4_ARRAY               = 6,
00107                                 I8_ARRAY                = 7,
00108                                 UI8_ARRAY               = 8,
00109 
00110                                 R4_ARRAY                = 9,
00111                                 R8_ARRAY                = 10,
00112 
00113                                 SORT_COMPARATOR = 11,
00114                         };
00115 
00116                         typedef unsigned short array_type;
00117                         
00118                         array_type      arrayType;                      
00119                         int32_t         arrayLen;               //数组长度,当阿rraylType = SORT_COMPARATOR时无效
00120                         union
00121                         {                               
00122                                 int8_t*                                 i8array;
00123                                 uint8_t*                                ui8array;
00124                                 int16_t*                                i16array;
00125                                 uint16_t*                               ui16array;
00126                                 int32_t*                                i32array;
00127                                 uint32_t*                               ui32array;
00128                                 int64_t*                                i64array;
00129                                 uint64_t*                               ui64array;
00130 
00131                                 float*                                  farray;
00132                                 double*                                 dbarray;
00133 
00134                                 CSortFieldComparator*   sortComparator; 
00135                         };              
00136                 };
00137         }
00138 }
00139 
00140 #endif

http://www.firtex.org http://www.sourceforge.net/projects/firtex