sdbus-c++ 1.2.0
High-level C++ D-Bus library based on systemd D-Bus implementation
sdbus::ProxyInterfaces< _Interfaces > Class Template Reference

#include <ProxyInterfaces.h>

Inheritance diagram for sdbus::ProxyInterfaces< _Interfaces >:
sdbus::ProxyObjectHolder

Public Member Functions

 ProxyInterfaces (std::string destination, std::string objectPath)
 Creates native-like proxy object instance. More...
 
 ProxyInterfaces (IConnection &connection, std::string destination, std::string objectPath)
 Creates native-like proxy object instance. More...
 
 ProxyInterfaces (std::unique_ptr< sdbus::IConnection > &&connection, std::string destination, std::string objectPath)
 Creates native-like proxy object instance. More...
 
void registerProxy ()
 Finishes proxy registration and makes the proxy ready for use. More...
 
void unregisterProxy ()
 Unregisters the proxy so it no more receives signals and async call replies. More...
 
const std::string & getObjectPath () const
 Returns object path of the underlying DBus object.
 

Protected Types

using base_type = ProxyInterfaces
 

Additional Inherited Members

- Protected Member Functions inherited from sdbus::ProxyObjectHolder
 ProxyObjectHolder (std::unique_ptr< IProxy > &&proxy)
 
const IProxygetProxy () const
 
IProxygetProxy ()
 

Detailed Description

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

ProxyInterfaces 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 client (the proxy) side, including some auxiliary classes. ProxyInterfaces is the class that native-like proxy 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 proxy-side interface classes representing interfaces of the corresponding remote D-Bus object.

In the final proxy class inherited from ProxyInterfaces, it is necessary to finish proxy registration in class constructor (finishRegistration();), and, conversely, unregister the proxy in class destructor (unregister();).

Constructor & Destructor Documentation

◆ ProxyInterfaces() [1/3]

template<typename... _Interfaces>
sdbus::ProxyInterfaces< _Interfaces >::ProxyInterfaces ( std::string  destination,
std::string  objectPath 
)
inline

Creates native-like proxy object instance.

Parameters
[in]destinationBus name that provides a D-Bus object
[in]objectPathPath of the D-Bus object

This constructor overload creates a proxy that manages its own D-Bus connection(s). For more information on its behavior, consult createProxy(std::string,std::string)

◆ ProxyInterfaces() [2/3]

template<typename... _Interfaces>
sdbus::ProxyInterfaces< _Interfaces >::ProxyInterfaces ( IConnection connection,
std::string  destination,
std::string  objectPath 
)
inline

Creates native-like proxy object instance.

Parameters
[in]connectionD-Bus connection to be used by the proxy object
[in]destinationBus name that provides a D-Bus object
[in]objectPathPath of the D-Bus object

The proxy created this way just references a D-Bus connection owned and managed by the user. For more information on its behavior, consult createProxy(IConnection&,std::string,std::string)

◆ ProxyInterfaces() [3/3]

template<typename... _Interfaces>
sdbus::ProxyInterfaces< _Interfaces >::ProxyInterfaces ( std::unique_ptr< sdbus::IConnection > &&  connection,
std::string  destination,
std::string  objectPath 
)
inline

Creates native-like proxy object instance.

Parameters
[in]connectionD-Bus connection to be used by the proxy object
[in]destinationBus name that provides a D-Bus object
[in]objectPathPath of the D-Bus object

The proxy created this way becomes an owner of the connection. For more information on its behavior, consult createProxy(std::unique_ptr<sdbus::IConnection>&&,std::string,std::string)

Member Function Documentation

◆ registerProxy()

template<typename... _Interfaces>
void sdbus::ProxyInterfaces< _Interfaces >::registerProxy ( )
inline

Finishes proxy registration and makes the proxy ready for use.

This function must be called in the constructor of the final proxy class that implements ProxyInterfaces.

For more information, see underlying IProxy::finishRegistration()

◆ unregisterProxy()

template<typename... _Interfaces>
void sdbus::ProxyInterfaces< _Interfaces >::unregisterProxy ( )
inline

Unregisters the proxy so it no more receives signals and async call replies.

This function must be called in the destructor of the final proxy class that implements ProxyInterfaces.

See underlying IProxy::unregister()


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