diff options
author | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-04-19 21:07:36 +0200 |
---|---|---|
committer | Christian Mollekopf <chrigi_1@fastmail.fm> | 2015-04-19 21:07:36 +0200 |
commit | b4db894f76de9ac252081972143efcd3fcd66533 (patch) | |
tree | 2ef5929648c7cbaa5293a9175189c218f0dbe804 /common/domainadaptor.h | |
parent | f89e43b3603976bc0e6eb885b3b9a43a6caff1c2 (diff) | |
download | sink-b4db894f76de9ac252081972143efcd3fcd66533.tar.gz sink-b4db894f76de9ac252081972143efcd3fcd66533.zip |
Moved complete writing part to GenericFacade
Diffstat (limited to 'common/domainadaptor.h')
-rw-r--r-- | common/domainadaptor.h | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/common/domainadaptor.h b/common/domainadaptor.h index d07a2bd..fd015b5 100644 --- a/common/domainadaptor.h +++ b/common/domainadaptor.h | |||
@@ -171,13 +171,22 @@ QSharedPointer<ReadPropertyMapper<T> > initializeReadPropertyMapper(); | |||
171 | template <class T> | 171 | template <class T> |
172 | QSharedPointer<WritePropertyMapper<T> > initializeWritePropertyMapper(); | 172 | QSharedPointer<WritePropertyMapper<T> > initializeWritePropertyMapper(); |
173 | 173 | ||
174 | template<typename DomainType> | ||
175 | class DomainTypeAdaptorFactoryInterface | ||
176 | { | ||
177 | public: | ||
178 | virtual ~DomainTypeAdaptorFactoryInterface() {}; | ||
179 | virtual QSharedPointer<Akonadi2::ApplicationDomain::BufferAdaptor> createAdaptor(const Akonadi2::Entity &entity) = 0; | ||
180 | virtual void createBuffer(const DomainType &event, flatbuffers::FlatBufferBuilder &fbb) = 0; | ||
181 | }; | ||
182 | |||
174 | /** | 183 | /** |
175 | * The factory should define how to go from an entitybuffer (local + resource buffer), to a domain type adapter. | 184 | * The factory should define how to go from an entitybuffer (local + resource buffer), to a domain type adapter. |
176 | * It defines how values are split accross local and resource buffer. | 185 | * It defines how values are split accross local and resource buffer. |
177 | * This is required by the facade the read the value, and by the pipeline preprocessors to access the domain values in a generic way. | 186 | * This is required by the facade the read the value, and by the pipeline preprocessors to access the domain values in a generic way. |
178 | */ | 187 | */ |
179 | template<typename DomainType, typename LocalBuffer, typename ResourceBuffer, typename LocalBuilder, typename ResourceBuilder> | 188 | template<typename DomainType, typename LocalBuffer, typename ResourceBuffer, typename LocalBuilder, typename ResourceBuilder> |
180 | class DomainTypeAdaptorFactory | 189 | class DomainTypeAdaptorFactory : public DomainTypeAdaptorFactoryInterface<DomainType> |
181 | { | 190 | { |
182 | public: | 191 | public: |
183 | DomainTypeAdaptorFactory() : | 192 | DomainTypeAdaptorFactory() : |
@@ -193,7 +202,7 @@ public: | |||
193 | * | 202 | * |
194 | * This returns by default a GenericBufferAdaptor initialized with the corresponding property mappers. | 203 | * This returns by default a GenericBufferAdaptor initialized with the corresponding property mappers. |
195 | */ | 204 | */ |
196 | virtual QSharedPointer<Akonadi2::ApplicationDomain::BufferAdaptor> createAdaptor(const Akonadi2::Entity &entity) | 205 | virtual QSharedPointer<Akonadi2::ApplicationDomain::BufferAdaptor> createAdaptor(const Akonadi2::Entity &entity) Q_DECL_OVERRIDE |
197 | { | 206 | { |
198 | const auto resourceBuffer = Akonadi2::EntityBuffer::readBuffer<ResourceBuffer>(entity.resource()); | 207 | const auto resourceBuffer = Akonadi2::EntityBuffer::readBuffer<ResourceBuffer>(entity.resource()); |
199 | const auto localBuffer = Akonadi2::EntityBuffer::readBuffer<LocalBuffer>(entity.local()); | 208 | const auto localBuffer = Akonadi2::EntityBuffer::readBuffer<LocalBuffer>(entity.local()); |
@@ -207,7 +216,7 @@ public: | |||
207 | return adaptor; | 216 | return adaptor; |
208 | } | 217 | } |
209 | 218 | ||
210 | virtual void createBuffer(const Akonadi2::ApplicationDomain::Event &event, flatbuffers::FlatBufferBuilder &fbb) {}; | 219 | virtual void createBuffer(const Akonadi2::ApplicationDomain::Event &event, flatbuffers::FlatBufferBuilder &fbb) Q_DECL_OVERRIDE {}; |
211 | 220 | ||
212 | protected: | 221 | protected: |
213 | QSharedPointer<ReadPropertyMapper<LocalBuffer> > mLocalMapper; | 222 | QSharedPointer<ReadPropertyMapper<LocalBuffer> > mLocalMapper; |