nx_metadata_sdk 1.0 Metadata SDK

Public Member Functions | List of all members
nx::sdk::RefCountableHolder Class Reference

`#include <ref_countable.h>`

## Public Member Functions
| RefCountableHolder (const RefCountableHolder &)=delete
RefCountableHolder & | operator= (const RefCountableHolder &)=delete
| RefCountableHolder (RefCountableHolder &&)=delete
RefCountableHolder & | operator= (RefCountableHolder &&)=delete
| RefCountableHolder (const IRefCountable *refCountable)
| RefCountableHolder (const RefCountableHolder *delegate)
int | addRef () const
int | releaseRef () const
int | refCount () const

## Detailed Description

Not recommended to be used directly - use RefCountable, unless there is some special case.

Implements IRefCountable reference counting. Can delegate reference counting to another RefCountableHolder instance.

Does not inherit IRefCountable because it would need to be a virtual base class.

The instance is supposed to be nested into a ref-countable object, explicitly calling addRef() and releaseRef() from the respective methods of that ref-countable class.

## Constructor & Destructor Documentation

## ◆ RefCountableHolder() [1/2]

nx::sdk::RefCountableHolder::RefCountableHolder | ( | const IRefCountable * | refCountable | ) |
| inline

Takes ownership of the given object - it will be deleted when the reference counter reaches zero.

NOTE: After creation, the reference counter is 1.

## ◆ RefCountableHolder() [2/2]

nx::sdk::RefCountableHolder::RefCountableHolder | ( | const RefCountableHolder * | delegate | ) |
| inline

Delegates reference counting to another object. Does not change the reference counter.

## Member Function Documentation

## ◆ releaseRef()

int nx::sdk::RefCountableHolder::releaseRef | ( |  | ) | const
| inline

NOTE: Deletes the owned object if the reference counter reaches zero.

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

- src/nx/sdk/helpers/ref_countable.h