rwlogo
Rogue Wave Views 5.6

Rogue Wave Views
Foundation Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

List of all members | Public Member Functions
IlvSmartData Class Reference

Base class for reference counting. More...

#include <ilviews/base/smartptr.h>

Inheritance diagram for IlvSmartData:
IlvObservable IlvActionHistory IlvCommandHistory

Public Member Functions

 IlvSmartData ()
 See below.
 
virtual ~IlvSmartData ()
 Constructors. More...
 
void decrRef ()
 Decrements the reference counter of the object and deletes this object when the counter reaches 0. More...
 
void incrRef ()
 Increments the reference counter.
 
int refCount ()
 Returns the number of references to this object. More...
 

Detailed Description

Base class for reference counting.

Library: views

The class IlvSmartData provides functionality for reference counting and automatic deletion of nonreferenced objects. Objects of classes derived from IlvSmartData should not be explicitly deleted. You should assign these objects a SmartPointer object that will maintain a reference counter to keep track of how many objects are pointing to them. The smart pointer does the following:

Instances of IlvSmartData subclasses can be created statically like all other objects, in which case they are destroyed when they come out of the scope of the current function. Pointers and smart pointers referencing objects that are out-of-scope become invalid as expected. Objects that are created statically are internally differentiated from objects that are created dynamically by setting their initial reference counter to 1 when they are created on the stack, and to 0 when they are created with the new operator.

See Also
IlvSmartPointer.

Constructor & Destructor Documentation

virtual IlvSmartData::~IlvSmartData ( )
virtual

Constructors.

These constructors initialize the reference counter to 0 if the new operator of this class was called before calling the constructor, and to 1 otherwise, to prevent applying the delete operator on objects allocated statically.

Member Function Documentation

void IlvSmartData::decrRef ( )

Decrements the reference counter of the object and deletes this object when the counter reaches 0.

This method and the previous one are usually called by the IlvSmartPointer objects that point to the object. Therefore, you do not have to call it directly, unless you want to override the normal behavior of smart pointers temporarily.

int IlvSmartData::refCount ( )

Returns the number of references to this object.

Returns
The number of references pointing to this object.

© Copyright 2012, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.