|
template<typename TDestinationObject > |
RefPtr< TDestinationObject > | as () const noexcept |
| Creates a new reference to the object using the specified interface. More...
|
|
TObject * | detach () noexcept |
| Returns the pointed-to object and releases ownership over its reference. More...
|
|
TObject * | get () const noexcept |
| Returns the pointed-to object. More...
|
|
| operator bool () const noexcept |
| Returns true if this RefPtr points to a non-null object.
|
|
bool | operator!= (const RefPtr< TObject > &other) const noexcept |
| Compares reference pointers for underlying inequality.
|
|
bool | operator!= (const TObject *pOther) const noexcept |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
|
TObject & | operator* () const noexcept |
| Dereferences this RefPtr. More...
|
|
TObject * | operator-> () const noexcept |
| Dereferences this RefPtr. More...
|
|
RefPtr & | operator= (const RefPtr ©From) noexcept |
| Reassigns this RefPtr to point to a new object. More...
|
|
RefPtr & | operator= (RefPtr &&moveFrom) noexcept |
| Reassigns this RefPtr to point to a new object. More...
|
|
RefPtr & | operator= (std::nullptr_t) noexcept |
| Reassigns this RefPtr to point to nullptr. More...
|
|
bool | operator== (const RefPtr< TObject > &other) const noexcept |
| Compares reference pointers for underlying equality.
|
|
bool | operator== (const TObject *pOther) const noexcept |
| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
|
|
OutputWrapper | put () &noexcept |
| Returns an expression proxy that acts like a TObject** for receiving new pointers. More...
|
|
GenericOutputWrapper | put_refobject () &noexcept |
| Returns an expression proxy that acts like an IRefObject** for receiving new pointers. More...
|
|
| RefPtr () noexcept |
| Initializes a RefPtr pointing to nullptr.
|
|
| RefPtr (const RefPtr ©From) noexcept |
| Initializes a new RefPtr pointing to a preexisting RefPtr-tracked object. More...
|
|
| RefPtr (RefPtr &&moveFrom) noexcept |
| Initializes a new RefPtr pointing to a preexisting RefPtr-tracked object. More...
|
|
| ~RefPtr () |
| Releases the reference to the tracked object.
|
|
template<typename TObject>
class nvneural::RefPtr< TObject >
Intrusive pointer using IRefObject's reference counting system.
This should be your default representation of IRefObject pointers, though raw pointers may still be necessary to avoid reference cycles. Use caution when operating on raw IRefObject pointers and ensure refcounts stay consistent.
- Template Parameters
-
TObject | An interface class deriving from IRefObject |
template<typename TObject >
Returns the pointed-to object and releases ownership over its reference.
This function is useful when handing responsibility for the pointed-to data over to a different scope. The primary example here of such use cases is factory functions; the new data is valid, and should have refcount 1 so that the object can be freed once the callee is finished with it.
Because this mutates the RefPtr, this operation is not considered const.
- Returns
- The raw pointer tracked by this object
template<typename TObject >
Initializes a RefPtr pointing to a specific object.
Adds a reference to that object. You should use this function when the object existed previously and you want to ensure it remains valid. Do not use this function when creating objects directly, as it will lead to a reference leak. (Newly created objects have refcount 1, and this function adds another reference.)
- Parameters
-
pObject | Object to track in this RefPtr |