00001 #ifndef Impala_Core_Table_SelectQuids_h
00002 #define Impala_Core_Table_SelectQuids_h
00003
00004 #include "Core/Table/QuidTable.h"
00005 #include "Core/Table/SelectOneColumn.h"
00006 #include "Core/Table/Criterion.h"
00007
00008 namespace Impala
00009 {
00010 namespace Core
00011 {
00012 namespace Table
00013 {
00014
00015
00020 template <class T, class Criterion>
00021 void
00022 SelectQuids(QuidTable*& dst, T* src, Criterion& c, bool doClearDst)
00023 {
00024 if (dst == 0)
00025 dst = new QuidTable(0);
00026 bool* filter = Filter(src, c);
00027 SelectOneColumn(dst, src, 1, filter, doClearDst);
00028 delete filter;
00029 }
00030
00035 template <class T, class Criterion>
00036 QuidTable*
00037 SelectQuids(T* src, Criterion& c)
00038 {
00039 QuidTable* dst = 0;
00040 SelectQuids(dst, src, c, false);
00041 return dst;
00042 }
00043
00046 template <class T>
00047 void
00048 SelectQuidsByObject(QuidTable*& dst, T* src, int quidObject, bool doClearDst)
00049 {
00050 CriterionQuidObjectEquals<T> crit(quidObject);
00051 SelectQuids(dst, src, crit, doClearDst);
00052 }
00053
00056 template <class T>
00057 void
00058 SelectQuidsByObjectSet(QuidTable*& dst, T* src, std::vector<int> quidObjects,
00059 bool doClearDst)
00060 {
00061 CriterionQuidObjectInSet<T> crit(quidObjects);
00062 SelectQuids(dst, src, crit, doClearDst);
00063 }
00064
00065 }
00066 }
00067 }
00068
00069 #endif