tobject.h

00001 /*
00002     toten
00003     Copyright (C) 2004,2005 Toten Developers
00004 
00005     Toten is the legal property of its developers, whose names are
00006     too numerous to list here.  Please refer to the COPYRIGHT file
00007     for the full text of this license and to the AUTHORS file for
00008     the complete list of developers.
00009 
00010     This program is free software; you can redistribute it and/or
00011     modify it under the terms of the GNU Lesser General Public
00012     License as published by the Free Software Foundation; either
00013     version 2.1 of the License, or (at your option) any later version.
00014 
00015     This program is distributed in the hope that it will be useful,
00016     but WITHOUT ANY WARRANTY; without even the implied warranty of
00017     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018     Lesser General Public License for more details.
00019 
00020     You should have received a copy of the GNU Lesser General Public
00021     License along with this program; if not, write to the Free Software
00022     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00023 */
00024 
00025 /**
00026 
00027   The class from which all other objects in Toten are derived from. 
00028 
00029 TObject implements reference counting for objects.  It is recommended that only these methods be used for
00030 memory management on TObject classes and its derivatives.
00031 
00032 All TObject classes and its derivatives manage their own memory. For example, if you pass it
00033 a character pointer, you can free it independent of the class as it makes its own copy and frees it as it needs to.
00034 Note that in get methods the pointer returned is NOT A COPY, SO YOU MAY NOT FREE IT!
00035 */
00036 
00037 @interface TObject : Object
00038 {
00039         @protected
00040         unsigned int ID; /**< Unique ID assigned at creation. */
00041         int refcount; /**< The current reference count of the object. */
00042 }
00043 
00044 - init;
00045 - free;
00046 
00047 - (int)grab; /**< Increases the reference count of the object by one. Returns the new count.*/
00048 - (int)release; /**< Decreases the reference count of the object by one. Returns the new count.*/
00049 - (int)get_refcount; /**< Returns the current reference count of this object. */
00050 - (int)get_id; /**< Returns the unique ID of this Object */
00051 
00052 @end

Generated on Wed Dec 21 13:16:07 2005 for Toten by  doxygen 1.4.5 SourceForge.net Logo