(C) 1998 AROS - The Amiga Research OS


NAME
#include <intuition/classes.h>
#include <proto/boopsi.h>

BOOL FreeClass (classPtr)

LOCATION
In BOOPSIBase at offset 8

SYNOPSIS
struct IClass * classPtr

FUNCTION
Only for class implementatores.

Tries to free a class which has been created with MakeClass() in the first place. This will not succeed in all cases: Classes which still have living objects or which are still beeing used by subclasses can't simply be freed. In this case this call will fail.

Public classes will always be removed with RemoveClass() no matter if FreeClass() would succeed or not. This gurantees that after the call to FreeClass() no new objects can be created.

If you have a pointer to allocated memory in cl_UserData, you must make a copy of that pointer, call FreeClass() and if the call succeeded, you may free the memory. If you don't follow these rules, you might end up with a class which is partially freed.

INPUTS
classPtr
The pointer you got from MakeClass().

RESULT
FALSE if the class couldn't be freed at this time. This can happen either if there are still objects from this class or if the class is used a SuperClass of at least another class.

TRUE if the class could be freed. You must not use classPtr after that.

EXAMPLE
// Free a public class with dynamic memory in cl_UserD

int freeMyClass (Class * cl)
{
    struct MyPerClassData * mpcd;

    mpcd = (struct MyPerClassData *)cl->cl_UserData;

    if (FreeClass (cl)
    {
	FreeMem (mpcd, sizeof (struct MyPerClassData));
	return (TRUE);
    }

    return (FALSE);
}
SEE ALSO

NOTES
*Always* calls RemoveClass().

BUGS

INTERNALS
MakeClass(), "Basic Object-Oriented Programming System for Intuition" and "boopsi Class Reference" Dokument.

HISTORY
20.10.1998 hkiel
Amiga Research OS
23.10.1997 digulla
Added files from iaint