summaryrefslogtreecommitdiffstats
path: root/common/resultset.h
diff options
context:
space:
mode:
Diffstat (limited to 'common/resultset.h')
-rw-r--r--common/resultset.h21
1 files changed, 13 insertions, 8 deletions
diff --git a/common/resultset.h b/common/resultset.h
index 5587c54..9d83c67 100644
--- a/common/resultset.h
+++ b/common/resultset.h
@@ -25,6 +25,7 @@
25#include "metadata_generated.h" 25#include "metadata_generated.h"
26#include "entitybuffer.h" 26#include "entitybuffer.h"
27#include "applicationdomaintype.h" 27#include "applicationdomaintype.h"
28#include "storage/key.h"
28 29
29/* 30/*
30 * An iterator to a result set. 31 * An iterator to a result set.
@@ -35,21 +36,25 @@ class ResultSet
35{ 36{
36public: 37public:
37 struct Result { 38 struct Result {
38 Result(const Sink::ApplicationDomain::ApplicationDomainType &e, Sink::Operation op, const QMap<QByteArray, QVariant> &v = {}, const QVector<QByteArray> &a = {}) : entity(e), operation(op), aggregateValues(v), aggregateIds(a) {} 39 Result(const Sink::ApplicationDomain::ApplicationDomainType &e, Sink::Operation op,
40 const QMap<QByteArray, QVariant> &v = {}, const QVector<Sink::Storage::Identifier> &a = {})
41 : entity(e), operation(op), aggregateValues(v), aggregateIds(a)
42 {
43 }
39 Sink::ApplicationDomain::ApplicationDomainType entity; 44 Sink::ApplicationDomain::ApplicationDomainType entity;
40 Sink::Operation operation; 45 Sink::Operation operation;
41 QMap<QByteArray, QVariant> aggregateValues; 46 QMap<QByteArray, QVariant> aggregateValues;
42 QVector<QByteArray> aggregateIds; 47 QVector<Sink::Storage::Identifier> aggregateIds;
43 }; 48 };
44 typedef std::function<void(const Result &)> Callback; 49 typedef std::function<void(const Result &)> Callback;
45 typedef std::function<bool(Callback)> ValueGenerator; 50 typedef std::function<bool(Callback)> ValueGenerator;
46 typedef std::function<QByteArray()> IdGenerator; 51 typedef std::function<Sink::Storage::Identifier()> IdGenerator;
47 typedef std::function<void()> SkipValue; 52 typedef std::function<void()> SkipValue;
48 53
49 ResultSet(); 54 ResultSet();
50 ResultSet(const ValueGenerator &generator, const SkipValue &skip); 55 ResultSet(const ValueGenerator &generator, const SkipValue &skip);
51 ResultSet(const IdGenerator &generator); 56 ResultSet(const IdGenerator &generator);
52 ResultSet(const QVector<QByteArray> &resultSet); 57 ResultSet(const QVector<Sink::Storage::Identifier> &resultSet);
53 ResultSet(const ResultSet &other); 58 ResultSet(const ResultSet &other);
54 59
55 bool next(); 60 bool next();
@@ -63,14 +68,14 @@ public:
63 }; 68 };
64 ReplayResult replaySet(int offset, int batchSize, const Callback &callback); 69 ReplayResult replaySet(int offset, int batchSize, const Callback &callback);
65 70
66 QByteArray id(); 71 Sink::Storage::Identifier id();
67 72
68 bool isEmpty(); 73 bool isEmpty();
69 74
70private: 75private:
71 QVector<QByteArray> mResultSet; 76 QVector<Sink::Storage::Identifier> mResultSet;
72 QVector<QByteArray>::ConstIterator mIt; 77 QVector<Sink::Storage::Identifier>::ConstIterator mIt;
73 QByteArray mCurrentValue; 78 Sink::Storage::Identifier mCurrentValue;
74 IdGenerator mGenerator; 79 IdGenerator mGenerator;
75 ValueGenerator mValueGenerator; 80 ValueGenerator mValueGenerator;
76 SkipValue mSkip; 81 SkipValue mSkip;