Module: Threads Package: Smart Pointer
RWBodyBase RWTCountingBody<RWMutexLock>
#include <rw/pointer/RWBodyBase.h>
Base class for body classes. Each time an RWHandleBase instance is bound to an instance of this class, the handle instance increments the reference count inherited by the body instance. Each time a handle instance detaches from an instance of this class, the handle decrements the reference count. If the reference count reaches zero, the handle deletes the body instance. The reference counting relieves clients of the burden of having to keep track of when it is safe to delete a body instance.
If the Threads Module is built with the "Handle/Body uses Atomic Count" flag, this class will no longer derive from RWTCountingBody<RWMutexLock>, and will instead use an internal atomic variable for its count. This provides a significant performance boost at the cost of backwards-compatibility due to the inheritance change.
See HandlebodyEx1.cpp and HandlebodyEx2.cpp, located in the Examples directory.
RWBodyBase();
Default constructor. Constructs a default body instance (reference count starts at zero).
RWBodyBase(RWStaticCtor);
Constructs a static body instance (reference count starts at one, to prevent deletion by handles).
RWBodyBase(const RWBodyBase& second);
Copy constructor.
virtual ~RWBodyBase();
Destructor. Throws no exceptions.
RWBodyBase& operator=(const RWBodyBase& second);
Assignment operator. Throws no exceptions.
© Copyright Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave and SourcePro are registered trademarks of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.