HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
UT_COWHandle< Data > Class Template Reference

#include <UT_COW.h>

Public Member Functions

 UT_COWHandle ()
 
 UT_COWHandle (const UT_COWHandle< Data > &src)
 
virtual ~UT_COWHandle ()
 
const UT_COWHandle< Data > & operator= (const UT_COWHandle< Data > &src)
 
void allocate ()
 Calls the default constructor on the object. More...
 
void copy (const Data *src)
 
void steal (Data *src)
 
void resetHandle ()
 
int getRefCount () const
 Returns the number of shared pointer references to the same Data. More...
 

Friends

template<typename OtherData >
class UT_COWReadHandle
 Grant our friends direct access. More...
 
template<typename OtherData >
class UT_COWTransientReadHandle
 
template<typename OtherData >
class UT_COWWriteHandle
 

Detailed Description

template<typename Data>
class UT_COWHandle< Data >

A plain handle is an opaque refernce to the data. You can't read or write to it with this sort of handle, but you can copy and store it. Assign a plain handle into a ReadHandle or a WriteHandle to gain more privelages.

Definition at line 43 of file UT_COW.h.

Constructor & Destructor Documentation

template<typename Data>
UT_COWHandle< Data >::UT_COWHandle ( )
inline

Default constructor creates a null pointer. To assign the pointer:

handle.steal( new Type(...) );

Definition at line 51 of file UT_COW.h.

template<typename Data>
UT_COWHandle< Data >::UT_COWHandle ( const UT_COWHandle< Data > &  src)
inline

Definition at line 56 of file UT_COW.h.

template<typename Data>
virtual UT_COWHandle< Data >::~UT_COWHandle ( )
inlinevirtual

Definition at line 63 of file UT_COW.h.

Member Function Documentation

template<typename Data>
void UT_COWHandle< Data >::allocate ( )
inline

Calls the default constructor on the object.

Definition at line 82 of file UT_COW.h.

template<typename Data>
void UT_COWHandle< Data >::copy ( const Data *  src)
inline

Makes a copy of the source data. This is the safest approach as the caller will retain ownership.

Note
This uses the Data copy constructor.

Definition at line 91 of file UT_COW.h.

template<typename Data>
int UT_COWHandle< Data >::getRefCount ( ) const
inline

Returns the number of shared pointer references to the same Data.

Definition at line 115 of file UT_COW.h.

template<typename Data>
const UT_COWHandle<Data>& UT_COWHandle< Data >::operator= ( const UT_COWHandle< Data > &  src)
inline

Definition at line 69 of file UT_COW.h.

template<typename Data>
void UT_COWHandle< Data >::resetHandle ( )
inline

Turns us into a null pointer, a useful way to end our use of a handle without having to play weird scope games.

Definition at line 108 of file UT_COW.h.

template<typename Data>
void UT_COWHandle< Data >::steal ( Data *  src)
inline

Be careful when initializing using this function. The handle will gain ownership of the provided pointer, so the caller should cease referring to it.

Definition at line 100 of file UT_COW.h.

Friends And Related Function Documentation

template<typename Data>
template<typename OtherData >
friend class UT_COWReadHandle
friend

Grant our friends direct access.

Definition at line 141 of file UT_COW.h.

template<typename Data>
template<typename OtherData >
friend class UT_COWTransientReadHandle
friend

Definition at line 142 of file UT_COW.h.

template<typename Data>
template<typename OtherData >
friend class UT_COWWriteHandle
friend

Definition at line 143 of file UT_COW.h.


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