MULTIBODY SIMULATION SOFTWARE - API documentation

chrono::ChShared Class Reference

#include <CHshared.h>

Inheritance diagram for chrono::ChShared:

Inheritance graph
[legend]

List of all members.

Public Member Functions

void AddRef ()
void RemoveRef ()
int ReferenceCount ()


Detailed Description

Base class for shared objects, i.e. objects which must be managed with smart pointers of intrusive type (where the reference counting method is used to understand when to delete the object).

Intrusive smart pointers must call AddRef() each time they reference such kind of object, and call RemoveRef() each time that they do not reference it anymore. When the reference count falls to 0, the object is automatically deleted.


Member Function Documentation

void chrono::ChShared::AddRef (  ) 

Add a reference to this object (tell that someone, in addition to the creator, is using it. For example some pointer is pointing to it... In fact intrusive smart pointers automatically call this when copied.

void chrono::ChShared::RemoveRef (  ) 

Remove a reference to this object (tell that someone who was using it, now is not interested in it anymore). If the reference count drops to zero, the last time RemoveRef() is called, the object is automatically deleted. Also the creator must call this, instead of delete(). In fact intrusive smart pointers automatically call this.

int chrono::ChShared::ReferenceCount (  ) 

Tells how many items are sharing this object, i.e. the reference count.


CHRONO::ENGINE
C++ library for multibody simulation, (C) Alessandro Tasora
This API documentation has been generated on 17 Jul 2009 by Doxygen