7 #include "underlying_type.hpp" 18 template<
typename T,
typename U>
23 auto parent()
const noexcept {
24 return this->
loop().loop.get();
27 void leak() noexcept {
28 sPtr = this->shared_from_this();
31 void reset() noexcept {
35 bool self()
const noexcept {
36 return static_cast<bool>(sPtr);
40 explicit Resource(ConstructorAccess ca, std::shared_ptr<Loop> ref)
43 std::enable_shared_from_this<T>{}
45 this->
get()->data = static_cast<T*>(
this);
52 template<
typename R =
void>
53 std::shared_ptr<R> data()
const {
54 return std::static_pointer_cast<R>(userData);
61 void data(std::shared_ptr<void> uData) {
62 userData = std::move(uData);
66 std::shared_ptr<void> userData{
nullptr};
67 std::shared_ptr<void> sPtr{
nullptr};
Event emitter base class.
Wrapper class for underlying types.
Common class for almost all the resources available in uvw.
Loop & loop() const noexcept
Gets the loop from which the resource was originated.