Fennel: /home/pub/open/dev/fennel/hashexe/LhxHashGenerator.h Source File (original) (raw)

00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 #ifndef Fennel_LhxHashGenerator_Included 00024 #define Fennel_LhxHashGenerator_Included 00025 00026 #include "fennel/tuple/TupleData.h" 00027 #include "fennel/tuple/TupleDescriptor.h" 00028 00029 #include "fennel/hashexe/LhxHashBase.h" 00030 00031 using namespace std; 00032 00033 FENNEL_BEGIN_NAMESPACE 00034 00043 class FENNEL_HASHEXE_EXPORT LhxHashGenerator 00044 { 00045 private: 00046
00047 00048 00049 uint level; 00050 00051
00052 00053 00054 uint hashValueSeed; 00055 00056
00057
00058
00059
00060 00061 00062 uint8_t *magicTable; 00063 00064
00065 00073 void hashOneBuffer(uint &hashValue, PConstBuffer pBuf, uint bufSize); 00074 00083 void hashOneColumn( 00084 uint &hashValue, 00085 TupleDatum const &inputCol, 00086 LhxHashTrim isVarChar); 00087 00088 public: 00092 void init(uint levelInit); 00093 00097 uint getLevel(); 00098 00111 uint hash( 00112 TupleData const &inputTuple, 00113 TupleProjection const &keyProjection, 00114 vector const &isKeyColVarChar); 00115 00125 uint hash(TupleDatum const &inputCol, LhxHashTrim isVarChar); 00126 00135 uint hash(PConstBuffer pBuf, uint bufSize); 00136 }; 00137 00138 inline uint LhxHashGenerator::getLevel() 00139 { 00140 return level; 00141 } 00142 00143 inline uint LhxHashGenerator::hash( 00144 TupleDatum const &inputCol, LhxHashTrim isVarChar) 00145 { 00146 uint hashValue = hashValueSeed; 00147 hashOneColumn(hashValue, inputCol, isVarChar); 00148 return hashValue; 00149 } 00150 00151 inline uint LhxHashGenerator::hash(PConstBuffer pBuf, uint bufSize) 00152 { 00153 uint hashValue = hashValueSeed; 00154 hashOneBuffer(hashValue, pBuf, bufSize); 00155 return hashValue; 00156 } 00157 00158 FENNEL_END_NAMESPACE 00159 00160 #endif 00161 00162