Public Member Functions | Static Public Member Functions | Protected Member Functions

hamcast::ref_counted Class Reference

This class implements intrusive reference counting to use derived classes in a boost::intrusive_ptr. More...

#include <ref_counted.hpp>

Inheritance diagram for hamcast::ref_counted:
hamcast::ipc::channel hamcast::ipc::message hamcast::util::closeable hamcast::ipc::client_channel hamcast::util::sink hamcast::util::source hamcast::util::buffered_sink< block_size, maximum_size > hamcast::util::write_buffer< block_size, maximum_size > hamcast::util::buffered_source< block_size, maximum_size > hamcast::util::read_buffer

List of all members.

Public Member Functions

long ref_count ()

Static Public Member Functions

static void add_ref (ref_counted *rc)
static void release (ref_counted *rc)

Protected Member Functions

 ref_counted ()
void ref ()
bool deref ()

Detailed Description

This class implements intrusive reference counting to use derived classes in a boost::intrusive_ptr.


Constructor & Destructor Documentation

hamcast::ref_counted::ref_counted (  )  [protected]

Initializes the reference count with 0.


Member Function Documentation

static void hamcast::ref_counted::add_ref ( ref_counted rc  )  [static]

Convenience function that increments the reference count of rc.

Equal to if (rc) rc->ref();

Parameters:
rc A native pointer to a reference counted object.
bool hamcast::ref_counted::deref (  )  [protected]

Atomically decrement the reference count.

Returns:
true if there are still references to this object; otherwise false.
void hamcast::ref_counted::ref (  )  [protected]

Atomically increment the reference count.

long hamcast::ref_counted::ref_count (  ) 

Get the current reference count.

Returns:
The current reference count as long.
static void hamcast::ref_counted::release ( ref_counted rc  )  [static]

Convenience function that decrements the reference count of rc and deletes rc if needed.

Equal to if (rc && !rc->deref()) delete rc;

Parameters:
rc A native pointer to a reference counted object.

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