Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
roc::core::Optional< T, Size > Class Template Reference

Optionally constructed object. More...

#include <optional.h>

Inheritance diagram for roc::core::Optional< T, Size >:
Collaboration diagram for roc::core::Optional< T, Size >:

Public Member Functions

void reset (T *ptr=NULL)
 Set pointer to the newly created object, destroy old pointed object if set. More...
 
T * get () const
 Get underlying object. More...
 
T * operator-> () const
 Get underlying object. More...
 
T & operator* () const
 Get underlying reference. More...
 
 operator const struct unspecified_bool * () const
 Convert to bool. More...
 
void * unallocated_memory ()
 Get object memory. More...
 

Detailed Description

template<class T, size_t Size = sizeof(T)>
class roc::core::Optional< T, Size >

Optionally constructed object.

Definition at line 25 of file optional.h.

Member Function Documentation

◆ get()

template<class T , size_t Size = sizeof(T)>
T* roc::core::Optional< T, Size >::get ( ) const
inline

Get underlying object.

Definition at line 51 of file optional.h.

◆ operator const struct unspecified_bool *()

template<class T , size_t Size = sizeof(T)>
roc::core::Optional< T, Size >::operator const struct unspecified_bool * ( ) const
inline

Convert to bool.

Definition at line 72 of file optional.h.

◆ operator*()

template<class T , size_t Size = sizeof(T)>
T& roc::core::Optional< T, Size >::operator* ( ) const
inline

Get underlying reference.

Definition at line 64 of file optional.h.

◆ operator->()

template<class T , size_t Size = sizeof(T)>
T* roc::core::Optional< T, Size >::operator-> ( ) const
inline

Get underlying object.

Definition at line 56 of file optional.h.

◆ reset()

template<class T , size_t Size = sizeof(T)>
void roc::core::Optional< T, Size >::reset ( T *  ptr = NULL)
inline

Set pointer to the newly created object, destroy old pointed object if set.

Precondition
ptr should be returned by associated placement new.

Definition at line 40 of file optional.h.

◆ unallocated_memory()

template<class T , size_t Size = sizeof(T)>
void* roc::core::Optional< T, Size >::unallocated_memory ( )
inline

Get object memory.

Precondition
Should be called before object is actually allocated.

Definition at line 79 of file optional.h.


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