Public Member Functions | Protected Member Functions | List of all members
RefCounted< Base > Class Template Reference

Template to simplify the task of writing a class that implements the reference-counting pattern. More...

#include <RefCounted.h>

Inheritance diagram for RefCounted< Base >:

Public Member Functions

void * operator new (size_t size)
 
void operator delete (void *rawMemory, size_t size)
 
UInt32 AddRef () const
 
UInt32 Release () const
 
 RefCounted ()
 
 RefCounted (RefCounted const &rhs)
 
RefCountedoperator= (RefCounted const &rhs)
 
UInt32 GetRefCount () const
 

Protected Member Functions

virtual ~RefCounted ()
 

Detailed Description

template<class Base>
class Bentley::RefCounted< Base >

Template to simplify the task of writing a class that implements the reference-counting pattern.

This template contains a complete implementation of the reference-counting pattern. If a class inherits from an instantiation of this template, the class inherits that implementation and becomes reference-counted. Example:

struct MyClass : RefCounted<IRefCounted> {...};

Or, RefCounted can be used to define a class that implements some interface, where that interface inherits from IRefCounted. For example:

struct ISomeInterface : IRefCounted {...};
struct MyClass : RefCounted<ISomeInterface> {...};

Constructor & Destructor Documentation

virtual ~RefCounted ( )
protectedvirtual
RefCounted ( RefCounted< Base > const &  rhs)

Member Function Documentation

UInt32 AddRef ( ) const
UInt32 GetRefCount ( ) const
void operator delete ( void *  rawMemory,
size_t  size 
)
void* operator new ( size_t  size)
RefCounted& operator= ( RefCounted< Base > const &  rhs)
UInt32 Release ( ) const

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

Copyright © 2017 Bentley Systems, Incorporated. All rights reserved.