summaryrefslogtreecommitdiffstats
path: root/src/propertywatch.hpp
diff options
context:
space:
mode:
authorBrad Bishop <bradleyb@fuzziesquirrel.com>2018-03-29 10:34:05 -0400
committerBrad Bishop <bradleyb@fuzziesquirrel.com>2018-03-29 10:34:46 -0400
commitd1eac88d18ae7dd11033dba87b6aebb220da9064 (patch)
tree9744e38138ff853c53868d847f86e9ad58e9ac66 /src/propertywatch.hpp
parent1abcb06bedadfbd40b4ec6f7e5f6a95021df3c96 (diff)
downloadphosphor-dbus-monitor-d1eac88d18ae7dd11033dba87b6aebb220da9064.tar.gz
phosphor-dbus-monitor-d1eac88d18ae7dd11033dba87b6aebb220da9064.zip
Enable clang-format
Fix up errors and enable clang-format during CI builds. Change-Id: I4176b81f8b85a287af9354165e09ff66aeb9fb29 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
Diffstat (limited to 'src/propertywatch.hpp')
-rw-r--r--src/propertywatch.hpp270
1 files changed, 132 insertions, 138 deletions
diff --git a/src/propertywatch.hpp b/src/propertywatch.hpp
index cd286a5..2cbf6f5 100644
--- a/src/propertywatch.hpp
+++ b/src/propertywatch.hpp
@@ -25,80 +25,78 @@ class Callback;
* A property watch maintains the state of one or more DBus properties
* as specified by the supplied index.
*/
-template <typename DBusInterfaceType>
-class PropertyWatch : public Watch
+template <typename DBusInterfaceType> class PropertyWatch : public Watch
{
- public:
- PropertyWatch() = delete;
- PropertyWatch(const PropertyWatch&) = delete;
- PropertyWatch(PropertyWatch&&) = default;
- PropertyWatch& operator=(const PropertyWatch&) = delete;
- PropertyWatch& operator=(PropertyWatch&&) = default;
- virtual ~PropertyWatch() = default;
- PropertyWatch(
- const PropertyIndex& watchIndex,
- Callback* callback = nullptr)
- : Watch(), index(watchIndex), cb(callback), alreadyRan(false) {}
-
- /** @brief Start the watch.
- *
- * Watch start interface implementation for PropertyWatch.
- */
- void start() override;
-
- /** @brief Run the watch callback method.
- *
- * Watch callback interface implementation for PropertyWatch.
- */
- void callback(Context ctx) override;
-
- /** @brief Update properties.
- *
- * Subclasses to query the properties specified by the index
- * and update the cache.
- *
- * @param[in] busName - The busname hosting the interface to query.
- * @param[in] path - The path of the interface to query.
- * @param[in] interface - The interface to query.
- */
- virtual void updateProperties(
- const std::string& busName,
- const std::string& path,
- const std::string& interface) = 0;
-
- /** @brief Dbus signal callback for PropertiesChanged.
- *
- * Subclasses to update the cache.
- *
- * @param[in] message - The org.freedesktop.DBus.PropertiesChanged
- * message.
- * @param[in] path - The path associated with the message.
- * @param[in] interface - The interface associated with the message.
- */
- virtual void propertiesChanged(
- sdbusplus::message::message&,
- const std::string& path,
- const std::string& interface) = 0;
-
- /** @brief Dbus signal callback for InterfacesAdded.
- *
- * Subclasses to update the cache.
- *
- * @param[in] msg - The org.freedesktop.DBus.PropertiesChanged
- * message.
- */
- virtual void interfacesAdded(sdbusplus::message::message& msg) = 0;
-
- protected:
-
- /** @brief Property names and their associated storage. */
- const PropertyIndex& index;
-
- /** @brief Optional callback method. */
- Callback* const cb;
-
- /** @brief The start method should only be invoked once. */
- bool alreadyRan;
+ public:
+ PropertyWatch() = delete;
+ PropertyWatch(const PropertyWatch&) = delete;
+ PropertyWatch(PropertyWatch&&) = default;
+ PropertyWatch& operator=(const PropertyWatch&) = delete;
+ PropertyWatch& operator=(PropertyWatch&&) = default;
+ virtual ~PropertyWatch() = default;
+ PropertyWatch(const PropertyIndex& watchIndex,
+ Callback* callback = nullptr) :
+ Watch(),
+ index(watchIndex), cb(callback), alreadyRan(false)
+ {
+ }
+
+ /** @brief Start the watch.
+ *
+ * Watch start interface implementation for PropertyWatch.
+ */
+ void start() override;
+
+ /** @brief Run the watch callback method.
+ *
+ * Watch callback interface implementation for PropertyWatch.
+ */
+ void callback(Context ctx) override;
+
+ /** @brief Update properties.
+ *
+ * Subclasses to query the properties specified by the index
+ * and update the cache.
+ *
+ * @param[in] busName - The busname hosting the interface to query.
+ * @param[in] path - The path of the interface to query.
+ * @param[in] interface - The interface to query.
+ */
+ virtual void updateProperties(const std::string& busName,
+ const std::string& path,
+ const std::string& interface) = 0;
+
+ /** @brief Dbus signal callback for PropertiesChanged.
+ *
+ * Subclasses to update the cache.
+ *
+ * @param[in] message - The org.freedesktop.DBus.PropertiesChanged
+ * message.
+ * @param[in] path - The path associated with the message.
+ * @param[in] interface - The interface associated with the message.
+ */
+ virtual void propertiesChanged(sdbusplus::message::message&,
+ const std::string& path,
+ const std::string& interface) = 0;
+
+ /** @brief Dbus signal callback for InterfacesAdded.
+ *
+ * Subclasses to update the cache.
+ *
+ * @param[in] msg - The org.freedesktop.DBus.PropertiesChanged
+ * message.
+ */
+ virtual void interfacesAdded(sdbusplus::message::message& msg) = 0;
+
+ protected:
+ /** @brief Property names and their associated storage. */
+ const PropertyIndex& index;
+
+ /** @brief Optional callback method. */
+ Callback* const cb;
+
+ /** @brief The start method should only be invoked once. */
+ bool alreadyRan;
};
/** @class PropertyWatchOfType
@@ -110,71 +108,67 @@ class PropertyWatch : public Watch
template <typename T, typename DBusInterfaceType>
class PropertyWatchOfType : public PropertyWatch<DBusInterfaceType>
{
- public:
- PropertyWatchOfType() = default;
- PropertyWatchOfType(const PropertyWatchOfType&) = delete;
- PropertyWatchOfType(PropertyWatchOfType&&) = default;
- PropertyWatchOfType& operator=(const PropertyWatchOfType&) = delete;
- PropertyWatchOfType& operator=(PropertyWatchOfType&&) = default;
- ~PropertyWatchOfType() = default;
- PropertyWatchOfType(
- const PropertyIndex& watchIndex, Callback& callback) :
- PropertyWatch<DBusInterfaceType>(watchIndex, &callback) {}
- PropertyWatchOfType(
- const PropertyIndex& watchIndex) :
- PropertyWatch<DBusInterfaceType>(watchIndex, nullptr) {}
-
-
- /** @brief PropertyMatch implementation for PropertyWatchOfType.
- *
- * @param[in] busName - The busname hosting the interface to query.
- * @param[in] path - The path of the interface to query.
- * @param[in] interface - The interface to query.
- */
- void updateProperties(
- const std::string& busName,
- const std::string& path,
- const std::string& interface) override;
-
- /** @brief PropertyMatch implementation for PropertyWatchOfType.
- *
- * @param[in] msg - The org.freedesktop.DBus.PropertiesChanged
- * message.
- * @param[in] path - The path associated with the message.
- * @param[in] interface - The interface associated with the message.
- */
- void propertiesChanged(
- sdbusplus::message::message& msg,
- const std::string& path,
- const std::string& interface) override;
-
- /** @brief DBus agnostic implementation of interfacesAdded.
- *
- * @param[in] path - The path of the properties that changed.
- * @param[in] interface - The interface of the properties that
- * changed.
- * @param[in] properites - The properties that changed.
- */
- void propertiesChanged(
- const std::string& path,
- const std::string& interface,
- const PropertiesChanged<T>& properties);
-
- /** @brief PropertyMatch implementation for PropertyWatchOfType.
- *
- * @param[in] msg - The org.freedesktop.DBus.PropertiesChanged
- * message.
- */
- void interfacesAdded(sdbusplus::message::message& msg) override;
-
- /** @brief DBus agnostic implementation of interfacesAdded.
- *
- * @param[in] path - The path of the added interfaces.
- * @param[in] interfaces - The added interfaces.
- */
- void interfacesAdded(
- const std::string& path,
- const InterfacesAdded<T>& interfaces);
+ public:
+ PropertyWatchOfType() = default;
+ PropertyWatchOfType(const PropertyWatchOfType&) = delete;
+ PropertyWatchOfType(PropertyWatchOfType&&) = default;
+ PropertyWatchOfType& operator=(const PropertyWatchOfType&) = delete;
+ PropertyWatchOfType& operator=(PropertyWatchOfType&&) = default;
+ ~PropertyWatchOfType() = default;
+ PropertyWatchOfType(const PropertyIndex& watchIndex, Callback& callback) :
+ PropertyWatch<DBusInterfaceType>(watchIndex, &callback)
+ {
+ }
+ PropertyWatchOfType(const PropertyIndex& watchIndex) :
+ PropertyWatch<DBusInterfaceType>(watchIndex, nullptr)
+ {
+ }
+
+ /** @brief PropertyMatch implementation for PropertyWatchOfType.
+ *
+ * @param[in] busName - The busname hosting the interface to query.
+ * @param[in] path - The path of the interface to query.
+ * @param[in] interface - The interface to query.
+ */
+ void updateProperties(const std::string& busName, const std::string& path,
+ const std::string& interface) override;
+
+ /** @brief PropertyMatch implementation for PropertyWatchOfType.
+ *
+ * @param[in] msg - The org.freedesktop.DBus.PropertiesChanged
+ * message.
+ * @param[in] path - The path associated with the message.
+ * @param[in] interface - The interface associated with the message.
+ */
+ void propertiesChanged(sdbusplus::message::message& msg,
+ const std::string& path,
+ const std::string& interface) override;
+
+ /** @brief DBus agnostic implementation of interfacesAdded.
+ *
+ * @param[in] path - The path of the properties that changed.
+ * @param[in] interface - The interface of the properties that
+ * changed.
+ * @param[in] properites - The properties that changed.
+ */
+ void propertiesChanged(const std::string& path,
+ const std::string& interface,
+ const PropertiesChanged<T>& properties);
+
+ /** @brief PropertyMatch implementation for PropertyWatchOfType.
+ *
+ * @param[in] msg - The org.freedesktop.DBus.PropertiesChanged
+ * message.
+ */
+ void interfacesAdded(sdbusplus::message::message& msg) override;
+
+ /** @brief DBus agnostic implementation of interfacesAdded.
+ *
+ * @param[in] path - The path of the added interfaces.
+ * @param[in] interfaces - The added interfaces.
+ */
+ void interfacesAdded(const std::string& path,
+ const InterfacesAdded<T>& interfaces);
};
} // namespace monitoring
OpenPOWER on IntegriCloud