Rosetta Utilities  2014.35
Public Types | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
utility::pointer::ReferenceCount Class Reference

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

#include <ReferenceCount.hh>

Public Types

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

Public Member Functions

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

Protected Member Functions

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

Private Member Functions

void add_ref () const
 Add a reference: Increment the count. More...
 
void remove_ref () const
 Remove a reference: Decrement the count: Self-destruct if count hits zero. More...
 

Private Attributes

Size count_
 Reference count. More...
 

Static Private Attributes

static Size const max_count_ = static_cast< ReferenceCount::Size >( -1 )
 Max count. More...
 

Friends

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

Detailed Description

Base class for reference-counted polymorphic classes.

Member Typedef Documentation

Constructor & Destructor Documentation

utility::pointer::ReferenceCount::ReferenceCount ( )
inlineprotected

Default constructor.

utility::pointer::ReferenceCount::ReferenceCount ( ReferenceCount const &  )
inlineprotected

Copy constructor.

virtual utility::pointer::ReferenceCount::~ReferenceCount ( )
inlinevirtual

Destructor.

References count_.

Member Function Documentation

void utility::pointer::ReferenceCount::add_ref ( ) const
inlineprivate

Add a reference: Increment the count.

References count_, and max_count_.

void utility::pointer::ReferenceCount::ctor ( )
ReferenceCount& utility::pointer::ReferenceCount::operator= ( ReferenceCount const &  )
inlineprotected
Size utility::pointer::ReferenceCount::ref_count ( ) const
inline

Reference count.

References count_.

void utility::pointer::ReferenceCount::remove_ref ( ) const
inlineprivate

Remove a reference: Decrement the count: Self-destruct if count hits zero.

References 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.

Member Data Documentation

Size utility::pointer::ReferenceCount::count_
mutableprivate

Reference count.

Note
Identity semantics: Not copied or assigned

Referenced by add_ref(), ref_count(), remove_ref(), and ~ReferenceCount().

ReferenceCount::Size const utility::pointer::ReferenceCount::max_count_ = static_cast< ReferenceCount::Size >( -1 )
staticprivate

Max count.

ReferenceCount static member definitions.

Referenced by add_ref().


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