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

#include <ProxyInterfaces.h>

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

Public Member Functions

 ProxyInterfaces (ServiceName destination, ObjectPath objectPath)
 Creates native-like proxy object instance.
 
 ProxyInterfaces (ServiceName destination, ObjectPath objectPath, dont_run_event_loop_thread_t)
 Creates native-like proxy object instance.
 
 ProxyInterfaces (IConnection &connection, ServiceName destination, ObjectPath objectPath)
 Creates native-like proxy object instance.
 
 ProxyInterfaces (std::unique_ptr< sdbus::IConnection > &&connection, ServiceName destination, ObjectPath objectPath)
 Creates native-like proxy object instance.
 
 ProxyInterfaces (std::unique_ptr< sdbus::IConnection > &&connection, ServiceName destination, ObjectPath objectPath, dont_run_event_loop_thread_t)
 Creates native-like proxy object instance.
 
void registerProxy ()
 Registers handlers for D-Bus signals of the remote object.
 
void unregisterProxy ()
 Unregisters the proxy so it no more receives signals and async call replies.
 
const IProxygetProxy () const
 Returns reference to the underlying IProxy instance.
 
IProxygetProxy ()
 Returns reference to the underlying IProxy instance.
 

Protected Types

using base_type = ProxyInterfaces
 

Protected Member Functions

 ProxyInterfaces (const ProxyInterfaces &)=delete
 
ProxyInterfacesoperator= (const ProxyInterfaces &)=delete
 
 ProxyInterfaces (ProxyInterfaces &&)=delete
 
ProxyInterfacesoperator= (ProxyInterfaces &&)=delete
 
- 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 adaptor class inherited from ProxyInterfaces, one needs to make sure:

  1. to call registerProxy(); in the class constructor, and, conversely,
  2. to call unregisterProxy(); in the class destructor, so that the signals are subscribed to and unsubscribed from at a proper time.

Constructor & Destructor Documentation

◆ ProxyInterfaces() [1/5]

template<typename... _Interfaces>
sdbus::ProxyInterfaces< _Interfaces >::ProxyInterfaces ( ServiceName  destination,
ObjectPath  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/5]

template<typename... _Interfaces>
sdbus::ProxyInterfaces< _Interfaces >::ProxyInterfaces ( ServiceName  destination,
ObjectPath  objectPath,
dont_run_event_loop_thread_t   
)
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,sdbus::dont_run_event_loop_thread_t)

◆ ProxyInterfaces() [3/5]

template<typename... _Interfaces>
sdbus::ProxyInterfaces< _Interfaces >::ProxyInterfaces ( IConnection connection,
ServiceName  destination,
ObjectPath  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() [4/5]

template<typename... _Interfaces>
sdbus::ProxyInterfaces< _Interfaces >::ProxyInterfaces ( std::unique_ptr< sdbus::IConnection > &&  connection,
ServiceName  destination,
ObjectPath  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)

◆ ProxyInterfaces() [5/5]

template<typename... _Interfaces>
sdbus::ProxyInterfaces< _Interfaces >::ProxyInterfaces ( std::unique_ptr< sdbus::IConnection > &&  connection,
ServiceName  destination,
ObjectPath  objectPath,
dont_run_event_loop_thread_t   
)
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,sdbus::dont_run_event_loop_thread_t)

Member Function Documentation

◆ registerProxy()

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

Registers handlers for D-Bus signals of the remote object.

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

See also IProxy::registerSignalHandler()

◆ 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: