3 * ***** BEGIN GPL LICENSE BLOCK *****
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software Foundation,
17 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
20 * All rights reserved.
22 * The Original Code is: all of this file.
24 * Contributor(s): none yet.
26 * ***** END GPL LICENSE BLOCK *****
29 * @file MEM_RefCountedC-Api.h
30 * Interface for C access to functionality relating to shared objects in the foundation library.
33 #ifndef _H_MEM_REF_COUNTED_C_API
34 #define _H_MEM_REF_COUNTED_C_API
36 /** A pointer to a private object. */
37 typedef struct MEM_TOpaqueObject* MEM_TObjectPtr;
38 /** A pointer to a shared object. */
39 typedef MEM_TObjectPtr MEM_TRefCountedObjectPtr;
48 * Returns the reference count of this object.
49 * @param shared The object to query.
50 * @return The current reference count.
52 extern int MEM_RefCountedGetRef(MEM_TRefCountedObjectPtr shared);
55 * Increases the reference count of this object.
56 * @param shared The object to query.
57 * @return The new reference count.
59 extern int MEM_RefCountedIncRef(MEM_TRefCountedObjectPtr shared);
62 * Decreases the reference count of this object.
63 * If the the reference count reaches zero, the object self-destructs.
64 * @param shared The object to query.
65 * @return The new reference count.
67 extern int MEM_RefCountedDecRef(MEM_TRefCountedObjectPtr shared);
74 #endif // _H_MEM_REF_COUNTED_C_API