Class: MReferenceCounted

Declaration: ReferenceCounting.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

None.

Inherited By:

TInternalAttributeGroup MReferencedCollectible TCanonicalObject TInternalAttribute TLicenseProvider TLicenseProviderSession TQueryMetaData TQueryMetaDataMap TQueryNode TReferenceCountedWrapper TTelephoneHandset TTelephoneLine TRecord TRecordSource TSQLColumnDescriptor TSQLCommand TSQLConnection TSQLParameter TSQLTableDescriptor TServiceDefinition MSpinFieldState

Purpose:

MReferenceCounted is a mixin class that allows an object to support reference counting. Operators are provided for adding, deleting and counting references to an object and detecting when it is no longer referenced by any other objects.

Instantiation:

Allocate on the heap. DO NOT DELETE MREFERENCECOUNTED OBJECTS. These objects will delete themselves when the reference count goes to zero.

Deriving Classes:

MReferenceCounted is a mixin class that you can use to create your own reference counted class. You can override the Unreachable operator to perform whatever operation you desire for objects that achieve a zero reference count.

Concurrency:

Multithread safe.

Resource Use:

No special requirements.

Other Considerations:

DO NOT DELETE MREFERENCECOUNTED OBJECTS. These objects will delete themselves when the reference count goes to zero.

Member Function: MReferenceCounted::~MReferenceCounted

virtual ~ MReferenceCounted ()

Interface Category:

API.

Purpose:

Destructor.

Calling Context:

Call this function directly to destroy an object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: MReferenceCounted::Unreachable

virtual void Unreachable ()

Interface Category:

API.

Purpose:

Deletes this object.

Calling Context:

Call this function directly when the reference count reaches zero.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

Deriving classes may choose to override this operator to do more sophisticated processing.

Member Function: MReferenceCounted::AddReference

void AddReference ()

Interface Category:

API.

Purpose:

Increments the reference count for this object by one.

Calling Context:

Call this function directly to add a reference to this object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: MReferenceCounted::RemoveReference

void RemoveReference ()

Interface Category:

API.

Purpose:

Decrements the reference count for this object by one. If the reference count is zero after decrementing, the operator Unreachable is called.

Calling Context:

Call this function directly to remove a reference to this object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: MReferenceCounted::GetCount

ReferenceCount GetCount () const

Interface Category:

API.

Purpose:

Returns the number of references to this object.

Calling Context:

Call this function directly to return the number of references to this object.

Parameters:

Return Value:

The number of references to this object.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: MReferenceCounted::MReferenceCounted

  1. MReferenceCounted (ReferenceCount initial =0)
  2. MReferenceCounted (const MReferenceCounted &)

Interface Category:

API.

Purpose:

  1. Creates an object with the specified reference count.
  2. Copy constructor.

Calling Context:

  1. Call this function directly to create an object with the specified reference count.
  2. Call this function directly to copy an object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: MReferenceCounted::operator=

MReferenceCounted & operator =(const MReferenceCounted &)

Interface Category:

API.

Purpose:

Assignment operator.

Calling Context:

Call this function directly when an object is assigned to another compatible object.

Parameters:

Return Value:

A reference to the left-hand side object.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.