summaryrefslogtreecommitdiffstats
path: root/src/propertywatchimpl.hpp
diff options
context:
space:
mode:
authorBrad Bishop <bradleyb@fuzziesquirrel.com>2017-06-06 23:58:09 -0400
committerBrad Bishop <bradleyb@fuzziesquirrel.com>2017-06-19 16:28:06 -0400
commitce4fbe111da9375e9614e018547e90092df6ec4b (patch)
treedd81218e07476a9affd8adcf64bc66167b637f87 /src/propertywatchimpl.hpp
parent18b228ee24bc6446292785cd1821d417a7c6a0c8 (diff)
downloadphosphor-dbus-monitor-ce4fbe111da9375e9614e018547e90092df6ec4b.tar.gz
phosphor-dbus-monitor-ce4fbe111da9375e9614e018547e90092df6ec4b.zip
expose watch callbacks
Allow watch class users to explicitly invoke the watch callback. Since watches and callbacks share a common pool of state all watches must complete their initialization prior to invoking their callback methods. Change-Id: I62ebad64da88a145f3d5006b07c01381b0eb6728 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Diffstat (limited to 'src/propertywatchimpl.hpp')
-rw-r--r--src/propertywatchimpl.hpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/propertywatchimpl.hpp b/src/propertywatchimpl.hpp
index d0153e4..67bbaff 100644
--- a/src/propertywatchimpl.hpp
+++ b/src/propertywatchimpl.hpp
@@ -108,6 +108,16 @@ void PropertyWatch<DBusInterfaceType>::start()
alreadyRan = true;
}
+template <typename DBusInterfaceType>
+void PropertyWatch<DBusInterfaceType>::callback()
+{
+ // Invoke callback if present.
+ if (this->alreadyRan && this->cb)
+ {
+ (*this->cb)();
+ }
+}
+
template <typename T, typename DBusInterfaceType>
void PropertyWatchOfType<T, DBusInterfaceType>::updateProperties(
const std::string& busName,
@@ -144,10 +154,7 @@ void PropertyWatchOfType<T, DBusInterfaceType>::propertiesChanged(
std::get<2>(item->second).get() = p.second.template get<T>();
// Invoke callback if present.
- if (this->alreadyRan && this->callback)
- {
- (*this->callback)();
- }
+ this->callback();
}
}
OpenPOWER on IntegriCloud