refactor: rename request_slot tag to return_slot

This commit is contained in:
Stanislav Angelovic
2024-04-24 20:20:29 +02:00
committed by Stanislav Angelovič
parent 84932a6985
commit dc0c2562b8
15 changed files with 31 additions and 31 deletions
+2 -2
View File
@@ -53,7 +53,7 @@ namespace sdbus {
public:
VTableAdder(IObject& object, std::vector<VTableItem> vtable);
void forInterface(std::string interfaceName);
[[nodiscard]] Slot forInterface(std::string interfaceName, request_slot_t);
[[nodiscard]] Slot forInterface(std::string interfaceName, return_slot_t);
private:
IObject& object_;
@@ -129,7 +129,7 @@ namespace sdbus {
SignalSubscriber(IProxy& proxy, const std::string& signalName);
SignalSubscriber& onInterface(std::string interfaceName);
template <typename _Function> void call(_Function&& callback);
template <typename _Function> [[nodiscard]] Slot call(_Function&& callback, request_slot_t);
template <typename _Function> [[nodiscard]] Slot call(_Function&& callback, return_slot_t);
private:
template <typename _Function> signal_handler makeSignalHandler(_Function&& callback);
+4 -4
View File
@@ -57,9 +57,9 @@ namespace sdbus {
object_.addVTable(std::move(interfaceName), std::move(vtable_));
}
inline Slot VTableAdder::forInterface(std::string interfaceName, request_slot_t)
inline Slot VTableAdder::forInterface(std::string interfaceName, return_slot_t)
{
return object_.addVTable(std::move(interfaceName), std::move(vtable_), request_slot);
return object_.addVTable(std::move(interfaceName), std::move(vtable_), return_slot);
}
/*** ------------- ***/
@@ -311,14 +311,14 @@ namespace sdbus {
}
template <typename _Function>
inline Slot SignalSubscriber::call(_Function&& callback, request_slot_t)
inline Slot SignalSubscriber::call(_Function&& callback, return_slot_t)
{
assert(!interfaceName_.empty()); // onInterface() must be placed/called prior to this function
return proxy_.registerSignalHandler( interfaceName_
, signalName_
, makeSignalHandler(std::forward<_Function>(callback))
, request_slot );
, return_slot );
}
template <typename _Function>
+1 -1
View File
@@ -140,7 +140,7 @@ namespace sdbus {
*
* @throws sdbus::Error in case of failure
*/
virtual Slot addVTable(std::string interfaceName, std::vector<VTableItem> vtable, request_slot_t) = 0;
virtual Slot addVTable(std::string interfaceName, std::vector<VTableItem> vtable, return_slot_t) = 0;
/*!
* @brief A little more convenient overload of addVTable() above
+1 -1
View File
@@ -224,7 +224,7 @@ namespace sdbus {
[[nodiscard]] virtual Slot registerSignalHandler( const std::string& interfaceName
, const std::string& signalName
, signal_handler signalHandler
, request_slot_t ) = 0;
, return_slot_t ) = 0;
/*!
* @brief Unregisters proxy's signal handlers and stops receiving replies to pending async calls
+3 -3
View File
@@ -73,9 +73,9 @@ namespace sdbus {
// Type-erased RAII-style handle to callbacks/subscriptions registered to sdbus-c++
using Slot = std::unique_ptr<void, std::function<void(void*)>>;
// Tag specifying that an owning slot handle shall be returned from the function
struct request_slot_t { explicit request_slot_t() = default; };
inline constexpr request_slot_t request_slot{};
// Tag specifying that an owning slot handle shall be returned from a registration/subscription function to the caller
struct return_slot_t { explicit return_slot_t() = default; };
inline constexpr return_slot_t return_slot{};
// Tag specifying that the library shall own the slot resulting from the call of the function (so-called floating slot)
struct floating_slot_t { explicit floating_slot_t() = default; };
inline constexpr floating_slot_t floating_slot{};