From cef596e908f235461c438d6497115effaf95cbd3 Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Tue, 1 Aug 2017 17:35:59 +0200 Subject: [PATCH] minor changes --- src/uvw/resource.hpp | 12 +++++------- src/uvw/thread.hpp | 3 +-- src/uvw/underlying_type.hpp | 5 ++--- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/uvw/resource.hpp b/src/uvw/resource.hpp index 5c816423..4b6441e6 100644 --- a/src/uvw/resource.hpp +++ b/src/uvw/resource.hpp @@ -13,14 +13,13 @@ namespace uvw { /** * @brief Common class for almost all the resources available in `uvw`. * - * This is the base class for handles and requests.
- * Beyond `UnderlyingType`, it stores a UserData and a self-referencing shared_ptr. + * This is the base class for handles and requests. */ template -class Resource: public UnderlyingType, public Emitter, - public std::enable_shared_from_this { - +class Resource: public UnderlyingType, public Emitter, public std::enable_shared_from_this { protected: + using ConstructorAccess = typename UnderlyingType::ConstructorAccess; + auto parent() const noexcept { return this->loop().loop.get(); } @@ -38,8 +37,7 @@ protected: } public: - explicit Resource(typename UnderlyingType::ConstructorAccess ca, - std::shared_ptr ref) + explicit Resource(ConstructorAccess ca, std::shared_ptr ref) : UnderlyingType{std::move(ca), std::move(ref)}, Emitter{}, std::enable_shared_from_this{} diff --git a/src/uvw/thread.hpp b/src/uvw/thread.hpp index 1339c187..24553d49 100644 --- a/src/uvw/thread.hpp +++ b/src/uvw/thread.hpp @@ -35,8 +35,7 @@ public: using Task = InternalTask; using Type = uv_thread_t; - explicit Thread(ConstructorAccess ca, std::shared_ptr ref, - InternalTask t, std::shared_ptr d = nullptr) noexcept + explicit Thread(ConstructorAccess ca, std::shared_ptr ref, InternalTask t, std::shared_ptr d = nullptr) noexcept : UnderlyingType{std::move(ca), std::move(ref)}, data{std::move(d)}, task{std::move(t)} {} diff --git a/src/uvw/underlying_type.hpp b/src/uvw/underlying_type.hpp index 89f38f67..b2d8756a 100644 --- a/src/uvw/underlying_type.hpp +++ b/src/uvw/underlying_type.hpp @@ -11,10 +11,9 @@ namespace uvw { /** - * @brief Internal `class uvw::UnderlyingType` + * @brief Wrapper class for underlying types. * - * A base resource class to define the `create` method in one place.
- * It mainly acts as a wrapper around a data structure of `libuv`. + * It acts mainly as a wrapper around data structures of the underlying library. */ template class UnderlyingType {