summaryrefslogtreecommitdiffstats
path: root/common/domainadaptor.h
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2015-04-19 21:07:36 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2015-04-19 21:07:36 +0200
commitb4db894f76de9ac252081972143efcd3fcd66533 (patch)
tree2ef5929648c7cbaa5293a9175189c218f0dbe804 /common/domainadaptor.h
parentf89e43b3603976bc0e6eb885b3b9a43a6caff1c2 (diff)
downloadsink-b4db894f76de9ac252081972143efcd3fcd66533.tar.gz
sink-b4db894f76de9ac252081972143efcd3fcd66533.zip
Moved complete writing part to GenericFacade
Diffstat (limited to 'common/domainadaptor.h')
-rw-r--r--common/domainadaptor.h15
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();
171template <class T> 171template <class T>
172QSharedPointer<WritePropertyMapper<T> > initializeWritePropertyMapper(); 172QSharedPointer<WritePropertyMapper<T> > initializeWritePropertyMapper();
173 173
174template<typename DomainType>
175class DomainTypeAdaptorFactoryInterface
176{
177public:
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 */
179template<typename DomainType, typename LocalBuffer, typename ResourceBuffer, typename LocalBuilder, typename ResourceBuilder> 188template<typename DomainType, typename LocalBuffer, typename ResourceBuffer, typename LocalBuilder, typename ResourceBuilder>
180class DomainTypeAdaptorFactory 189class DomainTypeAdaptorFactory : public DomainTypeAdaptorFactoryInterface<DomainType>
181{ 190{
182public: 191public:
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
212protected: 221protected:
213 QSharedPointer<ReadPropertyMapper<LocalBuffer> > mLocalMapper; 222 QSharedPointer<ReadPropertyMapper<LocalBuffer> > mLocalMapper;