17class Resource:
public UnderlyingType<T, U>,
public Emitter<T>,
public std::enable_shared_from_this<T> {
19 using ConstructorAccess =
typename UnderlyingType<T, U>::ConstructorAccess;
21 auto parent()
const noexcept {
22 return this->
loop().loop.get();
25 void leak()
noexcept {
26 sPtr = this->shared_from_this();
29 void reset()
noexcept {
33 bool self()
const noexcept {
34 return static_cast<bool>(sPtr);
38 explicit Resource(ConstructorAccess ca, std::shared_ptr<Loop> ref)
39 : UnderlyingType<T, U>{ca, std::move(ref)} {
40 this->get()->data =
this;
47 template<
typename R =
void>
48 std::shared_ptr<R>
data()
const {
49 return std::static_pointer_cast<R>(userData);
56 void data(std::shared_ptr<void> uData) {
57 userData = std::move(uData);
61 std::shared_ptr<void> userData{
nullptr};
62 std::shared_ptr<void> sPtr{
nullptr};