lean cpp library
A lean C++ library providing efficient utility classes for high-performance C++ applications.
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Friends
lean::smart::resource_ptr< Resource, Critical > Class Template Reference

Resource pointer class that performs strong reference counting on the given resource type. More...

#include <resource_ptr.h>

List of all members.

Public Types

enum  bind_reference_t { bind_reference }
 Allows for the binding of existing COM object references on COM pointer construction. More...
typedef Resource resource_type
 Type of the resource stored by this resource pointer.
typedef Resource * value_type
 Type of the pointer stored by this resource pointer.

Public Member Functions

 resource_ptr (resource_type *resource=nullptr)
 Constructs a resource pointer from the given resource.
template<class Resource2 >
 resource_ptr (Resource2 *resource)
 Constructs a resource pointer from the given resource.
 resource_ptr (Resource *resource, bind_reference_t)
 Constructs a resource pointer from the given resource without incrementing its reference count.
 resource_ptr (const resource_ptr &right)
 Constructs a resource pointer from the given resource pointer.
template<class Resource2 , bool Critical2>
 resource_ptr (const resource_ptr< Resource2, Critical2 > &right)
 Constructs a resource pointer from the given resource pointer.
 ~resource_ptr () throw ()
 Destroys the resource pointer.
resource_typeunbind ()
 Unbinds the resource reference held by this resource pointer.
resource_ptr< resource_type, true > transfer ()
 Transfers the resource reference held by this resource pointer to a new resource pointer.
resource_ptroperator= (resource_type *resource)
 Replaces the stored resource with the given resource. [ESA]
resource_ptroperator= (const resource_ptr &right)
 Replaces the stored resource with one stored by the given resource pointer. [ESA]
template<class Resource2 , bool Critical2>
resource_ptroperator= (const resource_ptr< Resource2, Critical2 > &right)
 Replaces the stored resource with one stored by the given resource pointer. [ESA]
LEAN_INLINE resource_type *const & get (void) const
 Gets the resource stored by this resource pointer.
LEAN_INLINE resource_typeoperator* () const
 Gets the resource stored by this resource pointer.
LEAN_INLINE resource_typeoperator-> () const
 Gets the resource stored by this resource pointer.
LEAN_INLINE operator resource_type * () const
 Gets the resource stored by this resource pointer.

Static Public Member Functions

static LEAN_INLINE
resource_ptr< resource_type,
true > 
bind (resource_type *resource)
 Binds the given resource reference to this resource pointer.

Protected Member Functions

template<class Counter , class Allocator >
 resource_ptr (Resource *resource, const ref_counter< Counter, Allocator > &refCounter)
 Constructs a resource pointer from the given resource and reference counter.

Friends

class weak_resource_ptr

Detailed Description

template<class Resource, bool Critical = false>
class lean::smart::resource_ptr< Resource, Critical >

Resource pointer class that performs strong reference counting on the given resource type.


Member Enumeration Documentation

template<class Resource, bool Critical = false>
enum lean::smart::resource_ptr::bind_reference_t

Allows for the binding of existing COM object references on COM pointer construction.

Enumerator:
bind_reference 

Allows for the binding of existing COM object references on COM pointer construction.


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