diff options
author | Stefan Laner <laner@itestra.de> | 2013-12-20 17:44:09 +0100 |
---|---|---|
committer | Stefan Laner <laner@itestra.de> | 2013-12-23 16:25:53 +0100 |
commit | faa319ed58251f9e8201c55142c7fe33a132db33 (patch) | |
tree | 8b1a92db5eeed0ca4febf12aa0758f5cbd7c92b5 | |
parent | cde1d7697de21e2d2b44d5e99309f6a98370ad32 (diff) | |
download | genivi-common-api-runtime-faa319ed58251f9e8201c55142c7fe33a132db33.tar.gz |
new version for handling msvc variadic template bug by using default
attribute extension
Change-Id: Id8103679ee0ae2856b9d1332dcc7293a304075ee
-rw-r--r-- | src/CommonAPI/Attribute.h | 6 | ||||
-rwxr-xr-x | src/CommonAPI/AttributeExtension.h | 16 | ||||
-rw-r--r-- | src/CommonAPI/Factory.h | 52 |
3 files changed, 56 insertions, 18 deletions
diff --git a/src/CommonAPI/Attribute.h b/src/CommonAPI/Attribute.h index d9c2391..4a7a2e3 100644 --- a/src/CommonAPI/Attribute.h +++ b/src/CommonAPI/Attribute.h @@ -121,6 +121,12 @@ template <typename _ValueType> struct ObservableAttribute: _ObservableAttributeImpl< Attribute<_ValueType> > { }; +#ifdef WIN32 +struct WINDummyAttribute { + WINDummyAttribute() {} +}; +#endif + } // namespace CommonAPI #endif // COMMONAPI_ATTRIBUTE_H_ diff --git a/src/CommonAPI/AttributeExtension.h b/src/CommonAPI/AttributeExtension.h index 5f78c5b..495f18c 100755 --- a/src/CommonAPI/AttributeExtension.h +++ b/src/CommonAPI/AttributeExtension.h @@ -9,6 +9,8 @@ #include "types.h" #include "Event.h" +#include "Proxy.h" +#include "Attribute.h" #include <cstdint> #include <functional> @@ -36,6 +38,20 @@ class AttributeExtension { _AttributeType& baseAttribute_; }; +#ifdef WIN32 +template<typename _AttributeType> +class WINDummyAttributeExtension : public CommonAPI::AttributeExtension<_AttributeType> { + typedef AttributeExtension<_AttributeType> __baseClass_t; + WINDummyAttribute dummyAttribute; +public: + WINDummyAttributeExtension() {}; + WINDummyAttributeExtension(Proxy& proxy) : + AttributeExtension<_AttributeType>(dummyAttribute) {} + + ~WINDummyAttributeExtension() {} +}; +#endif + } // namespace CommonAPI #endif // COMMON_API_DBUS_ATTRIBUTE_EXTENSION_H_ diff --git a/src/CommonAPI/Factory.h b/src/CommonAPI/Factory.h index 7f167a1..dd14fbc 100644 --- a/src/CommonAPI/Factory.h +++ b/src/CommonAPI/Factory.h @@ -18,6 +18,7 @@ #include "Proxy.h" #include "Runtime.h" #include "Stub.h" +#include "AttributeExtension.h" namespace CommonAPI { @@ -69,13 +70,24 @@ class Factory { * @return a shared pointer to the constructed proxy */ template<template<typename ...> class _ProxyClass, typename ... _AttributeExtensions> - std::shared_ptr<_ProxyClass<_AttributeExtensions...> > - buildProxy(const std::string& participantId, - const std::string& serviceName, - const std::string& domain) { - - std::shared_ptr<Proxy> abstractMiddlewareProxy = createProxy(_ProxyClass<_AttributeExtensions...>::getInterfaceId(), participantId, serviceName, domain); - return std::make_shared<_ProxyClass<_AttributeExtensions...>>(abstractMiddlewareProxy); + std::shared_ptr< + _ProxyClass< +#ifdef WIN32 + CommonAPI::WINDummyAttributeExtension<WINDummyAttribute>, +#endif + _AttributeExtensions...> + > buildProxy(const std::string& participantId, + const std::string& serviceName, + const std::string& domain) { + std::shared_ptr<Proxy> abstractMiddlewareProxy = createProxy(_ProxyClass<_AttributeExtensions...>::getInterfaceId(), participantId, serviceName, domain); + auto returnProxy = std::make_shared< + _ProxyClass< +#ifdef WIN32 + CommonAPI::WINDummyAttributeExtension<WINDummyAttribute>, +#endif + _AttributeExtensions...> + >(abstractMiddlewareProxy); + return returnProxy; } /** @@ -88,17 +100,21 @@ class Factory { * @return a shared pointer to the constructed proxy */ template<template<typename ...> class _ProxyClass, typename ... _AttributeExtensions > - std::shared_ptr<_ProxyClass<_AttributeExtensions...> > - buildProxy(const std::string& serviceAddress) { - - std::string domain; - std::string serviceName; - std::string participantId; - if(!splitValidAddress(serviceAddress, domain, serviceName, participantId)) { - return false; - } - - return buildProxy<_ProxyClass, _AttributeExtensions...>(participantId, serviceName, domain); + std::shared_ptr< + _ProxyClass< +#ifdef WIN32 + CommonAPI::WINDummyAttributeExtension<WINDummyAttribute>, +#endif + _AttributeExtensions...> + > buildProxy(const std::string& serviceAddress) { + std::string domain; + std::string serviceName; + std::string participantId; + if(!splitValidAddress(serviceAddress, domain, serviceName, participantId)) { + return false; + } + + return buildProxy<_ProxyClass, _AttributeExtensions...>(participantId, serviceName, domain); } /** |