diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-01-15 01:56:09 +0100 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-01-15 01:56:09 +0100 |
commit | bc2a95cad05e454a84c317f1078edb329bd3afd4 (patch) | |
tree | 4cb54032b075a8730a532ccd7485db598e859ac8 /common/pipeline.h | |
parent | 70bb707903da21103b84e0f3effcaa0a24612d5c (diff) | |
download | sink-bc2a95cad05e454a84c317f1078edb329bd3afd4.tar.gz sink-bc2a95cad05e454a84c317f1078edb329bd3afd4.zip |
Writing from facade.
Diffstat (limited to 'common/pipeline.h')
-rw-r--r-- | common/pipeline.h | 41 |
1 files changed, 10 insertions, 31 deletions
diff --git a/common/pipeline.h b/common/pipeline.h index 6b847f5..918d21e 100644 --- a/common/pipeline.h +++ b/common/pipeline.h | |||
@@ -27,7 +27,7 @@ | |||
27 | 27 | ||
28 | #include <akonadi2common_export.h> | 28 | #include <akonadi2common_export.h> |
29 | #include <storage.h> | 29 | #include <storage.h> |
30 | #include <clientapi.h> //For domain types | 30 | #include "async/src/async.h" |
31 | 31 | ||
32 | #include "entity_generated.h" | 32 | #include "entity_generated.h" |
33 | 33 | ||
@@ -49,34 +49,13 @@ public: | |||
49 | 49 | ||
50 | Storage &storage() const; | 50 | Storage &storage() const; |
51 | 51 | ||
52 | // template <typename T> | 52 | void setPreprocessors(const QString &entityType, Type pipelineType, const QVector<Preprocessor *> &preprocessors); |
53 | // Storage &storage() const; | ||
54 | |||
55 | template <typename T> | ||
56 | void setPreprocessors(Type type, const QVector<Preprocessor *> &preprocessors) | ||
57 | { | ||
58 | setPreprocessors(Akonadi2::Domain::getTypeName<T>(), type, preprocessors); | ||
59 | } | ||
60 | 53 | ||
61 | void null(); | 54 | void null(); |
62 | 55 | ||
63 | template <typename T> | 56 | Async::Job<void> newEntity(void const *command, size_t size); |
64 | void newEntity(const QByteArray &key, void *resourceBufferData, size_t size) | 57 | void modifiedEntity(const QString &entityType, const QByteArray &key, void *data, size_t size); |
65 | { | 58 | void deletedEntity(const QString &entityType, const QByteArray &key); |
66 | newEntity(Akonadi2::Domain::getTypeName<T>(), key, resourceBufferData, size); | ||
67 | } | ||
68 | |||
69 | template <typename T> | ||
70 | void modifiedEntity(const QByteArray &key, void *data, size_t size) | ||
71 | { | ||
72 | modifiedEntity(Akonadi2::Domain::getTypeName<T>(), key, data, size); | ||
73 | } | ||
74 | |||
75 | template <typename T> | ||
76 | void deletedEntity(const QByteArray &key) | ||
77 | { | ||
78 | deletedEntity(Akonadi2::Domain::getTypeName<T>(), key); | ||
79 | } | ||
80 | 59 | ||
81 | Q_SIGNALS: | 60 | Q_SIGNALS: |
82 | void revisionUpdated(); | 61 | void revisionUpdated(); |
@@ -86,10 +65,6 @@ private Q_SLOTS: | |||
86 | void stepPipelines(); | 65 | void stepPipelines(); |
87 | 66 | ||
88 | private: | 67 | private: |
89 | void setPreprocessors(const QString &entityType, Type pipelineType, const QVector<Preprocessor *> &preprocessors); | ||
90 | void newEntity(const QString &entityType, const QByteArray &key, void *resourceBufferData, size_t size); | ||
91 | void modifiedEntity(const QString &entityType, const QByteArray &key, void *data, size_t size); | ||
92 | void deletedEntity(const QString &entityType, const QByteArray &key); | ||
93 | void pipelineStepped(const PipelineState &state); | 68 | void pipelineStepped(const PipelineState &state); |
94 | void pipelineCompleted(const PipelineState &state); | 69 | void pipelineCompleted(const PipelineState &state); |
95 | void scheduleStep(); | 70 | void scheduleStep(); |
@@ -104,7 +79,7 @@ class AKONADI2COMMON_EXPORT PipelineState | |||
104 | { | 79 | { |
105 | public: | 80 | public: |
106 | PipelineState(); | 81 | PipelineState(); |
107 | PipelineState(Pipeline *pipeline, Pipeline::Type type, const QByteArray &key, const QVector<Preprocessor *> &filters); | 82 | PipelineState(Pipeline *pipeline, Pipeline::Type type, const QByteArray &key, const QVector<Preprocessor *> &filters, const std::function<void()> &callback); |
108 | PipelineState(const PipelineState &other); | 83 | PipelineState(const PipelineState &other); |
109 | ~PipelineState(); | 84 | ~PipelineState(); |
110 | 85 | ||
@@ -114,6 +89,7 @@ public: | |||
114 | bool isIdle() const; | 89 | bool isIdle() const; |
115 | QByteArray key() const; | 90 | QByteArray key() const; |
116 | Pipeline::Type type() const; | 91 | Pipeline::Type type() const; |
92 | //TODO expose command | ||
117 | 93 | ||
118 | void step(); | 94 | void step(); |
119 | void processingCompleted(Preprocessor *filter); | 95 | void processingCompleted(Preprocessor *filter); |
@@ -129,7 +105,10 @@ public: | |||
129 | Preprocessor(); | 105 | Preprocessor(); |
130 | virtual ~Preprocessor(); | 106 | virtual ~Preprocessor(); |
131 | 107 | ||
108 | //TODO pass actual command as well, for changerecording | ||
132 | virtual void process(PipelineState state, const Akonadi2::Entity &); | 109 | virtual void process(PipelineState state, const Akonadi2::Entity &); |
110 | //TODO to record progress | ||
111 | // virtual QString id(); | ||
133 | 112 | ||
134 | protected: | 113 | protected: |
135 | void processingCompleted(PipelineState state); | 114 | void processingCompleted(PipelineState state); |