The Assimilation Project
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
proj_classes.c File Reference

Implements a Class system for class hierarchies in 'C'. More...

#include <projectcommon.h>
#include <assimobj.h>
Include dependency graph for proj_classes.c:

Go to the source code of this file.

Macros

#define BADCASTMSG   g_error
 

Functions

FSTATIC void _init_proj_class_module (void)
 Initialize our object system tables. More...
 
FSTATIC void proj_class_change_debug (const char *Cclass, gint incr)
 Change debug level for this class and all its subclasses by 'incr'. More...
 
void proj_class_finalize_sys (void)
 Shut down (finalize) our object class system. Only do on shutdown to make valgrind happy :-D. More...
 
void proj_class_register_object (gpointer object, const char *static_classname)
 Log the creation of a new object, and its association with a given type. More...
 
void proj_class_register_debug_counter (const char *classname, guint *debugcount)
 
void proj_class_incr_debug (const char *Cclass)
 Increment debug level for this class and all its subclasses by one. More...
 
void proj_class_decr_debug (const char *Cclass)
 Decrement debug level for this class and all its subclasses by one. More...
 
gpointer proj_class_register_subclassed (gpointer object, const char *static_subclassname)
 Log the creation of a subclassed object from a superclassed object. More...
 
gpointer proj_class_new (gsize objsize, const char *static_classname)
 Malloc a new object and register it in our class system. More...
 
void proj_class_dissociate (gpointer object)
 Dissociate an object from the C class system (typically coupled with freeing it). More...
 
void proj_class_free (gpointer object)
 Free a registered object from our class system. More...
 
gboolean proj_class_is_a (gconstpointer object, const char *Cclass)
 Return TRUE if the given object ISA castclass object. More...
 
gpointer proj_class_castas (gpointer object, const char *castclass)
 "Safely" cast an object to a const object of the given C-class. More...
 
gconstpointer proj_class_castasconst (gconstpointer object, const char *castclass)
 "Safely" cast an object to a const object of the given C-class. More...
 
const char * proj_class_classname (gconstpointer object)
 Return the class name of one of our managed objects. More...
 
void proj_class_quark_add_superclass_relationship (GQuark superclass, GQuark subclass)
 Register a superclass/subclass relationship in our type system (using Quarks of the classes)) More...
 
gboolean proj_class_quark_is_a (GQuark objectclass, GQuark testclass)
 Determine whether an 'objectclass' ISA member of 'testclass' - with quarks of types as arguments Since this little C-class system only supports single-inheritance, this isn't exactly rocket science. More...
 
void proj_class_dump_live_objects (void)
 Dump all live C class objects (address and Class) More...
 
void proj_class_debug_dump (const char *prefix, const AssimObj *obj, const char *suffix)
 Send the object in question to g_debug() for printing... More...
 
guint32 proj_class_live_object_count (void)
 Return the count of live C class objects. More...
 
guint32 proj_class_max_object_count (void)
 Return the maximum number of live C class objects that we've ever had. More...
 

Variables

gboolean badfree = FALSE
 

Detailed Description

Implements a Class system for class hierarchies in 'C'.

We have a variety of classes and subclasses which we use, and this class system permits us to track them and catch errors in casting, parameter passing, etc.

This file is part of the Assimilation Project.

Author
Copyright © 2011, 2012 - Alan Robertson alanr.nosp@m.@uni.nosp@m.x.sh
The Assimilation software is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

The Assimilation software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with the Assimilation Project software. If not, see http://www.gnu.org/licenses/

Definition in file proj_classes.c.

Macro Definition Documentation

#define BADCASTMSG   g_error

Definition at line 31 of file proj_classes.c.

Referenced by proj_class_castas(), proj_class_castasconst(), and proj_class_dissociate().