sdbus-c++ 2.1.0
High-level C++ D-Bus library based on systemd D-Bus implementation
Loading...
Searching...
No Matches
sdbus::AdaptorInterfaces< _Interfaces > Class Template Reference

#include <AdaptorInterfaces.h>

Inheritance diagram for sdbus::AdaptorInterfaces< _Interfaces >:
sdbus::ObjectHolder

Public Member Functions

 AdaptorInterfaces (IConnection &connection, ObjectPath objectPath)
 Creates object instance.
 
void registerAdaptor ()
 Adds object vtable (i.e. D-Bus API) definitions for all interfaces it implements.
 
void unregisterAdaptor ()
 Unregisters adaptors's API and removes it from the bus.
 
const IObjectgetObject () const
 Returns reference to the underlying IObject instance.
 
IObjectgetObject ()
 Returns reference to the underlying IObject instance.
 

Protected Types

using base_type = AdaptorInterfaces
 

Protected Member Functions

 AdaptorInterfaces (const AdaptorInterfaces &)=delete
 
AdaptorInterfacesoperator= (const AdaptorInterfaces &)=delete
 
 AdaptorInterfaces (AdaptorInterfaces &&)=delete
 
AdaptorInterfacesoperator= (AdaptorInterfaces &&)=delete
 
- Protected Member Functions inherited from sdbus::ObjectHolder
 ObjectHolder (std::unique_ptr< IObject > &&object)
 
const IObjectgetObject () const
 
IObjectgetObject ()
 

Detailed Description

template<typename... _Interfaces>
class sdbus::AdaptorInterfaces< _Interfaces >

AdaptorInterfaces is a helper template class that joins all interface classes of a remote D-Bus object generated by sdbus-c++-xml2cpp to be used on the server (the adaptor) side, including some auxiliary classes. AdaptorInterfaces is the class that native-like object implementation classes written by users should inherit from and implement all pure virtual methods. So the _Interfaces template parameter is a list of sdbus-c++-xml2cpp-generated adaptor-side interface classes representing interfaces (with methods, signals and properties) of the D-Bus object.

In the final adaptor class inherited from AdaptorInterfaces, one needs to make sure:

  1. to call registerAdaptor(); in the class constructor, and, conversely,
  2. to call unregisterAdaptor(); in the class destructor, so that the object API vtable is registered and unregistered at the proper time.

Constructor & Destructor Documentation

◆ AdaptorInterfaces()

template<typename... _Interfaces>
sdbus::AdaptorInterfaces< _Interfaces >::AdaptorInterfaces ( IConnection & connection,
ObjectPath objectPath )
inline

Creates object instance.

Parameters
[in]connectionD-Bus connection where the object will publish itself
[in]objectPathPath of the D-Bus object

For more information, consult createObject(sdbus::IConnection&,std::string)

Member Function Documentation

◆ registerAdaptor()

template<typename... _Interfaces>
void sdbus::AdaptorInterfaces< _Interfaces >::registerAdaptor ( )
inline

Adds object vtable (i.e. D-Bus API) definitions for all interfaces it implements.

This function must be called in the constructor of the final adaptor class that implements AdaptorInterfaces.

See also IObject::addVTable()

◆ unregisterAdaptor()

template<typename... _Interfaces>
void sdbus::AdaptorInterfaces< _Interfaces >::unregisterAdaptor ( )
inline

Unregisters adaptors's API and removes it from the bus.

This function must be called in the destructor of the final adaptor class that implements AdaptorInterfaces.

For more information, see underlying IObject::unregister()


The documentation for this class was generated from the following file: