All Classes Namespaces Functions Variables Typedefs Enumerations Friends
component.h
1 
5 #pragma once
6 
7 #include <memory>
8 
9 namespace ucxx {
10 
17 class Component : public std::enable_shared_from_this<Component> {
18  protected:
19  std::shared_ptr<Component> _parent{nullptr};
20 
21  public:
22  virtual ~Component();
23 
31  void setParent(std::shared_ptr<Component> parent);
32 
40  [[nodiscard]] std::shared_ptr<Component> getParent() const;
41 };
42 
43 } // namespace ucxx
A UCXX component class to prevent early destruction of parent object.
Definition: component.h:17
void setParent(std::shared_ptr< Component > parent)
Set the internal parent reference.
std::shared_ptr< Component > _parent
A reference-counted pointer to the parent.
Definition: component.h:19
std::shared_ptr< Component > getParent() const
Get the internal parent reference.
Definition: address.h:15