class RefObject

A reference counted object. More...

Full nameTelEngine::RefObject
Definition#include <telengine.h>
InheritsTelEngine::GenObject [public ]
Inherited byDataConsumer, DataEndpoint, DataNode, DataSource, DataTranslator, ThreadedSource
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods


Detailed Description

A reference counted object. Whenever using multiple inheritance you should inherit this class virtually.

 RefObject ()

RefObject

The constructor initializes the reference counter to 1! Use deref() to destruct the object when safe

 ~RefObject ()

~RefObject

[virtual]

Destructor.

int  ref ()

ref

Increments the reference counter

Returns: The new reference count

bool  deref ()

deref

Decrements the reference counter, destroys the object if it reaches zero


 // Deref this object, return quickly if the object was deleted
 if (deref()) return;

Returns: True if the object was deleted, false if it still exists

inline int  refcount ()

refcount

[const]

Get the current value of the reference counter

Returns: The value of the reference counter

void  destruct ()

destruct

[virtual]

Refcounted objects should just have the counter decremented. That will destroy them only when the refcount reaches zero.

Reimplemented from GenObject.


Generated by: kk on nyx on Sat Jun 4 19:29:41 2005, using kdoc 2.0a54.