summaryrefslogtreecommitdiff
path: root/include/dbus_singleton.hpp
diff options
context:
space:
mode:
authorEd Tanous <ed.tanous@intel.com>2018-04-12 22:17:20 +0300
committerEd Tanous <ed.tanous@intel.com>2018-06-29 21:11:20 +0300
commitaa2e59c10280ca4819926905e77a076bdb72a03f (patch)
treeda6549670170adddb92459cea40ce4c05fe8d213 /include/dbus_singleton.hpp
parent274fad5ad0e7634d9ed3e174695136e674688e0c (diff)
downloadbmcweb-aa2e59c10280ca4819926905e77a076bdb72a03f.tar.xz
Move bmcweb over to sdbusplus
This patchset moves bmcweb from using boost-dbus over entirely to sdbusplus. This has some nice improvements in performance (about 30% of CPU cycles saved in dbus transactions), as well as makes this project manuver closer to the upstream way of thinking. Changes to bmcweb are largely ceremonial, and fall into a few categories: 1. Moves async_method_call instances to the new format, and deletes any use of the "endpoint" object in leiu of the sdbusplus style interface 2. sdbus object_path object doesn't allow access to the string directly, so code that uses it moves to explicit casts. 3. The mapbox variant, while attempting to recreate boost::variant, misses a T* get<T*>() method implementation, which allows using variant without exceptions. Currently, there is an overload for mapbox::get_ptr implementation which replecates the functionality. Tested by: Booting the bmcweb on a target, iterating through redfish basic phosphor-webui usage, and websockets usage Change-Id: I2d95882908d6eb6dba00b9219a221dd96449ca7b Signed-off-by: Ed Tanous <ed.tanous@intel.com>
Diffstat (limited to 'include/dbus_singleton.hpp')
-rw-r--r--include/dbus_singleton.hpp21
1 files changed, 16 insertions, 5 deletions
diff --git a/include/dbus_singleton.hpp b/include/dbus_singleton.hpp
index e2fd2d6c73..e6be81b373 100644
--- a/include/dbus_singleton.hpp
+++ b/include/dbus_singleton.hpp
@@ -1,10 +1,21 @@
#pragma once
-#include <dbus/connection.hpp>
+#include <sdbusplus/asio/connection.hpp>
+#include <iostream>
+
+namespace mapbox {
+template <typename T, typename... Types>
+const T* get_ptr(const mapbox::util::variant<Types...>& v) {
+ if (v.template is<std::remove_const_t<T>>()) {
+ return &v.template get_unchecked<std::remove_const_t<T>>();
+ } else {
+ return nullptr;
+ }
+}
+} // namespace mapbox
namespace crow {
namespace connections {
+static std::shared_ptr<sdbusplus::asio::connection> system_bus;
-static std::shared_ptr<dbus::connection> system_bus;
-
-} // namespace dbus
-} // namespace crow \ No newline at end of file
+} // namespace connections
+} // namespace crow