TObject Class Reference

The class from which all other objects in Toten are derived from. More...

#import <tobject.h>

Inheritance diagram for TObject:

TCharacter TCharacterClass TItem TSkillSet TConsumable TWeapon TDrink TFood TAlcohol TDrug List of all members.

Public Member Functions

(id) - init
(id) - free
(int) - grab
 Increases the reference count of the object by one.
(int) - release
 Decreases the reference count of the object by one.
(int) - get_refcount
 Returns the current reference count of this object.
(int) - get_id
 Returns the unique ID of this Object.

Protected Attributes

unsigned int ID
 Unique ID assigned at creation.
int refcount
 The current reference count of the object.

Detailed Description

The class from which all other objects in Toten are derived from.

TObject implements reference counting for objects. It is recommended that only these methods be used for memory management on TObject classes and its derivatives.

All TObject classes and its derivatives manage their own memory. For example, if you pass it a character pointer, you can free it independent of the class as it makes its own copy and frees it as it needs to. Note that in get methods the pointer returned is NOT A COPY, SO YOU MAY NOT FREE IT!

Definition at line 37 of file tobject.h.


Member Function Documentation

- (int) grab  
 

Increases the reference count of the object by one.

Returns the new count.

Definition at line 45 of file tobject.m.

References refcount.

- (int) release  
 

Decreases the reference count of the object by one.

Returns the new count.

Definition at line 50 of file tobject.m.

References free, and refcount.

Referenced by TCharacter::free.


The documentation for this class was generated from the following files:
Generated on Wed Dec 21 13:16:08 2005 for Toten by  doxygen 1.4.5 SourceForge.net Logo