27#ifndef SDBUS_CXX_ADAPTORINTERFACES_H_
28#define SDBUS_CXX_ADAPTORINTERFACES_H_
53 explicit ObjectHolder(std::unique_ptr<IObject>&&
object)
54 : object_(std::move(object))
58 [[nodiscard]]
const IObject& getObject()
const
60 assert(object_ !=
nullptr);
64 [[nodiscard]] IObject& getObject()
66 assert(object_ !=
nullptr);
71 std::unique_ptr<IObject> object_;
91 template <
typename... Interfaces>
92 class AdaptorInterfaces
93 :
protected ObjectHolder
94 ,
public Interfaces...
97 AdaptorInterfaces(
const AdaptorInterfaces&) =
delete;
98 AdaptorInterfaces& operator=(
const AdaptorInterfaces&) =
delete;
99 AdaptorInterfaces(AdaptorInterfaces&&) =
delete;
100 AdaptorInterfaces& operator=(AdaptorInterfaces&&) =
delete;
110 AdaptorInterfaces(IConnection& connection, ObjectPath objectPath)
111 : ObjectHolder(
createObject(connection, std::move(objectPath)))
112 , Interfaces(getObject())...
123 void registerAdaptor()
125 (Interfaces::registerAdaptor(), ...);
135 void unregisterAdaptor()
137 getObject().unregister();
143 using ObjectHolder::getObject;
146 using base_type = AdaptorInterfaces;
148 ~AdaptorInterfaces() =
default;
std::unique_ptr< IObject > createObject(IConnection &connection, ObjectPath objectPath)
Creates instance representing a D-Bus object.
Definition IConnection.h:61