add .clang-format

Change-Id: I6627b5569c2e0f730be7331403218b823a2c622f
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/dbus/dbusactiveread.cpp b/dbus/dbusactiveread.cpp
index e41ba7a..37a1f93 100644
--- a/dbus/dbusactiveread.cpp
+++ b/dbus/dbusactiveread.cpp
@@ -14,14 +14,14 @@
  * limitations under the License.
  */
 
+#include "dbusactiveread.hpp"
+
+#include "dbus/util.hpp"
+
 #include <chrono>
 #include <cmath>
 #include <iostream>
 
-#include "dbusactiveread.hpp"
-#include "dbus/util.hpp"
-
-
 ReadReturn DbusActiveRead::read(void)
 {
     struct SensorProperties settings;
@@ -35,11 +35,7 @@
      * Technically it might not be a value from now, but there's no timestamp
      * on Sensor.Value yet.
      */
-    struct ReadReturn r = {
-        value,
-        std::chrono::high_resolution_clock::now()
-    };
+    struct ReadReturn r = {value, std::chrono::high_resolution_clock::now()};
 
     return r;
 }
-
diff --git a/dbus/dbusactiveread.hpp b/dbus/dbusactiveread.hpp
index 85380fb..b703006 100644
--- a/dbus/dbusactiveread.hpp
+++ b/dbus/dbusactiveread.hpp
@@ -1,35 +1,31 @@
 #pragma once
 
+#include "dbus/util.hpp"
+#include "interfaces.hpp"
+
 #include <memory>
 #include <sdbusplus/bus.hpp>
 #include <string>
 
-#include "dbus/util.hpp"
-#include "interfaces.hpp"
-
 /*
  * This ReadInterface will actively reach out over dbus upon calling read to
  * get the value from whomever owns the associated dbus path.
  */
-class DbusActiveRead: public ReadInterface
+class DbusActiveRead : public ReadInterface
 {
-    public:
-        DbusActiveRead(sdbusplus::bus::bus& bus,
-                       const std::string& path,
-                       const std::string& service,
-                       DbusHelperInterface *helper)
-            : ReadInterface(),
-              _bus(bus),
-              _path(path),
-              _service(service),
-              _helper(helper)
-        { }
+  public:
+    DbusActiveRead(sdbusplus::bus::bus& bus, const std::string& path,
+                   const std::string& service, DbusHelperInterface* helper) :
+        ReadInterface(),
+        _bus(bus), _path(path), _service(service), _helper(helper)
+    {
+    }
 
-        ReadReturn read(void) override;
+    ReadReturn read(void) override;
 
-    private:
-        sdbusplus::bus::bus& _bus;
-        const std::string _path;
-        const std::string _service; // the sensor service.
-        DbusHelperInterface *_helper;
+  private:
+    sdbusplus::bus::bus& _bus;
+    const std::string _path;
+    const std::string _service; // the sensor service.
+    DbusHelperInterface* _helper;
 };
diff --git a/dbus/dbuspassive.cpp b/dbus/dbuspassive.cpp
index da9b387..e269b3d 100644
--- a/dbus/dbuspassive.cpp
+++ b/dbus/dbuspassive.cpp
@@ -13,6 +13,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+#include "dbuspassive.hpp"
+
+#include "dbus/util.hpp"
+
 #include <chrono>
 #include <cmath>
 #include <memory>
@@ -20,12 +24,9 @@
 #include <sdbusplus/bus.hpp>
 #include <string>
 
-#include "dbuspassive.hpp"
-#include "dbus/util.hpp"
-
 std::unique_ptr<ReadInterface> DbusPassive::CreateDbusPassive(
-    sdbusplus::bus::bus& bus, const std::string& type,
-    const std::string& id, DbusHelperInterface *helper)
+    sdbusplus::bus::bus& bus, const std::string& type, const std::string& id,
+    DbusHelperInterface* helper)
 {
     if (helper == nullptr)
     {
@@ -39,16 +40,11 @@
     return std::make_unique<DbusPassive>(bus, type, id, helper);
 }
 
-DbusPassive::DbusPassive(
-    sdbusplus::bus::bus& bus,
-    const std::string& type,
-    const std::string& id,
-    DbusHelperInterface *helper)
-    : ReadInterface(),
-      _bus(bus),
-      _signal(bus, GetMatch(type, id).c_str(), DbusHandleSignal, this),
-      _id(id),
-      _helper(helper)
+DbusPassive::DbusPassive(sdbusplus::bus::bus& bus, const std::string& type,
+                         const std::string& id, DbusHelperInterface* helper) :
+    ReadInterface(),
+    _bus(bus), _signal(bus, GetMatch(type, id).c_str(), DbusHandleSignal, this),
+    _id(id), _helper(helper)
 {
     /* Need to get the scale and initial value */
     auto tempBus = sdbusplus::bus::new_default();
@@ -68,10 +64,7 @@
 {
     std::lock_guard<std::mutex> guard(_lock);
 
-    struct ReadReturn r = {
-        _value,
-        _updated
-    };
+    struct ReadReturn r = {_value, _updated};
 
     return r;
 }
diff --git a/dbus/dbuspassive.hpp b/dbus/dbuspassive.hpp
index 545b928..87315a0 100644
--- a/dbus/dbuspassive.hpp
+++ b/dbus/dbuspassive.hpp
@@ -1,23 +1,22 @@
 #pragma once
 
+#include "dbus/util.hpp"
+#include "interfaces.hpp"
+
 #include <chrono>
 #include <cmath>
 #include <iostream>
 #include <map>
 #include <memory>
 #include <mutex>
+#include <sdbusplus/bus.hpp>
+#include <sdbusplus/message.hpp>
+#include <sdbusplus/server.hpp>
 #include <set>
 #include <string>
 #include <tuple>
 #include <vector>
 
-#include <sdbusplus/bus.hpp>
-#include <sdbusplus/message.hpp>
-#include <sdbusplus/server.hpp>
-
-#include "interfaces.hpp"
-#include "dbus/util.hpp"
-
 int DbusHandleSignal(sd_bus_message* msg, void* data, sd_bus_error* err);
 
 /*
@@ -33,33 +32,31 @@
  */
 class DbusPassive : public ReadInterface
 {
-    public:
-        static std::unique_ptr<ReadInterface> CreateDbusPassive(
-            sdbusplus::bus::bus& bus, const std::string& type,
-            const std::string& id, DbusHelperInterface *helper);
+  public:
+    static std::unique_ptr<ReadInterface>
+        CreateDbusPassive(sdbusplus::bus::bus& bus, const std::string& type,
+                          const std::string& id, DbusHelperInterface* helper);
 
-        DbusPassive(sdbusplus::bus::bus& bus,
-                    const std::string& type,
-                    const std::string& id,
-                    DbusHelperInterface *helper);
+    DbusPassive(sdbusplus::bus::bus& bus, const std::string& type,
+                const std::string& id, DbusHelperInterface* helper);
 
-        ReadReturn read(void) override;
+    ReadReturn read(void) override;
 
-        void setValue(double value);
-        int64_t getScale(void);
-        std::string getId(void);
+    void setValue(double value);
+    int64_t getScale(void);
+    std::string getId(void);
 
-    private:
-        sdbusplus::bus::bus& _bus;
-        sdbusplus::server::match::match _signal;
-        int64_t _scale;
-        std::string _id; // for debug identification
-        DbusHelperInterface *_helper;
+  private:
+    sdbusplus::bus::bus& _bus;
+    sdbusplus::server::match::match _signal;
+    int64_t _scale;
+    std::string _id; // for debug identification
+    DbusHelperInterface* _helper;
 
-        std::mutex _lock;
-        double _value = 0;
-        /* The last time the value was refreshed, not necessarily changed. */
-        std::chrono::high_resolution_clock::time_point _updated;
+    std::mutex _lock;
+    double _value = 0;
+    /* The last time the value was refreshed, not necessarily changed. */
+    std::chrono::high_resolution_clock::time_point _updated;
 };
 
 int HandleSensorValue(sdbusplus::message::message& msg, DbusPassive* owner);
diff --git a/dbus/dbuswrite.cpp b/dbus/dbuswrite.cpp
index 4c045e5..b26b96e 100644
--- a/dbus/dbuswrite.cpp
+++ b/dbus/dbuswrite.cpp
@@ -14,7 +14,8 @@
 // limitations under the License.
 */
 
-#include <dbus/dbuswrite.hpp>
+#include "dbus/dbuswrite.hpp"
+
 #include <iostream>
 #include <sdbusplus/bus.hpp>
 
diff --git a/dbus/dbuswrite.hpp b/dbus/dbuswrite.hpp
index 5beebb3..6733721 100644
--- a/dbus/dbuswrite.hpp
+++ b/dbus/dbuswrite.hpp
@@ -16,11 +16,11 @@
 
 #pragma once
 
-#include <string>
+#include "dbus/util.hpp"
+#include "interfaces.hpp"
 
-#include <dbus/util.hpp>
-#include <interfaces.hpp>
 #include <sdbusplus/bus.hpp>
+#include <string>
 
 constexpr const char *pwmInterface = "xyz.openbmc_project.Control.FanPwm";
 
diff --git a/dbus/util.cpp b/dbus/util.cpp
index ffdfe1f..f79bf4f 100644
--- a/dbus/util.cpp
+++ b/dbus/util.cpp
@@ -1,8 +1,8 @@
+#include "dbus/util.hpp"
+
 #include <iostream>
 #include <set>
 
-#include "dbus/util.hpp"
-
 using Property = std::string;
 using Value = sdbusplus::message::variant<int64_t, double, std::string>;
 using PropertyMap = std::map<Property, Value>;
@@ -14,11 +14,10 @@
                                    const std::string& intf,
                                    const std::string& path)
 {
-    auto mapper = bus.new_method_call(
-                      "xyz.openbmc_project.ObjectMapper",
-                      "/xyz/openbmc_project/object_mapper",
-                      "xyz.openbmc_project.ObjectMapper",
-                      "GetObject");
+    auto mapper =
+        bus.new_method_call("xyz.openbmc_project.ObjectMapper",
+                            "/xyz/openbmc_project/object_mapper",
+                            "xyz.openbmc_project.ObjectMapper", "GetObject");
 
     mapper.append(path);
     mapper.append(std::vector<std::string>({intf}));
@@ -45,10 +44,8 @@
                                const std::string& path,
                                struct SensorProperties* prop)
 {
-    auto pimMsg = bus.new_method_call(service.c_str(),
-                                      path.c_str(),
-                                      propertiesintf.c_str(),
-                                      "GetAll");
+    auto pimMsg = bus.new_method_call(service.c_str(), path.c_str(),
+                                      propertiesintf.c_str(), "GetAll");
 
     pimMsg.append(sensorintf);
     auto valueResponseMsg = bus.call(pimMsg);
@@ -116,7 +113,8 @@
     return std::string("type='signal',"
                        "interface='org.freedesktop.DBus.Properties',"
                        "member='PropertiesChanged',"
-                       "path='" + GetSensorPath(type, id) + "'");
+                       "path='" +
+                       GetSensorPath(type, id) + "'");
 }
 
 bool ValidType(const std::string& type)
diff --git a/dbus/util.hpp b/dbus/util.hpp
index 5b1522f..e459524 100644
--- a/dbus/util.hpp
+++ b/dbus/util.hpp
@@ -14,46 +14,44 @@
 
 class DbusHelperInterface
 {
-    public:
-        virtual ~DbusHelperInterface() = default;
+  public:
+    virtual ~DbusHelperInterface() = default;
 
-        /** @brief Get the service providing the interface for the path.
-         */
-        virtual std::string GetService(sdbusplus::bus::bus& bus,
-                                       const std::string& intf,
-                                       const std::string& path) = 0;
+    /** @brief Get the service providing the interface for the path.
+     */
+    virtual std::string GetService(sdbusplus::bus::bus& bus,
+                                   const std::string& intf,
+                                   const std::string& path) = 0;
 
-        /** @brief Get all Sensor.Value properties for a service and path.
-         *
-         * @param[in] bus - A bus to use for the call.
-         * @param[in] service - The service providing the interface.
-         * @param[in] path - The dbus path.
-         * @param[out] prop - A pointer to a properties struct to fill out.
-         */
-        virtual void GetProperties(sdbusplus::bus::bus& bus,
-                                   const std::string& service,
-                                   const std::string& path,
-                                   struct SensorProperties* prop) = 0;
+    /** @brief Get all Sensor.Value properties for a service and path.
+     *
+     * @param[in] bus - A bus to use for the call.
+     * @param[in] service - The service providing the interface.
+     * @param[in] path - The dbus path.
+     * @param[out] prop - A pointer to a properties struct to fill out.
+     */
+    virtual void GetProperties(sdbusplus::bus::bus& bus,
+                               const std::string& service,
+                               const std::string& path,
+                               struct SensorProperties* prop) = 0;
 };
 
 class DbusHelper : public DbusHelperInterface
 {
-    public:
-        DbusHelper() = default;
-        ~DbusHelper() = default;
-        DbusHelper(const DbusHelper&) = default;
-        DbusHelper& operator=(const DbusHelper&) = default;
-        DbusHelper(DbusHelper&&) = default;
-        DbusHelper& operator=(DbusHelper&&) = default;
+  public:
+    DbusHelper() = default;
+    ~DbusHelper() = default;
+    DbusHelper(const DbusHelper&) = default;
+    DbusHelper& operator=(const DbusHelper&) = default;
+    DbusHelper(DbusHelper&&) = default;
+    DbusHelper& operator=(DbusHelper&&) = default;
 
-        std::string GetService(sdbusplus::bus::bus& bus,
-                               const std::string& intf,
-                               const std::string& path) override;
+    std::string GetService(sdbusplus::bus::bus& bus, const std::string& intf,
+                           const std::string& path) override;
 
-        void GetProperties(sdbusplus::bus::bus& bus,
-                           const std::string& service,
-                           const std::string& path,
-                           struct SensorProperties* prop) override;
+    void GetProperties(sdbusplus::bus::bus& bus, const std::string& service,
+                       const std::string& path,
+                       struct SensorProperties* prop) override;
 };
 
 std::string GetSensorPath(const std::string& type, const std::string& id);
@@ -64,14 +62,14 @@
 {
     template <typename T>
     std::enable_if_t<std::is_arithmetic<T>::value, float>
-    operator()(const T &t) const
+        operator()(const T& t) const
     {
         return static_cast<float>(t);
     }
 
     template <typename T>
     std::enable_if_t<!std::is_arithmetic<T>::value, float>
-    operator()(const T &t) const
+        operator()(const T& t) const
     {
         throw std::invalid_argument("Cannot translate type to float");
     }
@@ -81,14 +79,14 @@
 {
     template <typename T>
     std::enable_if_t<std::is_arithmetic<T>::value, double>
-    operator()(const T &t) const
+        operator()(const T& t) const
     {
         return static_cast<double>(t);
     }
 
     template <typename T>
     std::enable_if_t<!std::is_arithmetic<T>::value, double>
-    operator()(const T &t) const
+        operator()(const T& t) const
     {
         throw std::invalid_argument("Cannot translate type to double");
     }