diff options
author | Kevron Rees <tripzero.kev@gmail.com> | 2012-08-28 18:47:51 -0700 |
---|---|---|
committer | Kevron Rees <tripzero.kev@gmail.com> | 2012-08-28 18:47:51 -0700 |
commit | a07e2af52039b47406ce8838313d988545cb3960 (patch) | |
tree | 8a270c0d4296e45a2f65fc4f399aa4e93ca5829c | |
parent | e380ae73671a5aca236337d20604f0970f8fd34b (diff) | |
download | automotive-message-broker-a07e2af52039b47406ce8838313d988545cb3960.tar.gz |
fixed dbus plugin not to use the temp pointer
-rw-r--r-- | lib/abstractpropertytype.h | 5 | ||||
-rw-r--r-- | plugins/dbus/abstractproperty.h | 6 | ||||
-rw-r--r-- | plugins/dbus/dbusplugin.cpp | 2 |
3 files changed, 9 insertions, 4 deletions
diff --git a/lib/abstractpropertytype.h b/lib/abstractpropertytype.h index b4e81183..f56cb6bf 100644 --- a/lib/abstractpropertytype.h +++ b/lib/abstractpropertytype.h @@ -41,6 +41,11 @@ public: return boost::any_cast<T>(mValue); } + boost::any anyValue() + { + return mValue; + } + protected: boost::any mValue; diff --git a/plugins/dbus/abstractproperty.h b/plugins/dbus/abstractproperty.h index 65834b0a..f2254d3f 100644 --- a/plugins/dbus/abstractproperty.h +++ b/plugins/dbus/abstractproperty.h @@ -69,7 +69,7 @@ public: virtual GVariant* toGVariant() = 0; virtual void fromGVariant(GVariant *value) = 0; - void setValue(AbstractPropertyType* val) + void setValue(boost::any val) { mValue = val; updateValue(); @@ -85,7 +85,7 @@ public: template<typename T> T value() { - return mValue->value<T>(); + return boost::any_cast<T>(mValue); } protected: ///methods: @@ -94,7 +94,7 @@ protected: ///methods: protected: - AbstractPropertyType * mValue; + boost::any mValue; string mPropertyName; string mSignature; SetterFunc mSetterFunc; diff --git a/plugins/dbus/dbusplugin.cpp b/plugins/dbus/dbusplugin.cpp index 36253402..b33ee56a 100644 --- a/plugins/dbus/dbusplugin.cpp +++ b/plugins/dbus/dbusplugin.cpp @@ -58,7 +58,7 @@ void DBusSink::propertyChanged(VehicleProperty::Property property, AbstractPrope return; AbstractProperty* prop = propertyDBusMap[property]; - prop->setValue(value); + prop->setValue(value->anyValue()); } std::string DBusSink::uuid() |