diff options
author | Dirk Huss <dirk_huss@mentor.com> | 2015-11-25 14:59:52 +0100 |
---|---|---|
committer | Dirk Huss <dirk_huss@mentor.com> | 2015-11-25 14:59:52 +0100 |
commit | faea5f299525500093843da72215d279c3eb483d (patch) | |
tree | 559a22a4f9844a4f8d04d8e39f37d04da797d1a0 /include/CommonAPI/DBus/DBusFreedesktopAttribute.hpp | |
parent | db96446ece67ba1f495811e29838e8c7bc7984ff (diff) | |
download | genivi-common-api-dbus-runtime-faea5f299525500093843da72215d279c3eb483d.tar.gz |
CommonAPI-D-Bus 3.1.43.1.4
Diffstat (limited to 'include/CommonAPI/DBus/DBusFreedesktopAttribute.hpp')
-rw-r--r-- | include/CommonAPI/DBus/DBusFreedesktopAttribute.hpp | 491 |
1 files changed, 156 insertions, 335 deletions
diff --git a/include/CommonAPI/DBus/DBusFreedesktopAttribute.hpp b/include/CommonAPI/DBus/DBusFreedesktopAttribute.hpp index fd9237e..4f78f5c 100644 --- a/include/CommonAPI/DBus/DBusFreedesktopAttribute.hpp +++ b/include/CommonAPI/DBus/DBusFreedesktopAttribute.hpp @@ -15,37 +15,38 @@ namespace CommonAPI { namespace DBus { -template <typename _AttributeType, typename _AttributeDepl = EmptyDeployment> -class DBusFreedesktopReadonlyAttribute: public _AttributeType { +template <typename AttributeType_, typename AttributeDepl_ = EmptyDeployment> +class DBusFreedesktopReadonlyAttribute: public AttributeType_ { public: - typedef typename _AttributeType::ValueType ValueType; - typedef _AttributeDepl ValueTypeDepl; - typedef typename _AttributeType::AttributeAsyncCallback AttributeAsyncCallback; + typedef typename AttributeType_::ValueType ValueType; + typedef AttributeDepl_ ValueTypeDepl; + typedef typename AttributeType_::AttributeAsyncCallback AttributeAsyncCallback; DBusFreedesktopReadonlyAttribute(DBusProxy &_proxy, const std::string &_interfaceName, const std::string &_propertyName, - _AttributeDepl *_depl = nullptr) - : proxy_(_proxy), + AttributeDepl_ *_depl = nullptr) + : proxy_(_proxy), interfaceName_(_interfaceName), propertyName_(_propertyName), depl_(_depl) { } void getValue(CommonAPI::CallStatus &_status, ValueType &_value, const CommonAPI::CallInfo *_info) const { - CommonAPI::Deployable<Variant<ValueType>, VariantDeployment<>> deployedValue(&freedesktopVariant); + VariantDeployment<AttributeDepl_> actualDepl(true, depl_); + CommonAPI::Deployable<Variant<ValueType>, VariantDeployment<AttributeDepl_>> deployedValue(&actualDepl); DBusProxyHelper< - DBusSerializableArguments< - std::string, std::string - >, DBusSerializableArguments< - CommonAPI::Deployable<Variant<ValueType>, VariantDeployment<>> - > + std::string, std::string + >, + DBusSerializableArguments< + CommonAPI::Deployable<Variant<ValueType>, VariantDeployment<AttributeDepl_>> + > >::callMethodWithReply( - proxy_, + proxy_, "org.freedesktop.DBus.Properties", "Get", "ss", - (_info ? _info : &defaultCallInfo), - interfaceName_, + (_info ? _info : &defaultCallInfo), + interfaceName_, propertyName_, _status, deployedValue); @@ -54,259 +55,173 @@ public: } std::future<CallStatus> getValueAsync(AttributeAsyncCallback _callback, const CommonAPI::CallInfo *_info) { - CommonAPI::Deployable<Variant<ValueType>, VariantDeployment<>> deployedValue(&freedesktopVariant); + VariantDeployment<AttributeDepl_> actualDepl(true, depl_); + CommonAPI::Deployable<Variant<ValueType>, VariantDeployment<AttributeDepl_>> deployedValue(&actualDepl); return DBusProxyHelper< - DBusSerializableArguments< - std::string, std::string - >, DBusSerializableArguments< - CommonAPI::Deployable<Variant<ValueType>, VariantDeployment<>> - > - >::callMethodAsync( - proxy_, - "org.freedesktop.DBus.Properties", - "Get", - "ss", - (_info ? _info : &defaultCallInfo), - interfaceName_, - propertyName_, - [_callback](CommonAPI::CallStatus _status, CommonAPI::Deployable<Variant<ValueType>, VariantDeployment<>> _value) { - _callback(_status, _value.getValue().template get<ValueType>()); - }, - std::make_tuple(deployedValue) - ); - } - -protected: - DBusProxy &proxy_; - std::string interfaceName_; - std::string propertyName_; - _AttributeDepl *depl_; -}; - -template <typename _AttributeType> -class DBusFreedesktopUnionReadonlyAttribute: public _AttributeType { -public: - typedef typename _AttributeType::ValueType ValueType; - typedef typename _AttributeType::AttributeAsyncCallback AttributeAsyncCallback; - - DBusFreedesktopUnionReadonlyAttribute(DBusProxy &_proxy, const std::string &_interfaceName, const std::string &_propertyName) - : proxy_(_proxy), - interfaceName_(_interfaceName), - propertyName_(_propertyName) { - } - - void getValue(CommonAPI::CallStatus &_status, ValueType &_value, const CommonAPI::CallInfo *_info) const { - CommonAPI::Deployable<ValueType, VariantDeployment<>> deployedValue(&freedesktopVariant); - DBusProxyHelper< - DBusSerializableArguments< - std::string, std::string - >, - DBusSerializableArguments< - CommonAPI::Deployable<ValueType, VariantDeployment<>> - > - >::callMethodWithReply( - proxy_, - "org.freedesktop.DBus.Properties", - "Get", - "ss", - (_info ? _info : &defaultCallInfo), - interfaceName_, - propertyName_, - _status, - deployedValue); - - _value = deployedValue.getValue().template get<ValueType>(); - } - - std::future<CommonAPI::CallStatus> getValueAsync(AttributeAsyncCallback _callback, const CommonAPI::CallInfo *_info) { - CommonAPI::Deployable<ValueType, VariantDeployment<>> deployedValue(&freedesktopVariant); - return DBusProxyHelper< - DBusSerializableArguments< - std::string, std::string - >, + std::string, std::string + >, DBusSerializableArguments< - CommonAPI::Deployable<ValueType, VariantDeployment<>> - > - >::callMethodAsync( + CommonAPI::Deployable<Variant<ValueType>, VariantDeployment<AttributeDepl_>> + > + >::callMethodAsync( proxy_, - "org.freedesktop.DBus.Properties", + "org.freedesktop.DBus.Properties", "Get", "ss", - (_info ? _info : &defaultCallInfo), + (_info ? _info : &defaultCallInfo), interfaceName_, propertyName_, - [_callback](CommonAPI::CallStatus _status, CommonAPI::Deployable<ValueType, VariantDeployment<>> _value) { - _callback(_status, _value.getValue().template get<ValueType>()); - }, - std::make_tuple(deployedValue) - ); + [_callback](CommonAPI::CallStatus _status, CommonAPI::Deployable<Variant<ValueType>, VariantDeployment<AttributeDepl_>> _value) { + _callback(_status, _value.getValue().template get<ValueType>()); + }, + std::make_tuple(deployedValue) + ); + } + AttributeDepl_ *getDepl(void) { + return depl_; } - protected: DBusProxy &proxy_; std::string interfaceName_; std::string propertyName_; + AttributeDepl_ *depl_; }; -template <typename _AttributeType, typename _AttributeDepl = EmptyDeployment> +template <typename AttributeType_, typename AttributeDepl_ = EmptyDeployment> class DBusFreedesktopAttribute - : public DBusFreedesktopReadonlyAttribute<_AttributeType, _AttributeDepl> { + : public DBusFreedesktopReadonlyAttribute<AttributeType_, AttributeDepl_> { public: - typedef typename _AttributeType::ValueType ValueType; - typedef typename _AttributeType::AttributeAsyncCallback AttributeAsyncCallback; + typedef typename AttributeType_::ValueType ValueType; + typedef typename AttributeType_::AttributeAsyncCallback AttributeAsyncCallback; - DBusFreedesktopAttribute(DBusProxy &_proxy, const std::string &_interfaceName, const std::string &_propertyName, _AttributeDepl *_depl = nullptr) - : DBusFreedesktopReadonlyAttribute<_AttributeType, _AttributeDepl>(_proxy, _interfaceName, _propertyName, _depl) { + DBusFreedesktopAttribute(DBusProxy &_proxy, const std::string &_interfaceName, const std::string &_propertyName, AttributeDepl_ *_depl = nullptr) + : DBusFreedesktopReadonlyAttribute<AttributeType_, AttributeDepl_>(_proxy, _interfaceName, _propertyName, _depl) { } void setValue(const ValueType &_request, CommonAPI::CallStatus &_status, ValueType &_response, const CommonAPI::CallInfo *_info) { - CommonAPI::Deployable<Variant<ValueType>, VariantDeployment<>> deployedVariant(_request, &freedesktopVariant); + VariantDeployment<AttributeDepl_> actualDepl(true, DBusFreedesktopReadonlyAttribute<AttributeType_, AttributeDepl_>::depl_); + Variant<ValueType> reqVariant(_request); + CommonAPI::Deployable<Variant<ValueType>, VariantDeployment<AttributeDepl_>> deployedVariant(reqVariant, &actualDepl); DBusProxyHelper< - DBusSerializableArguments< - std::string, std::string, CommonAPI::Deployable<Variant<ValueType>, VariantDeployment<>> - >, DBusSerializableArguments< - > + std::string, std::string, CommonAPI::Deployable<Variant<ValueType>, VariantDeployment<AttributeDepl_>> + >, + DBusSerializableArguments< + > >::callMethodWithReply( - DBusFreedesktopReadonlyAttribute<_AttributeType, _AttributeDepl>::proxy_, - "org.freedesktop.DBus.Properties", - "Set", - "ssv", - (_info ? _info : &defaultCallInfo), - DBusFreedesktopReadonlyAttribute<_AttributeType, _AttributeDepl>::interfaceName_, - DBusFreedesktopReadonlyAttribute<_AttributeType, _AttributeDepl>::propertyName_, - deployedVariant, - _status); + DBusFreedesktopReadonlyAttribute<AttributeType_, AttributeDepl_>::proxy_, + "org.freedesktop.DBus.Properties", + "Set", + "ssv", + (_info ? _info : &defaultCallInfo), + DBusFreedesktopReadonlyAttribute<AttributeType_, AttributeDepl_>::interfaceName_, + DBusFreedesktopReadonlyAttribute<AttributeType_, AttributeDepl_>::propertyName_, + deployedVariant, + _status); _response = _request; } std::future<CommonAPI::CallStatus> setValueAsync(const ValueType &_request, AttributeAsyncCallback _callback, const CommonAPI::CallInfo *_info) { - CommonAPI::Deployable<Variant<ValueType>, VariantDeployment<>> deployedVariant(_request, &freedesktopVariant); + VariantDeployment<AttributeDepl_> actualDepl(true, DBusFreedesktopReadonlyAttribute<AttributeType_, AttributeDepl_>::depl_); + Variant<ValueType> reqVariant(_request); + CommonAPI::Deployable<Variant<ValueType>, VariantDeployment<AttributeDepl_>> deployedVariant(reqVariant, &actualDepl); return DBusProxyHelper< - DBusSerializableArguments< - std::string, std::string, CommonAPI::Deployable<Variant<ValueType>, VariantDeployment<>> - >, DBusSerializableArguments< - > - >::callMethodAsync( - DBusFreedesktopReadonlyAttribute<_AttributeType, _AttributeDepl>::proxy_, - "org.freedesktop.DBus.Properties", - "Set", - "ssv", - (_info ? _info : &defaultCallInfo), - DBusFreedesktopReadonlyAttribute<_AttributeType, _AttributeDepl>::interfaceName_, - DBusFreedesktopReadonlyAttribute<_AttributeType, _AttributeDepl>::propertyName_, - deployedVariant, - [_callback, deployedVariant](CommonAPI::CallStatus _status) { - _callback(_status, deployedVariant.getValue().template get<ValueType>()); - }, - std::tuple<>()); - } -}; - -template <typename _AttributeType> -class DBusFreedesktopUnionAttribute - : public DBusFreedesktopReadonlyAttribute<_AttributeType> { - public: - typedef typename _AttributeType::ValueType ValueType; - typedef typename _AttributeType::AttributeAsyncCallback AttributeAsyncCallback; - - DBusFreedesktopUnionAttribute(DBusProxy &_proxy, const std::string &_interfaceName, const std::string &_propertyName) - : DBusFreedesktopUnionReadonlyAttribute<_AttributeType>(_proxy, _interfaceName, _propertyName) { - } - - void setValue(const ValueType &_request, CommonAPI::CallStatus &_status, ValueType &_response, const CommonAPI::CallInfo *_info) { - CommonAPI::Deployable<ValueType, VariantDeployment<>> deployedVariant(_request, &freedesktopVariant); - DBusProxyHelper< - DBusSerializableArguments< - std::string, std::string, CommonAPI::Deployable<ValueType, VariantDeployment<>> - >, - DBusSerializableArguments< - > - >::callMethodWithReply( - DBusFreedesktopReadonlyAttribute<_AttributeType>::proxy_, - "org.freedesktop.DBus.Properties", - "Set", - "ssv", - (_info ? _info : &defaultCallInfo), - DBusFreedesktopReadonlyAttribute<_AttributeType>::interfaceName_, - DBusFreedesktopReadonlyAttribute<_AttributeType>::propertyName_, - deployedVariant, - _status); - _response = _request; - } - - std::future<CallStatus> setValueAsync(const ValueType &_request, AttributeAsyncCallback _callback, const CommonAPI::CallInfo *_info) { - CommonAPI::Deployable<ValueType, VariantDeployment<>> deployedVariant(_request, &freedesktopVariant); - return DBusProxyHelper< - DBusSerializableArguments< - std::string, std::string, CommonAPI::Deployable<ValueType, VariantDeployment<>> - >, + std::string, std::string, CommonAPI::Deployable<Variant<ValueType>, VariantDeployment<AttributeDepl_>> + >, DBusSerializableArguments< - > - >::callMethodAsync( - DBusFreedesktopReadonlyAttribute<_AttributeType>::proxy_, - "org.freedesktop.DBus.Properties", - "Set", - "ssv", - (_info ? _info : &defaultCallInfo), - DBusFreedesktopReadonlyAttribute<_AttributeType>::interfaceName_, - DBusFreedesktopReadonlyAttribute<_AttributeType>::propertyName_, - deployedVariant, - [_callback](CommonAPI::CallStatus _status, CommonAPI::Deployable<ValueType, VariantDeployment<>> _value) { - _callback(_status, _value.getValue().template get<ValueType>()); - }, - std::make_tuple(deployedVariant)); + > + >::callMethodAsync( + DBusFreedesktopReadonlyAttribute<AttributeType_, AttributeDepl_>::proxy_, + "org.freedesktop.DBus.Properties", + "Set", + "ssv", + (_info ? _info : &defaultCallInfo), + DBusFreedesktopReadonlyAttribute<AttributeType_, AttributeDepl_>::interfaceName_, + DBusFreedesktopReadonlyAttribute<AttributeType_, AttributeDepl_>::propertyName_, + deployedVariant, + [_callback, deployedVariant](CommonAPI::CallStatus _status) { + _callback(_status, deployedVariant.getValue().template get<ValueType>()); + }, + std::tuple<>()); } }; -template<class, class> +template<class, class, class> class LegacyEvent; - -template <template <class...> class _Type, class _Types, class _Variant> -class LegacyEvent<_Type<_Types>, _Variant>: public _Type<_Types> { +template <template <class...> class Type_, class Types_, class DataType_, class DataDeplType_> +class LegacyEvent<Type_<Types_>, DataType_, DataDeplType_>: public Type_<Types_>, + public DBusProxyConnection::DBusSignalHandler { public: - typedef _Types ValueType; - typedef typename _Type<ValueType>::Listener Listener; - typedef std::unordered_map<std::string, _Variant> PropertyMap; - typedef MapDeployment<EmptyDeployment, VariantDeployment<>> PropertyMapDeployment; + typedef Types_ ValueType; + typedef typename Type_<ValueType>::Listener Listener; + typedef std::unordered_map<std::string, Variant<DataType_>> PropertyMap; + typedef MapDeployment<EmptyDeployment, VariantDeployment<DataDeplType_>> PropertyMapDeployment; typedef Deployable<PropertyMap, PropertyMapDeployment> DeployedPropertyMap; typedef std::vector<std::string> InvalidArray; typedef Event<std::string, DeployedPropertyMap, InvalidArray> SignalEvent; + typedef typename Type_<ValueType>::Subscription Subscription; - LegacyEvent(DBusProxy &_proxy, const std::string &_interfaceName, const std::string &_propertyName) - : interfaceName_(_interfaceName), - propertyName_(_propertyName), - isSubcriptionSet_(false), - internalEvent_(_proxy, - "PropertiesChanged", - "sa{sv}as", - _proxy.getDBusAddress().getObjectPath(), - "org.freedesktop.DBus.Properties", - std::make_tuple("", getDeployedMap(), InvalidArray())) { + LegacyEvent(DBusProxy &_proxy, const std::string &_interfaceName, const std::string &_propertyName, DataDeplType_ *_depl) + : interfaceName_(_interfaceName), + propertyName_(_propertyName), + variantDepl_(true, _depl), + mapDepl_(nullptr, &variantDepl_), + deployedMap_(&mapDepl_), + proxy_(_proxy), + isSubcriptionSet_(false), + internalEvent_(_proxy, + "PropertiesChanged", + "sa{sv}as", + _proxy.getDBusAddress().getObjectPath(), + "org.freedesktop.DBus.Properties", + std::make_tuple("", deployedMap_, InvalidArray())) { } protected: void onFirstListenerAdded(const Listener &) { - if (!isSubcriptionSet_) { - subscription_ = internalEvent_.subscribe( - [this](const std::string &_interfaceName, - const PropertyMap &_properties, - const InvalidArray &_invalid) { - if (interfaceName_ == _interfaceName) { - auto iter = _properties.find(propertyName_); - if (iter != _properties.end()) { - const ValueType &value = iter->second.template get<ValueType>(); - this->notifyListeners(value); - } - } - }); + if (!isSubcriptionSet_) { + subscription_ = internalEvent_.subscribe( + [this](const std::string &_interfaceName, + const PropertyMap &_properties, + const InvalidArray &_invalid) { + (void)_invalid; + if (interfaceName_ == _interfaceName) { + auto iter = _properties.find(propertyName_); + if (iter != _properties.end()) { + const ValueType &value = iter->second.template get<ValueType>(); + this->notifyListeners(value); + } + } + }); + + isSubcriptionSet_ = true; + } + } - isSubcriptionSet_ = true; - } + virtual void onListenerAdded(const Listener& listener, const Subscription subscription) { + (void)listener; + proxy_.freeDesktopGetCurrentValueForSignalListener(this, subscription, interfaceName_, propertyName_); } + virtual void onInitialValueSignalDBusMessage(const DBusMessage&_message, const uint32_t tag) { + CommonAPI::Deployable<Variant<DataType_>, VariantDeployment<DataDeplType_>> deployedValue(&variantDepl_); + DBusInputStream input(_message); + if (DBusSerializableArguments< + CommonAPI::Deployable< + Variant<DataType_>, + VariantDeployment<DataDeplType_> + > + >::deserialize(input, deployedValue)) { + Variant<DataType_> v = deployedValue.getValue(); + const DataType_ &value = v.template get<DataType_>(); + this->notifySpecificListener(tag, value); + } + } + virtual void onSignalDBusMessage(const DBusMessage&) { + // ignore + } void onLastListenerRemoved(const Listener &) { if (isSubcriptionSet_) { internalEvent_.unsubscribe(subscription_); @@ -316,36 +231,33 @@ protected: std::string interfaceName_; std::string propertyName_; + VariantDeployment<DataDeplType_> variantDepl_; + PropertyMapDeployment mapDepl_; + DeployedPropertyMap deployedMap_; + DBusProxy &proxy_; typename DBusEvent<SignalEvent, std::string, DeployedPropertyMap, InvalidArray>::Subscription subscription_; bool isSubcriptionSet_; DBusEvent<SignalEvent, std::string, DeployedPropertyMap, InvalidArray> internalEvent_; - -private: - static DeployedPropertyMap &getDeployedMap() { - static PropertyMapDeployment itsDeployment(nullptr, &freedesktopVariant); - static DeployedPropertyMap itsDeployedMap(&itsDeployment); - return itsDeployedMap; - } }; -template <typename _AttributeType, typename _Variant> -class DBusFreedesktopObservableAttribute: public _AttributeType { +template <typename AttributeType_> +class DBusFreedesktopObservableAttribute: public AttributeType_ { public: - typedef typename _AttributeType::ValueType ValueType; - typedef typename _AttributeType::AttributeAsyncCallback AttributeAsyncCallback; - typedef typename _AttributeType::ChangedEvent ChangedEvent; - - template <typename... _AttributeTypeArguments> + typedef typename AttributeType_::ValueType ValueType; + typedef typename AttributeType_::AttributeAsyncCallback AttributeAsyncCallback; + typedef typename AttributeType_::ChangedEvent ChangedEvent; + typedef typename AttributeType_::ValueTypeDepl ValueTypeDepl; + template <typename... AttributeType_Arguments> DBusFreedesktopObservableAttribute(DBusProxy &_proxy, - const std::string &_interfaceName, - const std::string &_propertyName, - _AttributeTypeArguments... _arguments) - : _AttributeType(_proxy, _interfaceName, _propertyName, _arguments...), - interfaceName_(_interfaceName), - propertyName_(_propertyName), - externalChangedEvent_(_proxy, _interfaceName, _propertyName) { + const std::string &_interfaceName, + const std::string &_propertyName, + AttributeType_Arguments... _arguments) + : AttributeType_(_proxy, _interfaceName, _propertyName, _arguments...), + interfaceName_(_interfaceName), + propertyName_(_propertyName), + externalChangedEvent_(_proxy, _interfaceName, _propertyName, AttributeType_::getDepl()) { } ChangedEvent &getChangedEvent() { @@ -355,98 +267,7 @@ class DBusFreedesktopObservableAttribute: public _AttributeType { protected: std::string interfaceName_; std::string propertyName_; - LegacyEvent<ChangedEvent, _Variant> externalChangedEvent_; -}; - -template<class, class> -class LegacyUnionEvent; - -template <template <class...> class _Type, class _Types, class _Variant> -class LegacyUnionEvent<_Type<_Types>, _Variant>: public _Type<_Types> { -public: - typedef _Types ValueType; - typedef typename _Type<ValueType>::Listener Listener; - typedef std::unordered_map<std::string, _Variant> PropertyMap; - typedef MapDeployment<EmptyDeployment, VariantDeployment<>> PropertyMapDeployment; - typedef CommonAPI::Deployable<PropertyMap, PropertyMapDeployment> DeployedPropertyMap; - typedef std::vector<std::string> InvalidArray; - typedef Event<std::string, DeployedPropertyMap, InvalidArray> SignalEvent; - - LegacyUnionEvent(DBusProxy &_proxy, const std::string &_interfaceName, const std::string &_propertyName) - : interfaceName_(_interfaceName), - propertyName_(_propertyName), - isSubcriptionSet_(false), - internalEvent_(_proxy, - "PropertiesChanged", - "sa{sv}as", - _proxy.getDBusAddress().getObjectPath(), - "org.freedesktop.DBus.Properties", - std::make_tuple("", getDeployedMap(), InvalidArray())) { - } - -protected: - void onFirstListenerAdded(const Listener &) { - if (isSubcriptionSet_) { - subscription_ = internalEvent_.subscribe( - [this](const std::string &_interfaceName, - const PropertyMap &_properties, - const std::vector<std::string> &_invalid) { - if (interfaceName_ == _interfaceName) { - auto iter = _properties.find(propertyName_); - if (iter != _properties.end()) { - this->notifyListeners(iter->second.template get<ValueType>()); - } - } - }); - isSubcriptionSet_ = true; - } - } - - void onLastListenerRemoved(const Listener &) { - if (isSubcriptionSet_) { - internalEvent_.unsubscribe(subscription_); - isSubcriptionSet_ = false; - } - } - - DBusEvent<SignalEvent, ValueType> internalEvent_; - std::string interfaceName_; - std::string propertyName_; - - typename DBusEvent<SignalEvent>::Subscription subscription_; - bool isSubcriptionSet_; - -private: - static DeployedPropertyMap &getDeployedMap() { - static PropertyMapDeployment itsDeployment(nullptr, &freedesktopVariant); - static DeployedPropertyMap itsDeployedMap(&itsDeployment); - return itsDeployedMap; - } -}; - -template <typename _AttributeType, typename _Variant> -class DBusFreedesktopUnionObservableAttribute: public _AttributeType { - public: - typedef typename _AttributeType::ValueType ValueType; - typedef typename _AttributeType::AttributeAsyncCallback AttributeAsyncCallback; - typedef typename _AttributeType::ChangedEvent ChangedEvent; - - template <typename... _AttributeTypeArguments> - DBusFreedesktopUnionObservableAttribute(DBusProxy &_proxy, - const std::string &_interfaceName, - const std::string &_propertyName, - _AttributeTypeArguments... _arguments) - : _AttributeType(_proxy, _interfaceName, _propertyName, _arguments...), - externalChangedEvent_(_proxy, _interfaceName, _propertyName) { - } - - ChangedEvent &getChangedEvent() { - return externalChangedEvent_; - } - - protected: - LegacyUnionEvent<ChangedEvent, _Variant> externalChangedEvent_; -}; + LegacyEvent<ChangedEvent, ValueType, ValueTypeDepl> externalChangedEvent_;}; } // namespace DBus } // namespace CommonAPI |