ACE  6.0.6
Public Member Functions | Static Public Member Functions | Public Attributes | Static Private Member Functions | Private Attributes
ACE_Bound_Ptr_Counter Class Reference

An ACE_Bound_Ptr_Counter<ACE_LOCK> object encapsulates an object reference count. More...

#include <Bound_Ptr.h>

List of all members.

Public Member Functions

 ACE_Bound_Ptr_Counter (long init_obj_ref_count=0)
 ~ACE_Bound_Ptr_Counter (void)

Static Public Member Functions

static ACE_Bound_Ptr_Counter
< ACE_LOCK > * 
create_strong (void)
static long attach_strong (ACE_Bound_Ptr_Counter< ACE_LOCK > *counter)
static long detach_strong (ACE_Bound_Ptr_Counter< ACE_LOCK > *counter)
static ACE_Bound_Ptr_Counter
< ACE_LOCK > * 
create_weak (void)
static void attach_weak (ACE_Bound_Ptr_Counter< ACE_LOCK > *counter)
 Increase the counter reference count and return argument.
static void detach_weak (ACE_Bound_Ptr_Counter< ACE_LOCK > *counter)
static bool object_was_deleted (ACE_Bound_Ptr_Counter< ACE_LOCK > *counter)
 Determine whether the object has been deleted.

Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks.

Static Private Member Functions

static ACE_Bound_Ptr_Counter
< ACE_LOCK > * 
internal_create (long init_obj_ref_count)

Private Attributes

long obj_ref_count_
long self_ref_count_
 Reference count of this counter.
ACE_LOCK lock_
 Mutex variable to synchronize access to the reference counts.

Detailed Description

An ACE_Bound_Ptr_Counter<ACE_LOCK> object encapsulates an object reference count.

Do not use this class directly, use ACE_Strong_Bound_Ptr or ACE_Weak_Bound_Ptr instead.


Constructor & Destructor Documentation

ACE_Bound_Ptr_Counter::ACE_Bound_Ptr_Counter ( long  init_obj_ref_count = 0) [inline]
ACE_Bound_Ptr_Counter::~ACE_Bound_Ptr_Counter ( void  ) [inline]

Member Function Documentation

long ACE_Bound_Ptr_Counter::attach_strong ( ACE_Bound_Ptr_Counter< ACE_LOCK > *  counter) [inline, static]

Increase both the object and counter reference counts and return the new object reference count. A return value of -1 indicates that the object has already been destroyed.

void ACE_Bound_Ptr_Counter::attach_weak ( ACE_Bound_Ptr_Counter< ACE_LOCK > *  counter) [inline, static]

Increase the counter reference count and return argument.

ACE_Bound_Ptr_Counter< ACE_LOCK > * ACE_Bound_Ptr_Counter::create_strong ( void  ) [inline, static]

Create a ACE_Bound_Ptr_Counter<ACE_LOCK> and initialize the reference count to indicate ownership by a strong pointer.

ACE_Bound_Ptr_Counter< ACE_LOCK > * ACE_Bound_Ptr_Counter::create_weak ( void  ) [inline, static]

Create a ACE_Bound_Ptr_Counter<ACE_LOCK> and initialize the reference count to indicate no ownership.

long ACE_Bound_Ptr_Counter::detach_strong ( ACE_Bound_Ptr_Counter< ACE_LOCK > *  counter) [inline, static]

Decreases both the object and counter reference counts and deletes whichever has no more references. Returns the new object reference count.

void ACE_Bound_Ptr_Counter::detach_weak ( ACE_Bound_Ptr_Counter< ACE_LOCK > *  counter) [inline, static]

Decreases the counter reference count and deletes the counter if it has no more references.

ACE_Bound_Ptr_Counter< ACE_LOCK > * ACE_Bound_Ptr_Counter::internal_create ( long  init_obj_ref_count) [inline, static, private]

Allocate a new ACE_Bound_Ptr_Counter<ACE_LOCK> instance, returning NULL if it cannot be created.

bool ACE_Bound_Ptr_Counter::object_was_deleted ( ACE_Bound_Ptr_Counter< ACE_LOCK > *  counter) [inline, static]

Determine whether the object has been deleted.


Member Data Documentation

Declare the dynamic allocation hooks.

ACE_LOCK ACE_Bound_Ptr_Counter::lock_ [private]

Mutex variable to synchronize access to the reference counts.

Reference count of underlying object. Is set to -1 once the object has been destroyed to indicate to all weak pointers that it is no longer valid.

Reference count of this counter.


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