sdbusplus: use shorter type aliases
The sdbusplus headers provide shortened aliases for many types.
Switch to using them to provide better code clarity and shorter
lines. Possible replacements are for:
* bus_t
* exception_t
* manager_t
* match_t
* message_t
* object_t
* slot_t
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I6a559082fed34ae62b648345ead793436d2d03f6
diff --git a/src/callback.hpp b/src/callback.hpp
index 9b729e4..2ee8282 100644
--- a/src/callback.hpp
+++ b/src/callback.hpp
@@ -48,7 +48,7 @@
* @param[in] msg - The sdbusplus signal message
*/
virtual void operator()(Context /* ctx */,
- sdbusplus::message::message& /* msg */){};
+ sdbusplus::message_t& /* msg */){};
};
/** @class Conditional
diff --git a/src/event_entry.hpp b/src/event_entry.hpp
index 032099d..67d5302 100644
--- a/src/event_entry.hpp
+++ b/src/event_entry.hpp
@@ -15,7 +15,7 @@
using namespace phosphor::dbus::monitoring;
-using EntryIface = sdbusplus::server::object::object<
+using EntryIface = sdbusplus::server::object_t<
sdbusplus::xyz::openbmc_project::Logging::server::Event>;
/** @class Entry
diff --git a/src/main.cpp b/src/main.cpp
index 2686056..84bad44 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -31,7 +31,7 @@
auto& bus = SDBusPlus::getBus();
// Add sdbusplus Object Manager for the 'root' path of events.
- sdbusplus::server::manager::manager objManager(bus, OBJ_EVENT);
+ sdbusplus::server::manager_t objManager(bus, OBJ_EVENT);
phosphor::events::getManager().restore();
diff --git a/src/method.hpp b/src/method.hpp
index 715be8f..7190a88 100644
--- a/src/method.hpp
+++ b/src/method.hpp
@@ -36,7 +36,7 @@
DBusInterface::callMethodNoReply(bus, path, iface, method,
std::forward<MethodArgs>(args)...);
}
- catch (const sdbusplus::exception::exception& e)
+ catch (const sdbusplus::exception_t& e)
{
lg2::error(
"Unable to call DBus method: {ERROR}. {BUS}, {PATH}, {INTF}, {METHOD}",
diff --git a/src/pathwatch.hpp b/src/pathwatch.hpp
index bc0cb3a..d9bb836 100644
--- a/src/pathwatch.hpp
+++ b/src/pathwatch.hpp
@@ -54,7 +54,7 @@
*
* Watch callback interface implementation for PathWatch.
*/
- void callback(Context ctx, sdbusplus::message::message& msg) override;
+ void callback(Context ctx, sdbusplus::message_t& msg) override;
protected:
/** @brief Path of the D-Bus object to watch for. */
diff --git a/src/pathwatchimpl.hpp b/src/pathwatchimpl.hpp
index e1e8f97..282ed60 100644
--- a/src/pathwatchimpl.hpp
+++ b/src/pathwatchimpl.hpp
@@ -47,7 +47,7 @@
template <typename DBusInterfaceType>
void PathWatch<DBusInterfaceType>::callback(Context ctx,
- sdbusplus::message::message& msg)
+ sdbusplus::message_t& msg)
{
(this->cb)(ctx, msg);
}
diff --git a/src/propertywatch.hpp b/src/propertywatch.hpp
index 6cb1d63..7c5f468 100644
--- a/src/propertywatch.hpp
+++ b/src/propertywatch.hpp
@@ -80,7 +80,7 @@
* @param[in] path - The path associated with the message.
* @param[in] interface - The interface associated with the message.
*/
- virtual void propertiesChanged(sdbusplus::message::message&,
+ virtual void propertiesChanged(sdbusplus::message_t&,
const std::string& path,
const std::string& interface) = 0;
@@ -91,7 +91,7 @@
* @param[in] msg - The org.freedesktop.DBus.PropertiesChanged
* message.
*/
- virtual void interfacesAdded(sdbusplus::message::message& msg) = 0;
+ virtual void interfacesAdded(sdbusplus::message_t& msg) = 0;
protected:
/** @brief Property names and their associated storage. */
@@ -154,8 +154,7 @@
* @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,
+ void propertiesChanged(sdbusplus::message_t& msg, const std::string& path,
const std::string& interface) override;
/** @brief DBus agnostic implementation of interfacesAdded.
@@ -174,7 +173,7 @@
* @param[in] msg - The org.freedesktop.DBus.PropertiesChanged
* message.
*/
- void interfacesAdded(sdbusplus::message::message& msg) override;
+ void interfacesAdded(sdbusplus::message_t& msg) override;
/** @brief DBus agnostic implementation of interfacesAdded.
*
diff --git a/src/propertywatchimpl.hpp b/src/propertywatchimpl.hpp
index ae0ed29..cf97f63 100644
--- a/src/propertywatchimpl.hpp
+++ b/src/propertywatchimpl.hpp
@@ -58,7 +58,7 @@
MAPPER_BUSNAME, MAPPER_PATH, MAPPER_INTERFACE, "GetObject",
path, queryInterfaces);
}
- catch (const sdbusplus::exception::exception&)
+ catch (const sdbusplus::exception_t&)
{
// Paths in the configuration may not exist yet. Prime those
// later, when/if InterfacesAdded occurs.
@@ -105,7 +105,7 @@
{
updateProperties(busName, path, interface);
}
- catch (const sdbusplus::exception::exception&)
+ catch (const sdbusplus::exception_t&)
{
// If for some reason the path has gone away since
// the mapper lookup we'll simply try again if/when
@@ -189,7 +189,7 @@
template <typename T, typename DBusInterfaceType>
void PropertyWatchOfType<T, DBusInterfaceType>::propertiesChanged(
- sdbusplus::message::message& msg, const std::string& path,
+ sdbusplus::message_t& msg, const std::string& path,
const std::string& interface)
{
PropertiesChanged<T> properties;
@@ -209,7 +209,7 @@
template <typename T, typename DBusInterfaceType>
void PropertyWatchOfType<T, DBusInterfaceType>::interfacesAdded(
- sdbusplus::message::message& msg)
+ sdbusplus::message_t& msg)
{
sdbusplus::message::object_path path;
InterfacesAdded<T> interfaces;
diff --git a/src/sdbusplus.hpp b/src/sdbusplus.hpp
index 1e0b978..3767282 100644
--- a/src/sdbusplus.hpp
+++ b/src/sdbusplus.hpp
@@ -26,7 +26,7 @@
private:
static auto& getWatches()
{
- static std::vector<sdbusplus::bus::match::match> watches;
+ static std::vector<sdbusplus::bus::match_t> watches;
return watches;
}
@@ -74,13 +74,13 @@
const std::string& method, Args&&... args)
{
Ret resp;
- sdbusplus::message::message respMsg = callMethod<Args...>(
+ sdbusplus::message_t respMsg = callMethod<Args...>(
busName, path, interface, method, std::forward<Args>(args)...);
try
{
respMsg.read(resp);
}
- catch (const sdbusplus::exception::exception& e)
+ catch (const sdbusplus::exception_t& e)
{
// Empty responses are expected sometimes, and the calling
// code is set up to handle it.
@@ -89,9 +89,8 @@
}
/** @brief Register a DBus signal callback. */
- static auto
- addMatch(const std::string& match,
- const sdbusplus::bus::match::match::callback_t& callback)
+ static auto addMatch(const std::string& match,
+ const sdbusplus::bus::match_t::callback_t& callback)
{
getWatches().emplace_back(getBus(), match, callback);
}
@@ -114,7 +113,7 @@
name = object.begin()->first;
}
}
- catch (const sdbusplus::exception::exception& e)
+ catch (const sdbusplus::exception_t& e)
{
// Empty responses are expected sometimes, and the calling
// code is set up to handle it.
diff --git a/src/snmp_trap.cpp b/src/snmp_trap.cpp
index 497f0e4..f7a4685 100644
--- a/src/snmp_trap.cpp
+++ b/src/snmp_trap.cpp
@@ -20,7 +20,7 @@
static constexpr auto entry = "xyz.openbmc_project.Logging.Entry";
-void ErrorTrap::trap(sdbusplus::message::message& msg) const
+void ErrorTrap::trap(sdbusplus::message_t& msg) const
{
sdbusplus::message::object_path path;
msg.read(path);
diff --git a/src/snmp_trap.hpp b/src/snmp_trap.hpp
index b587d8c..5453eb4 100644
--- a/src/snmp_trap.hpp
+++ b/src/snmp_trap.hpp
@@ -22,7 +22,7 @@
/** @brief Raise SNMP trap by parsing the sdbus message.
* @param[in] msg - sdbus message.
*/
- virtual void trap(sdbusplus::message::message& msg) const = 0;
+ virtual void trap(sdbusplus::message_t& msg) const = 0;
};
/** @class ErrorTrap
@@ -41,7 +41,7 @@
/** @brief Raise SNMP trap by parsing the sdbus message.
* @param[in] msg - sdbus message.
*/
- void trap(sdbusplus::message::message& msg) const override;
+ void trap(sdbusplus::message_t& msg) const override;
};
/** @class SNMPTrap
@@ -69,8 +69,7 @@
* @param[in] ctc - context.
* @param[in] msg - sdbus message.
*/
- void operator()(Context /* ctx */,
- sdbusplus::message::message& msg) override
+ void operator()(Context /* ctx */, sdbusplus::message_t& msg) override
{
event.trap(msg);
}
diff --git a/src/test/propertywatchtest.hpp b/src/test/propertywatchtest.hpp
index 6fcf45f..f6b7496 100644
--- a/src/test/propertywatchtest.hpp
+++ b/src/test/propertywatchtest.hpp
@@ -255,9 +255,8 @@
const std::string&, const std::string&, const std::string&,
const std::string&, const std::string&));
- MOCK_METHOD2(fwdAddMatch,
- void(const std::string&,
- const sdbusplus::bus::match::match::callback_t&));
+ MOCK_METHOD2(fwdAddMatch, void(const std::string&,
+ const sdbusplus::bus::match_t::callback_t&));
static MockDBusInterface* ptr;
static MockDBusInterface& instance()
@@ -282,9 +281,8 @@
}
/** @brief GMock free function forward. */
- static auto
- addMatch(const std::string& match,
- const sdbusplus::bus::match::match::callback_t& callback)
+ static auto addMatch(const std::string& match,
+ const sdbusplus::bus::match_t::callback_t& callback)
{
instance().fwdAddMatch(match, callback);
}
diff --git a/src/watch.hpp b/src/watch.hpp
index c206316..5cf2c19 100644
--- a/src/watch.hpp
+++ b/src/watch.hpp
@@ -39,8 +39,7 @@
virtual void callback(Context ctx) = 0;
/** @brief Invoke the callback associated with the watch. */
- virtual void callback(Context /* ctx */,
- sdbusplus::message::message& /* msg */){};
+ virtual void callback(Context /* ctx */, sdbusplus::message_t& /* msg */){};
};
} // namespace monitoring