MCPcopy Create free account
hub / github.com/Kistler-Group/sdbus-cpp / IObject

Class IObject

include/sdbus-c++/IObject.h:62–423  ·  view source on GitHub ↗

/ * @class IObject * * IObject class represents a D-Bus object instance identified by a specific object path. * D-Bus object provides its interfaces, methods, signals and properties on a bus * identified by a specific bus name. * * All IObject member methods throw @c sdbus::Error in case of D-Bus or sdbus-c++ error. * The IObject class has been designed as thread

Source from the content-addressed store, hash-verified

60 *
61 ***********************************************/
62 class IObject
63 {
64 public: // High-level, convenience API
65 virtual ~IObject() = default;
66
67 /*!
68 * @brief Adds a declaration of methods, properties and signals of the object at a given interface
69 *
70 * @param[in] vtable Individual instances of VTable item structures stored in a vector
71 * @return VTableAdder high-level helper class
72 *
73 * This method is used to declare attributes for the object under the given interface.
74 * Parameter `vtable' represents a vtable definition that may contain method declarations
75 * (using MethodVTableItem struct), property declarations (using PropertyVTableItem
76 * struct), signal declarations (using SignalVTableItem struct), or global interface
77 * flags (using InterfaceFlagsVTableItem struct).
78 *
79 * An interface can have any number of vtables attached to it.
80 *
81 * Consult manual pages for the underlying `sd_bus_add_object_vtable` function for more information.
82 *
83 * The method can be called at any time during object's lifetime.
84 *
85 * When called like `addVTable(vtable).forInterface(interface)`, then an internal registration
86 * slot is created for that vtable and its lifetime is tied to the lifetime of the Object instance.
87 * When called like `addVTable(items...).forInterface(interface, sdbus::return_slot)`, then an internal
88 * registration slot is created for the vtable and is returned to the caller. Keeping the slot means
89 * keep the registration "alive". Destroying the slot means that the vtable is not needed anymore,
90 * and the vtable gets removed from the object. This allows for "dynamic" object API where vtables
91 * can be added or removed by the user at runtime.
92 *
93 * The function provides strong exception guarantee. The state of the object remains
94 * unmodified in face of an exception.
95 *
96 * @throws sdbus::Error in case of failure
97 */
98 [[nodiscard]] VTableAdder addVTable(std::vector<VTableItem> vtable);
99
100 /*!
101 * @brief Adds a declaration of methods, properties and signals of the object at a given interface
102 *
103 * @param[in] items Individual instances of VTable item structures
104 * @return VTableAdder high-level helper class
105 *
106 * This method is used to declare attributes for the object under the given interface.
107 * Parameter pack contains vtable definition that may contain method declarations
108 * (using MethodVTableItem struct), property declarations (using PropertyVTableItem
109 * struct), signal declarations (using SignalVTableItem struct), or global interface
110 * flags (using InterfaceFlagsVTableItem struct).
111 *
112 * An interface can have any number of vtables attached to it.
113 *
114 * Consult manual pages for the underlying `sd_bus_add_object_vtable` function for more information.
115 *
116 * The method can be called at any time during object's lifetime.
117 *
118 * When called like `addVTable(items...).forInterface(interface)`, then an internal registration
119 * slot is created for that vtable and its lifetime is tied to the lifetime of the Object instance.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected