xref: /openbmc/bmcweb/include/dbus_singleton.hpp (revision 1abe55ef)
1911ac317SEd Tanous #pragma once
2aa2e59c1SEd Tanous #include <iostream>
3*1abe55efSEd Tanous #include <sdbusplus/asio/connection.hpp>
4aa2e59c1SEd Tanous 
5*1abe55efSEd Tanous namespace mapbox
6*1abe55efSEd Tanous {
7aa2e59c1SEd Tanous template <typename T, typename... Types>
8*1abe55efSEd Tanous const T* getPtr(const mapbox::util::variant<Types...>& v)
9*1abe55efSEd Tanous {
10*1abe55efSEd Tanous     if (v.template is<std::remove_const_t<T>>())
11*1abe55efSEd Tanous     {
12aa2e59c1SEd Tanous         return &v.template get_unchecked<std::remove_const_t<T>>();
13*1abe55efSEd Tanous     }
14*1abe55efSEd Tanous     else
15*1abe55efSEd Tanous     {
16aa2e59c1SEd Tanous         return nullptr;
17aa2e59c1SEd Tanous     }
18aa2e59c1SEd Tanous }
19aa2e59c1SEd Tanous } // namespace mapbox
20911ac317SEd Tanous 
21*1abe55efSEd Tanous namespace crow
22*1abe55efSEd Tanous {
23*1abe55efSEd Tanous namespace connections
24*1abe55efSEd Tanous {
2555c7b7a2SEd Tanous static std::shared_ptr<sdbusplus::asio::connection> systemBus;
26911ac317SEd Tanous 
27aa2e59c1SEd Tanous } // namespace connections
28911ac317SEd Tanous } // namespace crow
29