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

#include <UT_LockedRawPtr.h>

Public Types

typedef LOCKABLE::Scope LockScopeT
 
typedef T ElementT
 

Public Member Functions

 UT_LockedRawPtr ()
 
 UT_LockedRawPtr (T &ref, LOCKABLE &lock)
 Construct a locked ptr instance. More...
 
 UT_LockedRawPtr (UT_LockedRawPtr &&other)
 
UT_LockedRawPtroperator= (UT_LockedRawPtr &&other)
 
Toperator* () const
 
Toperator-> () const
 
Tget () const
 
SYS_SAFE_BOOL operator bool () const
 

Detailed Description

template<typename T, typename LOCKABLE>
class UT_LockedRawPtr< T, LOCKABLE >

A template class that allows auto-locking in a getter method. This class has pointer semantics and does NOT deal with ownership by design. The pointer that you give it MUST live longer than the lifetime of this class.

EXAMPLE:

class B;
class A
{
/// Obtain a ptr to myB that is locked. When it goes out
/// of scope, it will automatically unlock.
{ return UT_LockedRawPtr<B>(myB, myBLock); }
private:
B myB;
UT_Lock myBLock;
};

Definition at line 40 of file UT_LockedRawPtr.h.

Member Typedef Documentation

template<typename T, typename LOCKABLE>
typedef T UT_LockedRawPtr< T, LOCKABLE >::ElementT

Definition at line 45 of file UT_LockedRawPtr.h.

template<typename T, typename LOCKABLE>
typedef LOCKABLE::Scope UT_LockedRawPtr< T, LOCKABLE >::LockScopeT

Definition at line 44 of file UT_LockedRawPtr.h.

Constructor & Destructor Documentation

template<typename T, typename LOCKABLE>
UT_LockedRawPtr< T, LOCKABLE >::UT_LockedRawPtr ( )
inline

Definition at line 47 of file UT_LockedRawPtr.h.

template<typename T, typename LOCKABLE>
UT_LockedRawPtr< T, LOCKABLE >::UT_LockedRawPtr ( T ref,
LOCKABLE &  lock 
)
inline

Construct a locked ptr instance.

Definition at line 54 of file UT_LockedRawPtr.h.

template<typename T, typename LOCKABLE>
UT_LockedRawPtr< T, LOCKABLE >::UT_LockedRawPtr ( UT_LockedRawPtr< T, LOCKABLE > &&  other)
inline

This class is only movable

Definition at line 62 of file UT_LockedRawPtr.h.

Member Function Documentation

template<typename T, typename LOCKABLE>
T* UT_LockedRawPtr< T, LOCKABLE >::get ( ) const
inline

Pointer semantic accessors

Definition at line 80 of file UT_LockedRawPtr.h.

template<typename T, typename LOCKABLE>
SYS_SAFE_BOOL UT_LockedRawPtr< T, LOCKABLE >::operator bool ( ) const
inline

Pointer semantic accessors

Definition at line 81 of file UT_LockedRawPtr.h.

template<typename T, typename LOCKABLE>
T& UT_LockedRawPtr< T, LOCKABLE >::operator* ( ) const
inline

Pointer semantic accessors

Definition at line 78 of file UT_LockedRawPtr.h.

template<typename T, typename LOCKABLE>
T* UT_LockedRawPtr< T, LOCKABLE >::operator-> ( ) const
inline

Pointer semantic accessors

Definition at line 79 of file UT_LockedRawPtr.h.

template<typename T, typename LOCKABLE>
UT_LockedRawPtr& UT_LockedRawPtr< T, LOCKABLE >::operator= ( UT_LockedRawPtr< T, LOCKABLE > &&  other)
inline

This class is only movable

Definition at line 68 of file UT_LockedRawPtr.h.


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