00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef __ZTupleIndex__
00026 #define __ZTupleIndex__
00027 #include "zconfig.h"
00028
00029 #include "ZTBSpec.h"
00030
00031 #include <deque>
00032 #include <list>
00033 #include <set>
00034 #include <vector>
00035
00036 #ifndef ZCONFIG_TupleIndex_Debug
00037 # define ZCONFIG_TupleIndex_Debug 3
00038 #endif
00039
00040 class ZStrimW;
00041
00042
00043 #pragma mark -
00044 #pragma mark * ZTupleIndex
00045
00046 class ZTupleIndex
00047 {
00048 public:
00049 static const uint64 kMaxID = 0xFFFFFFFFFFFFFFFFULL;
00050
00051 virtual ~ZTupleIndex();
00052
00053 virtual void Add(uint64 iID, const ZTuple* iTuple) = 0;
00054
00055 virtual void Remove(uint64 iID, const ZTuple* iTuple) = 0;
00056
00057 virtual void Find(const std::set<uint64>& iSkipIDs,
00058 std::vector<const ZTBSpec::Criterion*>& ioCriteria, std::vector<uint64>& oIDs) = 0;
00059
00060 virtual size_t CanHandle(const ZTBSpec::CriterionSect& iCriterionSect) = 0;
00061
00062 void Find(const ZTBSpec::CriterionSect& iCriterionSect, const std::set<uint64>& iSkipIDs,
00063 std::vector<const ZTBSpec::Criterion*>& oUncheckedCriteria, std::vector<uint64>& oIDs);
00064
00065 virtual void WriteDescription(const ZStrimW& s);
00066
00067 static bool sMatchIndices(const ZTBSpec::CriterionUnion& iCriterionUnion,
00068 const std::vector<ZTupleIndex*>& iIndices, std::vector<ZTupleIndex*>& oIndices);
00069
00070 static bool sGatherMergeConstraints(const ZTuplePropName& iPropName,
00071 vector<const ZTBSpec::Criterion*>& ioCriteria,
00072 const ZTupleValue*& oValueEqual,
00073 const ZTupleValue*& oBestValueLess, const ZTupleValue*& oBestValueLessEqual,
00074 const ZTupleValue*& oBestValueGreater, const ZTupleValue*& oBestValueGreaterEqual);
00075 };
00076
00077
00078 #pragma mark -
00079 #pragma mark * ZTupleIndexFactory
00080
00081 class ZTupleIndexFactory : public ZRefCounted
00082 {
00083 public:
00084 virtual ~ZTupleIndexFactory();
00085 virtual ZTupleIndex* Make() = 0;
00086 };
00087
00088 #endif // __ZTupleIndex__