18 #include <sigc++/sigc++.h>
21 #ifndef DBUSCXX_METHODPROXYBASE_H
22 #define DBUSCXX_METHODPROXYBASE_H
29 template <
typename signature>
class MethodProxy;
49 static std::shared_ptr<MethodProxyBase>
create(
const std::string&
name );
55 const std::string&
name()
const;
59 std::shared_ptr<const ReturnMessage>
call( std::shared_ptr<const CallMessage>,
int timeout_milliseconds = -1 )
const;
81 template<
typename... T_arg>
89 std::ostringstream debug_str;
92 debug_str <<
"DBus::MethodProxy<";
93 debug_str << method_sig_gen.debug_string();
94 debug_str <<
"> calling method=";
98 std::shared_ptr<CallMessage> _callmsg = this->create_call_message();
99 ( *_callmsg << ... << args );
100 std::shared_ptr<const ReturnMessage> retmsg = this->call( _callmsg, -1 );
104 std::ostringstream debug_str;
107 debug_str <<
"DBus::MethodProxy<";
108 debug_str << method_sig_gen.debug_string();
109 debug_str <<
"> calling async method=";
113 return std::async( std::launch::async, *
this, args... );
116 static std::shared_ptr<MethodProxy>
create(
const std::string& name ) {
117 return std::shared_ptr<MethodProxy>(
new MethodProxy( name ) );
127 template<
typename T_return,
typename... T_arg>
135 std::ostringstream debug_str;
138 debug_str <<
"DBus::MethodProxy<";
139 debug_str << method_sig_gen.debug_string();
140 debug_str <<
"> calling method=";
144 std::shared_ptr<CallMessage> _callmsg = this->create_call_message();
146 ( void )( iter << ... << args );
147 std::shared_ptr<const ReturnMessage> retmsg = this->call( _callmsg, -1 );
154 std::ostringstream debug_str;
157 debug_str <<
"DBus::MethodProxy<";
158 debug_str << method_sig_gen.debug_string();
159 debug_str <<
"> calling async method=";
163 return std::async( std::launch::async, *
this, args... );
166 static std::shared_ptr<MethodProxy>
create(
const std::string& name ) {
167 return std::shared_ptr<MethodProxy>(
new MethodProxy( name ) );
An InterfaceProxy represents a remote Interface in another application on the DBus.
Definition: interfaceproxy.h:43
Insertion iterator allow values to be appended to a message.
Definition: messageappenditerator.h:38
Base class for all proxy(remote) methods.
Definition: methodproxybase.h:41
static std::shared_ptr< MethodProxyBase > create(const std::string &name)
Definition: methodproxybase.cpp:37
const std::string & name() const
Definition: methodproxybase.cpp:48
DBUS_CXX_PROPAGATE_CONST(std::unique_ptr< priv_data >) m_priv
void set_interface(InterfaceProxy *proxy)
Definition: methodproxybase.cpp:72
InterfaceProxy * interface_name() const
Definition: methodproxybase.cpp:44
MethodProxyBase(const std::string &name)
Definition: methodproxybase.cpp:28
std::shared_ptr< const ReturnMessage > call(std::shared_ptr< const CallMessage >, int timeout_milliseconds=-1) const
Definition: methodproxybase.cpp:60
std::shared_ptr< CallMessage > create_call_message() const
Definition: methodproxybase.cpp:52
~MethodProxyBase()
Definition: methodproxybase.cpp:41
MethodProxy(const std::string &name)
Definition: methodproxybase.h:130
T_return operator()(T_arg... args)
Definition: methodproxybase.h:134
static std::shared_ptr< MethodProxy > create(const std::string &name)
Definition: methodproxybase.h:166
std::future< T_return > call_async(T_arg... args)
Definition: methodproxybase.h:153
MethodProxy(const std::string &name)
Definition: methodproxybase.h:84
void operator()(T_arg... args)
Definition: methodproxybase.h:88
std::future< void > call_async(T_arg... args)
Definition: methodproxybase.h:103
static std::shared_ptr< MethodProxy > create(const std::string &name)
Definition: methodproxybase.h:116
Definition: interfaceproxy.h:30
Global DBus namespace, where everything happens.
Definition: callmessage.cpp:18
Definition: utility.h:234