summaryrefslogtreecommitdiffstats
path: root/src/method.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/method.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/method.hpp')
-rw-r--r--src/method.hpp137
1 files changed, 57 insertions, 80 deletions
diff --git a/src/method.hpp b/src/method.hpp
index 9475fb8..7c29205 100644
--- a/src/method.hpp
+++ b/src/method.hpp
@@ -19,22 +19,14 @@ namespace detail
* @tparam DBusInterface - The DBus interface to use.
* @tparam MethodArgs - DBus method argument types.
*/
-template <typename DBusInterface, typename ...MethodArgs>
-struct CallDBusMethod
+template <typename DBusInterface, typename... MethodArgs> struct CallDBusMethod
{
- static void op(
- const std::string& bus,
- const std::string& path,
- const std::string& iface,
- const std::string& method,
- MethodArgs&& ...args)
+ static void op(const std::string& bus, const std::string& path,
+ const std::string& iface, const std::string& method,
+ MethodArgs&&... args)
{
- DBusInterface::callMethodNoReply(
- bus,
- path,
- iface,
- method,
- std::forward<MethodArgs>(args)...);
+ DBusInterface::callMethodNoReply(bus, path, iface, method,
+ std::forward<MethodArgs>(args)...);
}
};
} // namespace detail
@@ -46,32 +38,28 @@ struct CallDBusMethod
*/
class MethodBase : public Callback
{
- public:
- MethodBase() = delete;
- MethodBase(const MethodBase&) = delete;
- MethodBase(MethodBase&&) = default;
- MethodBase& operator=(const MethodBase&) = delete;
- MethodBase& operator=(MethodBase&&) = default;
- virtual ~MethodBase() = default;
- MethodBase(
- const std::string& b,
- const std::string& p,
- const std::string& i,
- const std::string& m)
- : Callback(),
- bus(b),
- path(p),
- interface(i),
- method(m) {}
+ public:
+ MethodBase() = delete;
+ MethodBase(const MethodBase&) = delete;
+ MethodBase(MethodBase&&) = default;
+ MethodBase& operator=(const MethodBase&) = delete;
+ MethodBase& operator=(MethodBase&&) = default;
+ virtual ~MethodBase() = default;
+ MethodBase(const std::string& b, const std::string& p, const std::string& i,
+ const std::string& m) :
+ Callback(),
+ bus(b), path(p), interface(i), method(m)
+ {
+ }
- /** @brief Callback interface implementation. */
- void operator()(Context ctx) override = 0;
+ /** @brief Callback interface implementation. */
+ void operator()(Context ctx) override = 0;
- protected:
- const std::string& bus;
- const std::string& path;
- const std::string& interface;
- const std::string& method;
+ protected:
+ const std::string& bus;
+ const std::string& path;
+ const std::string& interface;
+ const std::string& method;
};
/** @class Method
@@ -80,57 +68,46 @@ class MethodBase : public Callback
* @tparam DBusInterface - The DBus interface to use to call the method.
* @tparam MethodArgs - DBus method argument types.
*/
-template <typename DBusInterface, typename ...MethodArgs>
+template <typename DBusInterface, typename... MethodArgs>
class Method : public MethodBase
{
- public:
- Method() = delete;
- Method(const Method&) = default;
- Method(Method&&) = default;
- Method& operator=(const Method&) = default;
- Method& operator=(Method&&) = default;
- ~Method() = default;
- Method(
- const std::string& bus,
- const std::string& path,
- const std::string& iface,
- const std::string& method,
- MethodArgs&& ... arguments)
- : MethodBase(bus, path, iface, method),
- args(std::forward<MethodArgs>(arguments)...) {}
+ public:
+ Method() = delete;
+ Method(const Method&) = default;
+ Method(Method&&) = default;
+ Method& operator=(const Method&) = default;
+ Method& operator=(Method&&) = default;
+ ~Method() = default;
+ Method(const std::string& bus, const std::string& path,
+ const std::string& iface, const std::string& method,
+ MethodArgs&&... arguments) :
+ MethodBase(bus, path, iface, method),
+ args(std::forward<MethodArgs>(arguments)...)
+ {
+ }
- /** @brief Callback interface implementation. */
- void operator()(Context ctx) override
- {
- std::experimental::apply(
- detail::CallDBusMethod<DBusInterface, MethodArgs...>::op,
- std::tuple_cat(
- std::make_tuple(bus),
- std::make_tuple(path),
- std::make_tuple(interface),
- std::make_tuple(method),
- args));
- }
+ /** @brief Callback interface implementation. */
+ void operator()(Context ctx) override
+ {
+ std::experimental::apply(
+ detail::CallDBusMethod<DBusInterface, MethodArgs...>::op,
+ std::tuple_cat(std::make_tuple(bus), std::make_tuple(path),
+ std::make_tuple(interface), std::make_tuple(method),
+ args));
+ }
- private:
- std::tuple<MethodArgs...> args;
+ private:
+ std::tuple<MethodArgs...> args;
};
/** @brief Argument type deduction for constructing Method instances. */
-template <typename DBusInterface, typename ...MethodArgs>
-auto makeMethod(
- const std::string& bus,
- const std::string& path,
- const std::string& iface,
- const std::string& method,
- MethodArgs&& ... arguments)
+template <typename DBusInterface, typename... MethodArgs>
+auto makeMethod(const std::string& bus, const std::string& path,
+ const std::string& iface, const std::string& method,
+ MethodArgs&&... arguments)
{
return std::make_unique<Method<DBusInterface, MethodArgs...>>(
- bus,
- path,
- iface,
- method,
- std::forward<MethodArgs>(arguments)...);
+ bus, path, iface, method, std::forward<MethodArgs>(arguments)...);
}
} // namespace monitoring
OpenPOWER on IntegriCloud