nx_server_plugin_sdk 1.0 Server Plugin SDK

Public Member Functions | List of all members
nx::sdk::Ptr< RefCountable > Class Template Referencefinal

`#include <ptr.h>`

## Public Member Functions
| Ptr (std::nullptr_t=nullptr)
| Ptr (RefCountable *ptr)
template<class OtherRefCountable >
| Ptr (OtherRefCountable *ptr)
template<class OtherRefCountable >
| Ptr (const Ptr< OtherRefCountable > &other)
| Ptr (const Ptr &other)
template<class OtherRefCountable >
| Ptr (Ptr< OtherRefCountable > &&other)
| Ptr (Ptr &&other) noexcept
template<class OtherRefCountable >
Ptr & | operator= (const Ptr< OtherRefCountable > &other)
Ptr & | operator= (const Ptr &other)
template<class OtherRefCountable >
Ptr & | operator= (Ptr< OtherRefCountable > &&other)
Ptr & | operator= (Ptr &&other) noexcept
template<class OtherRefCountable >
bool | operator== (const Ptr< OtherRefCountable > &other) const
template<class OtherRefCountable >
bool | operator!= (const Ptr< OtherRefCountable > &other) const
void | reset ()
template<class OtherRefCountable >
void | reset (OtherRefCountable *ptr)
RefCountable * | releasePtr ()
RefCountable * | get () const
RefCountable * | operator-> () const
RefCountable & | operator* () const
| operator bool () const

## Detailed Description

### template<class RefCountable>
class nx::sdk::Ptr< RefCountable >

Smart pointer to objects that implement IRefCountable.

Is assignment-compatible with smart pointers to derived classes.

## Constructor & Destructor Documentation

## ◆ Ptr() [1/3]

template<class RefCountable>

nx::sdk::Ptr< RefCountable >::Ptr | ( | std::nullptr_t | = `nullptr` | ) |
| inline

Supports implicit conversion from nullptr.

## ◆ Ptr() [2/3]

template<class RefCountable>

nx::sdk::Ptr< RefCountable >::Ptr | ( | const Ptr< RefCountable > & | other | ) |
| inline

Defined because the template above does not suppress generation of such member.

## ◆ Ptr() [3/3]

template<class RefCountable>

nx::sdk::Ptr< RefCountable >::Ptr | ( | Ptr< RefCountable > && | other | ) |
| inline noexcept

Defined because the template above does not suppress generation of such member.

## Member Function Documentation

## ◆ operator=() [1/2]

template<class RefCountable>

Ptr& nx::sdk::Ptr< RefCountable >::operator= | ( | const Ptr< RefCountable > & | other | ) |
| inline

Defined because the template above does not work for same-type assignment.

## ◆ operator=() [2/2]

template<class RefCountable>

Ptr& nx::sdk::Ptr< RefCountable >::operator= | ( | Ptr< RefCountable > && | other | ) |
| inline noexcept

Defined because the template above does not work for same-type assignment.

## ◆ releasePtr()

template<class RefCountable>

RefCountable* nx::sdk::Ptr< RefCountable >::releasePtr | ( |  | ) |
| inline

Cancels ownership of the object: replaces the stored pointer with null. The reference counter of the object remains intact.

Returns
  Object pointer.

## ◆ reset() [1/2]

template<class RefCountable>

void nx::sdk::Ptr< RefCountable >::reset | ( |  | ) |
| inline

Decrements the reference counter of the owned object (will be deleted if reaches 0), and replaces the stored pointer with null.

## ◆ reset() [2/2]

template<class RefCountable>
template<class OtherRefCountable >

void nx::sdk::Ptr< RefCountable >::reset | ( | OtherRefCountable * | ptr | ) |
| inline

Decrements the reference counter of the owned object (will be deleted if reaches 0), and starts owning the specified object, leaving its reference counter intact.

The documentation for this class was generated from the following file:

- src/nx/sdk/ptr.h