vtable: shorten vtable type
Create an alias `sdbusplus::vtable_t` to `sdbusplus::vtable::vtable_t`
to reduce duplication.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I0c3a8e40827cb011a07d75c99550a371afdefc64
diff --git a/include/sdbusplus/asio/object_server.hpp b/include/sdbusplus/asio/object_server.hpp
index bbdc7a5..1013bd5 100644
--- a/include/sdbusplus/asio/object_server.hpp
+++ b/include/sdbusplus/asio/object_server.hpp
@@ -371,7 +371,7 @@
template <typename PropertyType, typename CallbackTypeGet>
bool register_property_r(const std::string& name,
const PropertyType& property,
- decltype(vtable::vtable_t::flags) flags,
+ decltype(vtable_t::flags) flags,
CallbackTypeGet&& getFunction)
{
// can only register once
@@ -411,7 +411,7 @@
typename CallbackTypeGet>
bool register_property_rw(const std::string& name,
const PropertyType& property,
- decltype(vtable::vtable_t::flags) flags,
+ decltype(vtable_t::flags) flags,
CallbackTypeSet&& setFunction,
CallbackTypeGet&& getFunction)
{
diff --git a/include/sdbusplus/server/interface.hpp b/include/sdbusplus/server/interface.hpp
index 446e023..d840bd2 100644
--- a/include/sdbusplus/server/interface.hpp
+++ b/include/sdbusplus/server/interface.hpp
@@ -58,7 +58,7 @@
* the interface implementation class.
*/
interface(sdbusplus::bus_t& bus, const char* path, const char* interf,
- const sdbusplus::vtable::vtable_t* vtable, void* context);
+ const sdbusplus::vtable_t* vtable, void* context);
~interface();
diff --git a/include/sdbusplus/vtable.hpp b/include/sdbusplus/vtable.hpp
index 09dbfc6..6e7def3 100644
--- a/include/sdbusplus/vtable.hpp
+++ b/include/sdbusplus/vtable.hpp
@@ -183,4 +183,6 @@
} // namespace vtable
+using vtable_t = vtable::vtable_t;
+
} // namespace sdbusplus
diff --git a/src/server/interface.cpp b/src/server/interface.cpp
index 166a80c..9832547 100644
--- a/src/server/interface.cpp
+++ b/src/server/interface.cpp
@@ -10,8 +10,8 @@
{
interface::interface(sdbusplus::bus_t& bus, const char* path,
- const char* interf,
- const sdbusplus::vtable::vtable_t* vtable, void* context) :
+ const char* interf, const sdbusplus::vtable_t* vtable,
+ void* context) :
_bus(bus.get(), bus.getInterface()),
_path(path), _interf(interf), _slot(nullptr), _intf(bus.getInterface()),
_interface_added(false)
diff --git a/test/vtable/vtable.cpp b/test/vtable/vtable.cpp
index 9b563a6..32f72a8 100644
--- a/test/vtable/vtable.cpp
+++ b/test/vtable/vtable.cpp
@@ -17,7 +17,7 @@
extern const size_t example2_size;
}
-static const sdbusplus::vtable::vtable_t example[] = {
+static const sdbusplus::vtable_t example[] = {
sdbusplus::vtable::start(),
sdbusplus::vtable::method("1", "2", "3", &test_handler, 0),
sdbusplus::vtable::signal("5", "6"),
diff --git a/tools/sdbusplus/templates/interface.server.cpp.mako b/tools/sdbusplus/templates/interface.server.cpp.mako
index f9d17d2..94f5040 100644
--- a/tools/sdbusplus/templates/interface.server.cpp.mako
+++ b/tools/sdbusplus/templates/interface.server.cpp.mako
@@ -150,7 +150,7 @@
}
% endfor
-const vtable::vtable_t ${classname}::_vtable[] = {
+const vtable_t ${classname}::_vtable[] = {
vtable::start(),
% for m in interface.methods:
${ m.cpp_prototype(loader, interface=interface, ptype='vtable') }
diff --git a/tools/sdbusplus/templates/interface.server.hpp.mako b/tools/sdbusplus/templates/interface.server.hpp.mako
index 92f5ab6..74f1650 100644
--- a/tools/sdbusplus/templates/interface.server.hpp.mako
+++ b/tools/sdbusplus/templates/interface.server.hpp.mako
@@ -177,7 +177,7 @@
% endfor
- static const vtable::vtable_t _vtable[];
+ static const vtable_t _vtable[];
sdbusplus::server::interface_t
_${"_".join(interface.name.split('.'))}_interface;
sdbusplus::SdBusInterface *_intf;