refactor: add Async suffix to async callMethod functions (#394)

This makes naming consistent, so all asynchronously working functions have Async suffix
This commit is contained in:
Stanislav Angelovič
2024-04-24 20:20:29 +02:00
parent b65461c404
commit 1c72f1ce52
5 changed files with 31 additions and 23 deletions
+1 -1
View File
@@ -257,7 +257,7 @@ namespace sdbus {
sdbus::apply(callback, error, args);
};
return proxy_.callMethod(method_, std::move(asyncReplyHandler), timeout_);
return proxy_.callMethodAsync(method_, std::move(asyncReplyHandler), timeout_);
}
template <typename... _Args>
+21 -13
View File
@@ -135,13 +135,17 @@ namespace sdbus {
*
* @throws sdbus::Error in case of failure
*/
virtual PendingAsyncCall callMethod(const MethodCall& message, async_reply_handler asyncReplyCallback, uint64_t timeout = 0) = 0;
virtual PendingAsyncCall callMethodAsync( const MethodCall& message
, async_reply_handler asyncReplyCallback
, uint64_t timeout = 0 ) = 0;
/*!
* @copydoc IProxy::callMethod(const MethodCall&,async_reply_handler,uint64_t)
*/
template <typename _Rep, typename _Period>
PendingAsyncCall callMethod(const MethodCall& message, async_reply_handler asyncReplyCallback, const std::chrono::duration<_Rep, _Period>& timeout);
PendingAsyncCall callMethodAsync( const MethodCall& message
, async_reply_handler asyncReplyCallback
, const std::chrono::duration<_Rep, _Period>& timeout );
/*!
* @brief Calls method on the D-Bus object asynchronously
@@ -160,7 +164,7 @@ namespace sdbus {
*
* @throws sdbus::Error in case of failure
*/
virtual std::future<MethodReply> callMethod(const MethodCall& message, with_future_t) = 0;
virtual std::future<MethodReply> callMethodAsync(const MethodCall& message, with_future_t) = 0;
/*!
* @brief Calls method on the D-Bus object asynchronously, with custom timeout
@@ -180,15 +184,17 @@ namespace sdbus {
*
* @throws sdbus::Error in case of failure
*/
virtual std::future<MethodReply> callMethod(const MethodCall& message, uint64_t timeout, with_future_t) = 0;
virtual std::future<MethodReply> callMethodAsync( const MethodCall& message
, uint64_t timeout
, with_future_t ) = 0;
/*!
* @copydoc IProxy::callMethod(const MethodCall&,uint64_t,with_future_t)
*/
template <typename _Rep, typename _Period>
std::future<MethodReply> callMethod( const MethodCall& message
, const std::chrono::duration<_Rep, _Period>& timeout
, with_future_t );
std::future<MethodReply> callMethodAsync( const MethodCall& message
, const std::chrono::duration<_Rep, _Period>& timeout
, with_future_t );
/*!
* @brief Registers a handler for the desired signal emitted by the D-Bus object
@@ -501,19 +507,21 @@ namespace sdbus {
}
template <typename _Rep, typename _Period>
inline PendingAsyncCall IProxy::callMethod(const MethodCall& message, async_reply_handler asyncReplyCallback, const std::chrono::duration<_Rep, _Period>& timeout)
inline PendingAsyncCall IProxy::callMethodAsync( const MethodCall& message
, async_reply_handler asyncReplyCallback
, const std::chrono::duration<_Rep, _Period>& timeout )
{
auto microsecs = std::chrono::duration_cast<std::chrono::microseconds>(timeout);
return callMethod(message, std::move(asyncReplyCallback), microsecs.count());
return callMethodAsync(message, std::move(asyncReplyCallback), microsecs.count());
}
template <typename _Rep, typename _Period>
inline std::future<MethodReply> IProxy::callMethod( const MethodCall& message
, const std::chrono::duration<_Rep, _Period>& timeout
, with_future_t )
inline std::future<MethodReply> IProxy::callMethodAsync( const MethodCall& message
, const std::chrono::duration<_Rep, _Period>& timeout
, with_future_t )
{
auto microsecs = std::chrono::duration_cast<std::chrono::microseconds>(timeout);
return callMethod(message, microsecs.count(), with_future);
return callMethodAsync(message, microsecs.count(), with_future);
}
inline MethodInvoker IProxy::callMethod(const std::string& methodName)