HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_COWValue< T > Class Template Reference

#include <UT_COWValue.h>

+ Inheritance diagram for UT_COWValue< T >:

Classes

class  Rep
 

Public Member Functions

 UT_COWValue ()
 
 UT_COWValue (T &&data)
 
template<typename... Args>
 UT_COWValue (std::in_place_t, Args &&...args)
 
UT_COWValueoperator= (const UT_COWValue &other)
 
 UT_COWValue (const UT_COWValue &other)
 
UT_COWValueoperator= (UT_COWValue &&other) noexcept
 
 UT_COWValue (UT_COWValue &&other) noexcept
 
 ~UT_COWValue ()
 
bool isUnique () const
 
bool isImmortal () const
 
exint refCount () const
 
void makeUnique ()
 
Toperator* ()
 
const Toperator* () const
 
Toperator-> ()
 
const Toperator-> () const
 
const Tpeek () const
 
void swap (UT_COWValue< T > &other)
 

Static Public Member Functions

static const UT_COWValue< T > & getStaticEmpty ()
 

Protected Member Functions

void safeIncRef () const
 
void safeDecRef ()
 

Protected Attributes

union {
   const Rep *   myConstRep
 
   Rep *   myRep
 
}; 
 

Detailed Description

template<typename T>
class UT_COWValue< T >

Implements a generic copy on write mechanism for types. There is always a valid object stored within a COWValue – moving from it resets it to a default-constructed T, not a nullptr.

Definition at line 31 of file UT_COWValue.h.

Constructor & Destructor Documentation

template<typename T>
UT_COWValue< T >::UT_COWValue ( )
inline

Definition at line 34 of file UT_COWValue.h.

template<typename T>
UT_COWValue< T >::UT_COWValue ( T &&  data)
inline

Definition at line 35 of file UT_COWValue.h.

template<typename T>
template<typename... Args>
UT_COWValue< T >::UT_COWValue ( std::in_place_t  ,
Args &&...  args 
)
inline

Definition at line 37 of file UT_COWValue.h.

template<typename T>
UT_COWValue< T >::UT_COWValue ( const UT_COWValue< T > &  other)
inline

Definition at line 53 of file UT_COWValue.h.

template<typename T>
UT_COWValue< T >::UT_COWValue ( UT_COWValue< T > &&  other)
inlinenoexcept

Definition at line 72 of file UT_COWValue.h.

template<typename T>
UT_COWValue< T >::~UT_COWValue ( )
inline

Definition at line 78 of file UT_COWValue.h.

Member Function Documentation

template<typename T>
static const UT_COWValue<T>& UT_COWValue< T >::getStaticEmpty ( )
inlinestatic

Return the global static immortal default-constructed UT_COWValue for the type.

Definition at line 138 of file UT_COWValue.h.

template<typename T>
bool UT_COWValue< T >::isImmortal ( ) const
inline

Returns true if this UT_COWValue is referencing the global default-constructed version of T.

Definition at line 85 of file UT_COWValue.h.

template<typename T>
bool UT_COWValue< T >::isUnique ( ) const
inline

Returns true if the data referenced by this UT_COWValue is not shared (i.e. whether accessing it will not create a copy).

Definition at line 82 of file UT_COWValue.h.

template<typename T>
void UT_COWValue< T >::makeUnique ( )
inline

Ensure the data referenced by this UT_COWValue is only referenced by it.

Definition at line 92 of file UT_COWValue.h.

template<typename T>
T& UT_COWValue< T >::operator* ( )
inline

Definition at line 103 of file UT_COWValue.h.

template<typename T>
const T& UT_COWValue< T >::operator* ( ) const
inline

Definition at line 109 of file UT_COWValue.h.

template<typename T>
T* UT_COWValue< T >::operator-> ( )
inline

Definition at line 115 of file UT_COWValue.h.

template<typename T>
const T* UT_COWValue< T >::operator-> ( ) const
inline

Definition at line 121 of file UT_COWValue.h.

template<typename T>
UT_COWValue& UT_COWValue< T >::operator= ( const UT_COWValue< T > &  other)
inline

Definition at line 42 of file UT_COWValue.h.

template<typename T>
UT_COWValue& UT_COWValue< T >::operator= ( UT_COWValue< T > &&  other)
inlinenoexcept

Definition at line 60 of file UT_COWValue.h.

template<typename T>
const T& UT_COWValue< T >::peek ( ) const
inline

Return a const reference to the stored data, even if it's not unique. Never copies.

Definition at line 129 of file UT_COWValue.h.

template<typename T>
exint UT_COWValue< T >::refCount ( ) const
inline

Return the number of UT_COWValues sharing data with us, including us. May return a negative number to indicate an unknown quantity.

Definition at line 88 of file UT_COWValue.h.

template<typename T>
void UT_COWValue< T >::safeDecRef ( )
inlineprotected

Definition at line 240 of file UT_COWValue.h.

template<typename T>
void UT_COWValue< T >::safeIncRef ( ) const
inlineprotected

Definition at line 234 of file UT_COWValue.h.

template<typename T>
void UT_COWValue< T >::swap ( UT_COWValue< T > &  other)
inline

Definition at line 131 of file UT_COWValue.h.

Member Data Documentation

union { ... }
template<typename T>
const Rep* UT_COWValue< T >::myConstRep

Definition at line 250 of file UT_COWValue.h.

template<typename T>
Rep* UT_COWValue< T >::myRep

Definition at line 251 of file UT_COWValue.h.


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