xentara-plugin v1.2.1
The Xentara Plugin Framework
Loading...
Searching...
No Matches
xentara::plugin::EnableSharedFromThis< Element > Class Template Reference

A mixin class that enables getting a shared pointer from the this pointer. More...

#include <plugin/EnableSharedFromThis.hpp>

Public Member Functions

constexpr EnableSharedFromThis () noexcept=default
 Default constructor.
 
 EnableSharedFromThis (const EnableSharedFromThis &) noexcept
 Dummy copy constructor that does not copy anything.
 
auto operator= (const EnableSharedFromThis &) noexcept -> EnableSharedFromThis &
 Dummy assignment operator that does nothing.
 
auto sharedFromThis () -> std::shared_ptr< Element >
 Creates a shared pointer for this object.
 
auto sharedFromThis () const -> std::shared_ptr< const Element >
 Creates a constant shared pointer for this object.
 
auto weakFromThis () -> std::weak_ptr< Element >
 Creates a weak pointer for this object.
 
auto weakFromThis () const -> std::weak_ptr< const Element >
 Creates a constant weak pointer for this object.
 

Detailed Description

template<typename Element>
class xentara::plugin::EnableSharedFromThis< Element >

A mixin class that enables getting a shared pointer from the this pointer.

This class is similar to std::enable_shared_from_this, except that it is designed especially for Xentara plugin elements. It works together with xentara::plugin::SharedFactory in the same way as std::enable_shared_from_this workes together with std::make_shared().

Constructor & Destructor Documentation

◆ EnableSharedFromThis() [1/2]

template<typename Element >
constexpr xentara::plugin::EnableSharedFromThis< Element >::EnableSharedFromThis ( )
constexprdefaultnoexcept

Default constructor.

◆ EnableSharedFromThis() [2/2]

template<typename Element >
xentara::plugin::EnableSharedFromThis< Element >::EnableSharedFromThis ( const EnableSharedFromThis< Element > &  )
noexcept

Dummy copy constructor that does not copy anything.

Member Function Documentation

◆ operator=()

template<typename Element >
auto xentara::plugin::EnableSharedFromThis< Element >::operator= ( const EnableSharedFromThis< Element > &  ) -> EnableSharedFromThis&
noexcept

Dummy assignment operator that does nothing.

◆ sharedFromThis() [1/2]

template<typename Element >
auto xentara::plugin::EnableSharedFromThis< Element >::sharedFromThis ( ) -> std::shared_ptr<Element>

Creates a shared pointer for this object.

◆ sharedFromThis() [2/2]

template<typename Element >
auto xentara::plugin::EnableSharedFromThis< Element >::sharedFromThis ( ) const -> std::shared_ptr<const Element>

Creates a constant shared pointer for this object.

◆ weakFromThis() [1/2]

template<typename Element >
auto xentara::plugin::EnableSharedFromThis< Element >::weakFromThis ( ) -> std::weak_ptr<Element>

Creates a weak pointer for this object.

◆ weakFromThis() [2/2]

template<typename Element >
auto xentara::plugin::EnableSharedFromThis< Element >::weakFromThis ( ) const -> std::weak_ptr<const Element>

Creates a constant weak pointer for this object.