diff options
Diffstat (limited to 'common/facade.h')
-rw-r--r-- | common/facade.h | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/common/facade.h b/common/facade.h index b193580..50d93e0 100644 --- a/common/facade.h +++ b/common/facade.h | |||
@@ -28,6 +28,7 @@ | |||
28 | #include "resourceaccess.h" | 28 | #include "resourceaccess.h" |
29 | #include "domaintypeadaptorfactoryinterface.h" | 29 | #include "domaintypeadaptorfactoryinterface.h" |
30 | #include "storage.h" | 30 | #include "storage.h" |
31 | #include "resourcecontext.h" | ||
31 | 32 | ||
32 | namespace Sink { | 33 | namespace Sink { |
33 | 34 | ||
@@ -48,7 +49,7 @@ class SINK_EXPORT GenericFacade : public Sink::StoreFacade<DomainType> | |||
48 | { | 49 | { |
49 | protected: | 50 | protected: |
50 | SINK_DEBUG_AREA("facade") | 51 | SINK_DEBUG_AREA("facade") |
51 | SINK_DEBUG_COMPONENT(mResourceInstanceIdentifier) | 52 | SINK_DEBUG_COMPONENT(mResourceContext.resourceInstanceIdentifier) |
52 | public: | 53 | public: |
53 | /** | 54 | /** |
54 | * Create a new GenericFacade | 55 | * Create a new GenericFacade |
@@ -56,8 +57,7 @@ public: | |||
56 | * @param resourceIdentifier is the identifier of the resource instance | 57 | * @param resourceIdentifier is the identifier of the resource instance |
57 | * @param adaptorFactory is the adaptor factory used to generate the mappings from domain to resource types and vice versa | 58 | * @param adaptorFactory is the adaptor factory used to generate the mappings from domain to resource types and vice versa |
58 | */ | 59 | */ |
59 | GenericFacade(const QByteArray &resourceIdentifier, const DomainTypeAdaptorFactoryInterface::Ptr &adaptorFactory = DomainTypeAdaptorFactoryInterface::Ptr(), | 60 | GenericFacade(const ResourceContext &context); |
60 | const QSharedPointer<Sink::ResourceAccessInterface> resourceAccess = QSharedPointer<Sink::ResourceAccessInterface>()); | ||
61 | virtual ~GenericFacade(); | 61 | virtual ~GenericFacade(); |
62 | 62 | ||
63 | static QByteArray bufferTypeForDomainType(); | 63 | static QByteArray bufferTypeForDomainType(); |
@@ -68,20 +68,18 @@ public: | |||
68 | 68 | ||
69 | protected: | 69 | protected: |
70 | std::function<void(Sink::ApplicationDomain::ApplicationDomainType &domainObject)> mResultTransformation; | 70 | std::function<void(Sink::ApplicationDomain::ApplicationDomainType &domainObject)> mResultTransformation; |
71 | // TODO use one resource access instance per application & per resource | 71 | ResourceContext mResourceContext; |
72 | QSharedPointer<Sink::ResourceAccessInterface> mResourceAccess; | 72 | Sink::ResourceAccessInterface::Ptr mResourceAccess; |
73 | DomainTypeAdaptorFactoryInterface::Ptr mDomainTypeAdaptorFactory; | ||
74 | QByteArray mResourceInstanceIdentifier; | ||
75 | }; | 73 | }; |
76 | 74 | ||
77 | /** | 75 | /** |
78 | * A default facade implemenation that simply instantiates a generic resource with the given DomainTypeAdaptorFactory | 76 | * A default facade implemenation that simply instantiates a generic resource |
79 | */ | 77 | */ |
80 | template<typename DomainType, typename DomainTypeAdaptorFactory> | 78 | template<typename DomainType> |
81 | class DefaultFacade : public GenericFacade<DomainType> | 79 | class DefaultFacade : public GenericFacade<DomainType> |
82 | { | 80 | { |
83 | public: | 81 | public: |
84 | DefaultFacade(const QByteArray &resourceIdentifier) : GenericFacade<DomainType>(resourceIdentifier, QSharedPointer<DomainTypeAdaptorFactory>::create()) {} | 82 | DefaultFacade(const ResourceContext &context) : GenericFacade<DomainType>(context) {} |
85 | virtual ~DefaultFacade(){} | 83 | virtual ~DefaultFacade(){} |
86 | }; | 84 | }; |
87 | 85 | ||