Rosetta 3.3
Public Types | Public Member Functions | Protected Member Functions | Friends
utility::pointer::ReferenceCount Class Reference

Base class for reference-counted polymorphic classes. More...

#include <ReferenceCount.hh>

Inheritance diagram for utility::pointer::ReferenceCount:
Inheritance graph
[legend]
Collaboration diagram for utility::pointer::ReferenceCount:
Collaboration graph
[legend]

List of all members.

Public Types

typedef platform::Size Size
typedef platform::Size size_type

Public Member Functions

void ctor ()
virtual ~ReferenceCount ()
 Destructor.
Size ref_count () const
 Reference count.

Protected Member Functions

 ReferenceCount ()
 Default constructor.
 ReferenceCount (ReferenceCount const &)
 Copy constructor.
ReferenceCountoperator= (ReferenceCount const &)
 Copy assignment.

Friends

template<typename T >
void owning_ptr_acquire (T *)
 Add a reference to the object acquired by an owning_ptr.
template<typename T >
void owning_ptr_release (T *)
 Remove a reference from the object released by an owning_ptr.

Detailed Description

Base class for reference-counted polymorphic classes.

ReferenceCount is a base class for intrusive reference-counted classes that is designed to work with owning_ptr. A class that inherits from ReferenceCount gets the machinery for shared-ownership management by owning_ptr. Having the root class of a single inheritance hierarchy inherit from ReferenceCount makes all of the classes in its hierarchy compatible with owning_ptr.

ReferenceCount can also be used in a multiple inheritance hierarchy if the root class using virtual inheritance for ReferenceCount (to avoid multiple instances of the counter if the inheritance hierarchy has diamond-shaped inheritance relationships). Because ReferenceCount is not a pure interface class it is not suitable for use in a Decorator pattern hierarchy because multiple copies of the counter would be present: ReferenceCountMI should be used in those situations.


Member Typedef Documentation

Reimplemented in utility::in_place_list< T >.


Constructor & Destructor Documentation

utility::pointer::ReferenceCount::ReferenceCount ( ) [inline, protected]

Default constructor.

utility::pointer::ReferenceCount::ReferenceCount ( ReferenceCount const &  ) [inline, protected]

Copy constructor.

virtual utility::pointer::ReferenceCount::~ReferenceCount ( ) [inline, virtual]

Destructor.


Member Function Documentation

void utility::pointer::ReferenceCount::ctor ( )
ReferenceCount& utility::pointer::ReferenceCount::operator= ( ReferenceCount const &  ) [inline, protected]
Size utility::pointer::ReferenceCount::ref_count ( ) const [inline]

Reference count.


Friends And Related Function Documentation

template<typename T >
void owning_ptr_acquire ( T *  p) [friend]

Add a reference to the object acquired by an owning_ptr.

template<typename T >
void owning_ptr_release ( T *  p) [friend]

Remove a reference from the object released by an owning_ptr.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines