From 749c4d7da40bf20d240be5ad7948f4be843865cd Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Thu, 16 Jun 2016 22:19:43 +0200 Subject: Simpler facade and domaintypeadaptorfactory instantiation --- common/domainadaptor.h | 3 ++- common/facade.h | 14 +++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/common/domainadaptor.h b/common/domainadaptor.h index 3af0fad..e97c5f5 100644 --- a/common/domainadaptor.h +++ b/common/domainadaptor.h @@ -35,6 +35,7 @@ #include "entitybuffer.h" #include "propertymapper.h" #include "log.h" +#include "dummy_generated.h" /** * Create a buffer from a domain object using the provided mappings @@ -130,7 +131,7 @@ public: * It defines how values are split accross local and resource buffer. * This is required by the facade the read the value, and by the pipeline preprocessors to access the domain values in a generic way. */ -template +template class SINK_EXPORT DomainTypeAdaptorFactory : public DomainTypeAdaptorFactoryInterface { typedef typename Sink::ApplicationDomain::TypeImplementation::Buffer LocalBuffer; diff --git a/common/facade.h b/common/facade.h index a24ac7a..658ccb8 100644 --- a/common/facade.h +++ b/common/facade.h @@ -55,7 +55,7 @@ public: */ GenericFacade(const QByteArray &resourceIdentifier, const DomainTypeAdaptorFactoryInterface::Ptr &adaptorFactory = DomainTypeAdaptorFactoryInterface::Ptr(), const QSharedPointer resourceAccess = QSharedPointer()); - ~GenericFacade(); + virtual ~GenericFacade(); static QByteArray bufferTypeForDomainType(); KAsync::Job create(const DomainType &domainObject) Q_DECL_OVERRIDE; @@ -70,4 +70,16 @@ protected: DomainTypeAdaptorFactoryInterface::Ptr mDomainTypeAdaptorFactory; QByteArray mResourceInstanceIdentifier; }; + +/** + * A default facade implemenation that simply instantiates a generic resource with the given DomainTypeAdaptorFactory + */ +template +class DefaultFacade : public GenericFacade +{ +public: + DefaultFacade(const QByteArray &resourceIdentifier) : GenericFacade(resourceIdentifier, QSharedPointer::create()) {} + virtual ~DefaultFacade(){} +}; + } -- cgit v1.2.3