inkcpp
Loading...
Searching...
No Matches
ink::runtime::story_ptr< T > Class Template Reference

Pointer wrapper to an object whose lifetime is tied to a story object. More...

#include <story_ptr.h>

Inherits ink::runtime::internal::story_ptr_base.

Public Member Functions

 story_ptr (T *ptr)
 pointer constructor.
 
 story_ptr (const story_ptr< T > &oth)
 copy constructor
 
story_ptr< T > & operator= (const story_ptr< T > &oth)
 copy assigment operator
 
template<typename U >
story_ptr< U > cast ()
 pointer cast while keeping ref count
 
bool operator== (const story_ptr< T > &other)
 implement operator==
 
bool is_valid () const
 checks if optional contains a value
 
 operator bool () const
 auto cast to bool with value from is_valid()
 
T * get ()
 access value as ptr
 
const T * get () const
 access value as ptr
 
T * operator-> ()
 implement operator->
 
const T * operator-> () const
 implement operator->
 
T & operator* ()
 implement operator*
 
const T & operator* () const
 implement operator*
 

Detailed Description

template<typename T>
class ink::runtime::story_ptr< T >

Pointer wrapper to an object whose lifetime is tied to a story object.

A shared pointer whose lifetime is also tied to the lifetime of the parent story object. The referenced object will live until either 1) There are no more story_ptr's pointing to this object 2) The story object which owns this object dies

See also
story_interface
runner_interface
globals_interface

Constructor & Destructor Documentation

◆ story_ptr() [1/2]

template<typename T >
ink::runtime::story_ptr< T >::story_ptr ( T * ptr)
inline

pointer constructor.

for nullptr only.

Parameters
ptrwill be ignored, should be nullptr

◆ story_ptr() [2/2]

template<typename T >
ink::runtime::story_ptr< T >::story_ptr ( const story_ptr< T > & oth)

copy constructor

Parameters
oth

Member Function Documentation

◆ cast()

template<typename T >
template<typename U >
story_ptr< U > ink::runtime::story_ptr< T >::cast ( )
inline

pointer cast while keeping ref count

Template Parameters
Unew pointer type, valid cast form T to U must be available

◆ get() [1/2]

template<typename T >
T * ink::runtime::story_ptr< T >::get ( )
inline

access value as ptr

Return values
nullptrif value is not valid

◆ get() [2/2]

template<typename T >
const T * ink::runtime::story_ptr< T >::get ( ) const
inline

access value as ptr

Return values
nullptrif value is not valid

◆ operator=()

template<typename T >
story_ptr< T > & ink::runtime::story_ptr< T >::operator= ( const story_ptr< T > & oth)

copy assigment operator

Parameters
oth

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