Type Information

Type Information — The GLib Runtime type identification and management system

Synopsis


#include <glib-object.h>

typedef             GType;
#define             G_TYPE_FUNDAMENTAL                  (type)
#define             G_TYPE_FUNDAMENTAL_MAX
#define             G_TYPE_MAKE_FUNDAMENTAL             (x)
#define             G_TYPE_IS_ABSTRACT                  (type)
#define             G_TYPE_IS_DERIVED                   (type)
#define             G_TYPE_IS_FUNDAMENTAL               (type)
#define             G_TYPE_IS_VALUE_TYPE                (type)
#define             G_TYPE_HAS_VALUE_TABLE              (type)
#define             G_TYPE_IS_CLASSED                   (type)
#define             G_TYPE_IS_INSTANTIATABLE            (type)
#define             G_TYPE_IS_DERIVABLE                 (type)
#define             G_TYPE_IS_DEEP_DERIVABLE            (type)
#define             G_TYPE_IS_INTERFACE                 (type)
                    GTypeInterface;
                    GTypeInstance;
                    GTypeClass;
                    GTypeInfo;
                    GTypeFundamentalInfo;
                    GInterfaceInfo;
                    GTypeValueTable;
#define             G_TYPE_FROM_INSTANCE                (instance)
#define             G_TYPE_FROM_CLASS                   (g_class)
#define             G_TYPE_FROM_INTERFACE               (g_iface)
#define             G_TYPE_INSTANCE_GET_CLASS           (instance, g_type, c_type)
#define             G_TYPE_INSTANCE_GET_INTERFACE       (instance, g_type, c_type)
#define             G_TYPE_INSTANCE_GET_PRIVATE         (instance, g_type, c_type)
#define             G_TYPE_CHECK_INSTANCE               (instance)
#define             G_TYPE_CHECK_INSTANCE_CAST          (instance, g_type, c_type)
#define             G_TYPE_CHECK_INSTANCE_TYPE          (instance, g_type)
#define             G_TYPE_CHECK_CLASS_CAST             (g_class, g_type, c_type)
#define             G_TYPE_CHECK_CLASS_TYPE             (g_class, g_type)
#define             G_TYPE_CHECK_VALUE                  (value)
#define             G_TYPE_CHECK_VALUE_TYPE             (value, g_type)
#define             G_TYPE_FLAG_RESERVED_ID_BIT
void                g_type_init                         (void);
enum                GTypeDebugFlags;
void                g_type_init_with_debug_flags        (GTypeDebugFlags debug_flags);
const gchar*        g_type_name                         (GType type);
GQuark              g_type_qname                        (GType type);
GType               g_type_from_name                    (const gchar *name);
GType               g_type_parent                       (GType type);
guint               g_type_depth                        (GType type);
GType               g_type_next_base                    (GType leaf_type,
                                                         GType root_type);
gboolean            g_type_is_a                         (GType type,
                                                         GType is_a_type);
gpointer            g_type_class_ref                    (GType type);
gpointer            g_type_class_peek                   (GType type);
gpointer            g_type_class_peek_static            (GType type);
void                g_type_class_unref                  (gpointer g_class);
gpointer            g_type_class_peek_parent            (gpointer g_class);
void                g_type_class_add_private            (gpointer g_class,
                                                         gsize private_size);
gpointer            g_type_interface_peek               (gpointer instance_class,
                                                         GType iface_type);
gpointer            g_type_interface_peek_parent        (gpointer g_iface);
gpointer            g_type_default_interface_ref        (GType g_type);
gpointer            g_type_default_interface_peek       (GType g_type);
void                g_type_default_interface_unref      (gpointer g_iface);
GType*              g_type_children                     (GType type,
                                                         guint *n_children);
GType*              g_type_interfaces                   (GType type,
                                                         guint *n_interfaces);
GType*              g_type_interface_prerequisites      (GType interface_type,
                                                         guint *n_prerequisites);
void                g_type_set_qdata                    (GType type,
                                                         GQuark quark,
                                                         gpointer data);
gpointer            g_type_get_qdata                    (GType type,
                                                         GQuark quark);
void                g_type_query                        (GType type,
                                                         GTypeQuery *query);
                    GTypeQuery;
void                (*GBaseInitFunc)                    (gpointer g_class);
void                (*GBaseFinalizeFunc)                (gpointer g_class);
void                (*GClassInitFunc)                   (gpointer g_class,
                                                         gpointer class_data);
void                (*GClassFinalizeFunc)               (gpointer g_class,
                                                         gpointer class_data);
void                (*GInstanceInitFunc)                (GTypeInstance *instance,
                                                         gpointer g_class);
void                (*GInterfaceInitFunc)               (gpointer g_iface,
                                                         gpointer iface_data);
void                (*GInterfaceFinalizeFunc)           (gpointer g_iface,
                                                         gpointer iface_data);
gboolean            (*GTypeClassCacheFunc)              (gpointer cache_data,
                                                         GTypeClass *g_class);
enum                GTypeFlags;
enum                GTypeFundamentalFlags;
GType               g_type_register_static              (GType parent_type,
                                                         const gchar *type_name,
                                                         const GTypeInfo *info,
                                                         GTypeFlags flags);
GType               g_type_register_static_simple       (GType parent_type,
                                                         const gchar *type_name,
                                                         guint class_size,
                                                         GClassInitFunc class_init,
                                                         guint instance_size,
                                                         GInstanceInitFunc instance_init,
                                                         GTypeFlags flags);
GType               g_type_register_dynamic             (GType parent_type,
                                                         const gchar *type_name,
                                                         GTypePlugin *plugin,
                                                         GTypeFlags flags);
GType               g_type_register_fundamental         (GType type_id,
                                                         const gchar *type_name,
                                                         const GTypeInfo *info,
                                                         const GTypeFundamentalInfo *finfo,
                                                         GTypeFlags flags);
void                g_type_add_interface_static         (GType instance_type,
                                                         GType interface_type,
                                                         const GInterfaceInfo *info);
void                g_type_add_interface_dynamic        (GType instance_type,
                                                         GType interface_type,
                                                         GTypePlugin *plugin);
void                g_type_interface_add_prerequisite   (GType interface_type,
                                                         GType prerequisite_type);
GTypePlugin*        g_type_get_plugin                   (GType type);
GTypePlugin*        g_type_interface_get_plugin         (GType instance_type,
                                                         GType interface_type);
GType               g_type_fundamental_next             (void);
GType               g_type_fundamental                  (GType type_id);
GTypeInstance*      g_type_create_instance              (GType type);
void                g_type_free_instance                (GTypeInstance *instance);
void                g_type_add_class_cache_func         (gpointer cache_data,
                                                         GTypeClassCacheFunc cache_func);
void                g_type_remove_class_cache_func      (gpointer cache_data,
                                                         GTypeClassCacheFunc cache_func);
void                g_type_class_unref_uncached         (gpointer g_class);
void                g_type_add_interface_check          (gpointer check_data,
                                                         GTypeInterfaceCheckFunc check_func);
void                g_type_remove_interface_check       (gpointer check_data,
                                                         GTypeInterfaceCheckFunc check_func);
void                (*GTypeInterfaceCheckFunc)          (gpointer check_data,
                                                         gpointer g_iface);
GTypeValueTable*    g_type_value_table_peek             (GType type);
#define             G_DEFINE_TYPE                       (TN, t_n, T_P)
#define             G_DEFINE_TYPE_WITH_CODE             (TN, t_n, T_P, _C_)
#define             G_DEFINE_ABSTRACT_TYPE              (TN, t_n, T_P)
#define             G_DEFINE_ABSTRACT_TYPE_WITH_CODE    (TN, t_n, T_P, _C_)
#define             G_IMPLEMENT_INTERFACE               (TYPE_IFACE, iface_init)
#define             G_DEFINE_TYPE_EXTENDED              (TN, t_n, T_P, _f_, _C_)


#define             G_TYPE_INVALID
#define             G_TYPE_NONE
#define             G_TYPE_INTERFACE
#define             G_TYPE_CHAR
#define             G_TYPE_UCHAR
#define             G_TYPE_BOOLEAN
#define             G_TYPE_INT
#define             G_TYPE_UINT
#define             G_TYPE_LONG
#define             G_TYPE_ULONG
#define             G_TYPE_INT64
#define             G_TYPE_UINT64
#define             G_TYPE_ENUM
#define             G_TYPE_FLAGS
#define             G_TYPE_FLOAT
#define             G_TYPE_DOUBLE
#define             G_TYPE_STRING
#define             G_TYPE_POINTER
#define             G_TYPE_BOXED
#define             G_TYPE_PARAM
#define             G_TYPE_OBJECT
#define             G_TYPE_GTYPE

#define             G_TYPE_RESERVED_GLIB_FIRST
#define             G_TYPE_RESERVED_GLIB_LAST
#define             G_TYPE_RESERVED_BSE_FIRST
#define             G_TYPE_RESERVED_BSE_LAST
#define             G_TYPE_RESERVED_USER_FIRST

Description

The GType API is the foundation of the GObject system. It provides the facilities for registering and managing all fundamental data types, user-defined object and interface types. Before using any GType or GObject functions, g_type_init() must be called to initialize the type system.

For type creation and registration purposes, all types fall into one of two categories: static or dynamic. Static types are never loaded or unloaded at run-time as dynamic types may be. Static types are created with g_type_register_static() that gets type specific information passed in via a GTypeInfo structure. Dynamic types are created with g_type_register_dynamic() which takes a GTypePlugin structure instead. The remaining type information (the GTypeInfo structure) is retrieved during runtime through GTypePlugin and the g_type_plugin_*() API. These registration functions are usually called only once from a function whose only purpose is to return the type identifier for a specific class. Once the type (or class or interface) is registered, it may be instantiated, inherited, or implemented depending on exactly what sort of type it is. There is also a third registration function for registering fundamental types called g_type_register_fundamental() which requires both a GTypeInfo structure and a GTypeFundamentalInfo structure but it is seldom used since most fundamental types are predefined rather than user-defined.

A final word about type names. Such an identifier needs to be at least three characters long. There is no upper length limit. The first character needs to be a letter (a-z or A-Z) or an underscore '_'. Subsequent characters can be letters, numbers or any of '-_+'.

The GType API is the foundation of the GObject system. It provides the facilities for registering and managing all fundamental data types, user-defined object and interface types. Before using any GType or GObject functions, g_type_init() must be called to initialize the type system.

For type creation and registration purposes, all types fall into one of two categories: static or dynamic. Static types are never loaded or unloaded at run-time as dynamic types may be. Static types are created with g_type_register_static() that gets type specific information passed in via a GTypeInfo structure. Dynamic types are created with g_type_register_dynamic() which takes a GTypePlugin structure instead. The remaining type information (the GTypeInfo structure) is retrieved during runtime through GTypePlugin and the g_type_plugin_*() API. These registration functions are usually called only once from a function whose only purpose is to return the type identifier for a specific class. Once the type (or class or interface) is registered, it may be instantiated, inherited, or implemented depending on exactly what sort of type it is. There is also a third registration function for registering fundamental types called g_type_register_fundamental() which requires both a GTypeInfo structure and a GTypeFundamentalInfo structure but it is seldom used since most fundamental types are predefined rather than user-defined.

A final word about type names. Such an identifier needs to be at least three characters long. There is no upper length limit. The first character needs to be a letter (a-z or A-Z) or an underscore '_'. Subsequent characters can be letters, numbers or any of '-_+'.

Details

GType

A numerical value which represents the unique identifier of a registered type.

A numerical value which represents the unique identifier of a registered type.


G_TYPE_FUNDAMENTAL()

#define G_TYPE_FUNDAMENTAL(type)	(g_type_fundamental (type))

The fundamental type which is the ancestor of type. Fundamental types are types that serve as ultimate bases for the derived types, thus they are the roots of distinct inheritance hierarchies.

Returns the fundamental type which is the ancestor of type. Fundamental types are types that serve as ultimate bases for the derived types, thus they are the roots of distinct inheritance hierarchies.

type : A GType value.

G_TYPE_FUNDAMENTAL_MAX

#define	G_TYPE_FUNDAMENTAL_MAX		(255 << G_TYPE_FUNDAMENTAL_SHIFT)

An integer constant that represents the number of identifiers reserved for types that are assigned at compile-time.

An integer constant that represents the number of identifiers reserved for types that are assigned at compile-time.


G_TYPE_MAKE_FUNDAMENTAL()

#define	G_TYPE_MAKE_FUNDAMENTAL(x)	((GType) ((x) << G_TYPE_FUNDAMENTAL_SHIFT))

Get the type ID for the fundamental type number x. Use g_type_fundamental_next() instead of this macro to create new fundamental types.

Returns the type ID for the fundamental type number x. Use g_type_fundamental_next() instead of this macro to create new fundamental types.

x : the fundamental type number.

G_TYPE_IS_ABSTRACT()

#define G_TYPE_IS_ABSTRACT(type)                (g_type_test_flags ((type), G_TYPE_FLAG_ABSTRACT))

Checks if type is an abstract type. An abstract type can not be instantiated and is normally used as an abstract base class for derived classes.

Returns TRUE if type is an abstract type. An abstract type can not be instantiated and is normally used as an abstract base class for derived classes.

type : A GType value.

G_TYPE_IS_DERIVED()

#define G_TYPE_IS_DERIVED(type)                 ((type) > G_TYPE_FUNDAMENTAL_MAX)

Checks if type is derived (or in object-oriented terminology: inherited) from another type (this holds true for all non-fundamental types).

Returns TRUE if type is derived (or in object-oriented terminology: inherited) from another type (this holds true for all non-fundamental types).

type : A GType value.

G_TYPE_IS_FUNDAMENTAL()

#define G_TYPE_IS_FUNDAMENTAL(type)             ((type) <= G_TYPE_FUNDAMENTAL_MAX)

Checks if type is a fundamental type.

Returns TRUE if type is a fundamental type.

type : A GType value.

G_TYPE_IS_VALUE_TYPE()

#define G_TYPE_IS_VALUE_TYPE(type)              (g_type_check_is_value_type (type))

Checks if type is a value type and can be used with g_value_init().

Returns TRUE if type is a value type and can be used with g_value_init().

type : A GType value.

G_TYPE_HAS_VALUE_TABLE()

#define G_TYPE_HAS_VALUE_TABLE(type)            (g_type_value_table_peek (type) != NULL)

Checks if type has a GTypeValueTable.

Returns TRUE if type has a GTypeValueTable.

type : A GType value.

G_TYPE_IS_CLASSED()

#define G_TYPE_IS_CLASSED(type)                 (g_type_test_flags ((type), G_TYPE_FLAG_CLASSED))

Checks if type is a classed type.

Returns TRUE if type is a classed type.

type : A GType value.

G_TYPE_IS_INSTANTIATABLE()

#define G_TYPE_IS_INSTANTIATABLE(type)          (g_type_test_flags ((type), G_TYPE_FLAG_INSTANTIATABLE))

Checks if type can be instantiated. Instantiation is the process of creating an instance (object) of this type.

Returns TRUE if type can be instantiated. Instantiation is the process of creating an instance (object) of this type.

type : A GType value.

G_TYPE_IS_DERIVABLE()

#define G_TYPE_IS_DERIVABLE(type)               (g_type_test_flags ((type), G_TYPE_FLAG_DERIVABLE))

Checks if type is a derivable type. A derivable type can be used as the base class of a flat (single-level) class hierarchy.

Returns TRUE if type is a derivable type. A derivable type can be used as the base class of a flat (single-level) class hierarchy.

type : A GType value.

G_TYPE_IS_DEEP_DERIVABLE()

#define G_TYPE_IS_DEEP_DERIVABLE(type)          (g_type_test_flags ((type), G_TYPE_FLAG_DEEP_DERIVABLE))

Checks if type is a deep derivable type. A deep derivable type can be used as the base class of a deep (multi-level) class hierarchy.

Returns TRUE if type is a deep derivable type. A deep derivable type can be used as the base class of a deep (multi-level) class hierarchy.

type : A GType value.

G_TYPE_IS_INTERFACE()

#define G_TYPE_IS_INTERFACE(type)               (G_TYPE_FUNDAMENTAL (type) == G_TYPE_INTERFACE)

Checks if type is an interface type. An interface type provides a pure API, the implementation of which is provided by another type (which is then said to conform to the interface). GLib interfaces are somewhat analogous to Java interfaces and C++ classes containing only pure virtual functions, with the difference that GType interfaces are not derivable (but see g_type_interface_add_prerequisite() for an alternative).

Returns TRUE if type is an interface type. An interface type provides a pure API, the implementation of which is provided by another type (which is then said to conform to the interface). GLib interfaces are somewhat analogous to Java interfaces and C++ classes containing only pure virtual functions, with the difference that GType interfaces are not derivable (but see g_type_interface_add_prerequisite() for an alternative).

type : A GType value.

GTypeInterface

typedef struct {
} GTypeInterface;

An opaque structure used as the base of all interface types.

An opaque structure used as the base of all interface types.


GTypeInstance

typedef struct {
} GTypeInstance;

An opaque structure used as the base of all type instances.

An opaque structure used as the base of all type instances.


GTypeClass

typedef struct {
} GTypeClass;

An opaque structure used as the base of all classes.

An opaque structure used as the base of all classes.


GTypeInfo

typedef struct {
  /* interface types, classed types, instantiated types */
  guint16                class_size;
  
  GBaseInitFunc          base_init;
  GBaseFinalizeFunc      base_finalize;
  
  /* interface types, classed types, instantiated types */
  GClassInitFunc         class_init;
  GClassFinalizeFunc     class_finalize;
  gconstpointer          class_data;
  
  /* instantiated types */
  guint16                instance_size;
  guint16                n_preallocs;
  GInstanceInitFunc      instance_init;
  
  /* value handling */
  const GTypeValueTable	*value_table;
} GTypeInfo;

This structure is used to provide the type system with the information required to initialize and destruct (finalize) a type's class and its instances. The initialized structure is passed to the g_type_register_static() function (or is copied into the provided GTypeInfo structure in the g_type_plugin_complete_type_info()). The type system will perform a deep copy of this structure, so its memory does not need to be persistent across invocation of g_type_register_static().

This structure is used to provide the type system with the information required to initialize and destruct (finalize) a type's class and its instances. The initialized structure is passed to the g_type_register_static() function (or is copied into the provided GTypeInfo structure in the g_type_plugin_complete_type_info()). The type system will perform a deep copy of this structure, so its memory does not need to be persistent across invocation of g_type_register_static().

guint16 class_size; Size of the class structure (required for interface, classed and instantiatable types).
GBaseInitFunc base_init; Location of the base initialization function (optional).
GBaseFinalizeFunc base_finalize; Location of the base finalization function (optional).
GClassInitFunc class_init; Location of the class initialization function for classed and instantiatable types. Location of the default vtable inititalization function for interface types. (optional) This function is used both to fill in virtual functions in the class or default vtable, and to do type-specific setup such as registering signals and object properties.
GClassFinalizeFunc class_finalize; Location of the class finalization function for classed and instantiatable types. Location fo the default vtable finalization function for interface types. (optional)
gconstpointer class_data; User-supplied data passed to the class init/finalize functions.
guint16 instance_size; Size of the instance (object) structure (required for instantiatable types only).
guint16 n_preallocs; Prior to GLib 2.10, it specified the number of pre-allocated (cached) instances to reserve memory for (0 indicates no caching). Since GLib 2.10, it is ignored, since instances are allocated with the slice allocator now.
GInstanceInitFunc instance_init; Location of the instance initialization function (optional, for instantiatable types only).
const GTypeValueTable *value_table; A GTypeValueTable function table for generic handling of GValues of this type (usually only useful for fundamental types).

GTypeFundamentalInfo

typedef struct {
  GTypeFundamentalFlags  type_flags;
} GTypeFundamentalInfo;

A structure that provides information to the type system which is used specifically for managing fundamental types.

A structure that provides information to the type system which is used specifically for managing fundamental types.

GTypeFundamentalFlags type_flags; GTypeFundamentalFlags describing the characteristics of the fundamental type

GInterfaceInfo

typedef struct {
  GInterfaceInitFunc     interface_init;
  GInterfaceFinalizeFunc interface_finalize;
  gpointer               interface_data;
} GInterfaceInfo;

A structure that provides information to the type system which is used specifically for managing interface types.

A structure that provides information to the type system which is used specifically for managing interface types.

GInterfaceInitFunc interface_init; location of the interface initialization function
GInterfaceFinalizeFunc interface_finalize; location of the interface finalization function
gpointer interface_data; user-supplied data passed to the interface init/finalize functions

GTypeValueTable

typedef struct {
  void     (*value_init)         (GValue       *value);
  void     (*value_free)         (GValue       *value);
  void     (*value_copy)         (const GValue *src_value,
				  GValue       *dest_value);
  /* varargs functionality (optional) */
  gpointer (*value_peek_pointer) (const GValue *value);
  gchar	    *collect_format;
  gchar*   (*collect_value)      (GValue       *value,
				  guint         n_collect_values,
				  GTypeCValue  *collect_values,
				  guint		collect_flags);
  gchar	    *lcopy_format;
  gchar*   (*lcopy_value)        (const GValue *value,
				  guint         n_collect_values,
				  GTypeCValue  *collect_values,
				  guint		collect_flags);
} GTypeValueTable;

The GTypeValueTable provides the functions required by the GValue implementation, to serve as a container for values of a type.

The GTypeValueTable provides the functions required by the GValue implementation, to serve as a container for values of a type.

value_init () Default initialize values contents by poking values directly into the value->data array. The data array of the GValue passed into this function was zero-filled with memset(), so no care has to be taken to free any old contents. E.g. for the implementation of a string value that may never be NULL, the implementation might look like:
 value->data[0].v_pointer = g_strdup ("");
 
value_free () Free any old contents that might be left in the data array of the passed in value. No resources may remain allocated through the GValue contents after this function returns. E.g. for our above string type:
 // only free strings without a specific flag for static storage
 if (!(value->data[1].v_uint & G_VALUE_NOCOPY_CONTENTS))
   g_free (value->data[0].v_pointer);
 
value_copy () dest_value is a GValue with zero-filled data section and src_value is a properly setup GValue of same or derived type. The purpose of this function is to copy the contents of src_value into dest_value in a way, that even after src_value has been freed, the contents of dest_value remain valid. String type example:
 dest_value->data[0].v_pointer = g_strdup (src_value->data[0].v_pointer);
 
value_peek_pointer () If the value contents fit into a pointer, such as objects or strings, return this pointer, so the caller can peek at the current contents. To extend on our above string example:
 return value->data[0].v_pointer;
 
gchar *collect_format; A string format describing how to collect the contents of this value bit-by-bit. Each character in the format represents an argument to be collected, and the characters themselves indicate the type of the argument. Currently supported arguments are:

'i' - Integers. passed as collect_values[].v_int.

'l' - Longs. passed as collect_values[].v_long.

'd' - Doubles. passed as collect_values[].v_double.

'p' - Pointers. passed as collect_values[].v_pointer.

It should be noted that for variable argument list construction, ANSI C promotes every type smaller than an integer to an int, and floats to doubles. So for collection of short int or char, 'i' needs to be used, and for collection of floats 'd'.
collect_value () The collect_value() function is responsible for converting the values collected from a variable argument list into contents suitable for storage in a GValue. This function should setup value similar to value_init(); e.g. for a string value that does not allow NULL pointers, it needs to either spew an error, or do an implicit conversion by storing an empty string. The value passed in to this function has a zero-filled data array, so just like for value_init() it is guaranteed to not contain any old contents that might need freeing. n_collect_values is exactly the string length of collect_format, and collect_values is an array of unions GTypeCValue with length n_collect_values, containing the collected values according to collect_format. collect_flags is an argument provided as a hint by the caller. It may contain the flag G_VALUE_NOCOPY_CONTENTS indicating, that the collected value contents may be considered "static" for the duration of the value lifetime. Thus an extra copy of the contents stored in collect_values is not required for assignment to value. For our above string example, we continue with:
 if (!collect_values[0].v_pointer)
   value->data[0].v_pointer = g_strdup ("");
 else if (collect_flags & G_VALUE_NOCOPY_CONTENTS)
 {
   value->data[0].v_pointer = collect_values[0].v_pointer;
   // keep a flag for the value_free() implementation to not free this string
   value->data[1].v_uint = G_VALUE_NOCOPY_CONTENTS;
 }
 else
   value->data[0].v_pointer = g_strdup (collect_values[0].v_pointer);
 return NULL;
 
It should be noted, that it is generally a bad idea to follow the G_VALUE_NOCOPY_CONTENTS hint for reference counted types. Due to reentrancy requirements and reference count assertions performed by the GSignal code, reference counts should always be incremented for reference counted contents stored in the value->data array. To deviate from our string example for a moment, and taking a look at an exemplary implementation for collect_value() of ""
 if (collect_values[0].v_pointer)
 {
   GObject *object = G_OBJECT (collect_values[0].v_pointer);
   // never honour G_VALUE_NOCOPY_CONTENTS for ref-counted types
   value->data[0].v_pointer = g_object_ref (object);
   return NULL;
 }
 else
   return g_strdup_printf ("Object passed as invalid NULL pointer");
 }
 
The reference count for valid objects is always incremented, regardless of collect_flags. For invalid objects, the example returns a newly allocated string without altering value. Upon success, collect_value() needs to return NULL. If, however, an error condition occurred, collect_value() may spew an error by returning a newly allocated non-NULL string, giving a suitable description of the error condition. The calling code makes no assumptions about the value contents being valid upon error returns, value is simply thrown away without further freeing. As such, it is a good idea to not allocate GValue contents, prior to returning an error, however, collect_values() is not obliged to return a correctly setup value for error returns, simply because any non-NULL return is considered a fatal condition so further program behaviour is undefined.
gchar *lcopy_format; Format description of the arguments to collect for lcopy_value, analogous to collect_format. Usually, lcopy_format string consists only of 'p's to provide lcopy_value() with pointers to storage locations.
lcopy_value () This function is responsible for storing the value contents into arguments passed through a variable argument list which got collected into collect_values according to lcopy_format. n_collect_values equals the string length of lcopy_format, and collect_flags may contain G_VALUE_NOCOPY_CONTENTS. In contrast to collect_value(), lcopy_value() is obliged to always properly support G_VALUE_NOCOPY_CONTENTS. Similar to collect_value() the function may prematurely abort by returning a newly allocated string describing an error condition. To complete the string example:
 gchar **string_p = collect_values[0].v_pointer;
 if (!string_p)
   return g_strdup_printf ("string location passed as NULL");
 if (collect_flags & G_VALUE_NOCOPY_CONTENTS)
   *string_p = value->data[0].v_pointer;
 else
   *string_p = g_strdup (value->data[0].v_pointer);
 
And an illustrative version of lcopy_value() for reference-counted types:
 GObject **object_p = collect_values[0].v_pointer;
 if (!object_p)
   return g_strdup_printf ("object location passed as NULL");
 if (!value->data[0].v_pointer)
   *object_p = NULL;
 else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) // always honour
   *object_p = value->data[0].v_pointer;
 else
   *object_p = g_object_ref (value->data[0].v_pointer);
 return NULL;
 

G_TYPE_FROM_INSTANCE()

#define G_TYPE_FROM_INSTANCE(instance)                          (G_TYPE_FROM_CLASS (((GTypeInstance*) (instance))->g_class))

Get the type identifier from a given instance structure.

This macro should only be used in type implementations.

Returns the type identifier from a given instance structure.

This macro should only be used in type implementations.

instance : Location of a valid GTypeInstance structure.

G_TYPE_FROM_CLASS()

#define G_TYPE_FROM_CLASS(g_class)                              (((GTypeClass*) (g_class))->g_type)

Get the type identifier from a given class structure.

This macro should only be used in type implementations.

Returns the type identifier from a given class structure.

This macro should only be used in type implementations.

g_class : Location of a valid GTypeClass structure.

G_TYPE_FROM_INTERFACE()

#define G_TYPE_FROM_INTERFACE(g_iface)                          (((GTypeInterface*) (g_iface))->g_type)

Get the type identifier from a given interface structure.

This macro should only be used in type implementations.

Returns the type identifier from a given interface structure.

This macro should only be used in type implementations.

g_iface : Location of a valid GTypeInterface structure.

G_TYPE_INSTANCE_GET_CLASS()

#define G_TYPE_INSTANCE_GET_CLASS(instance, g_type, c_type)     (_G_TYPE_IGC ((instance), (g_type), c_type))

Get the class structure of a given instance, casted to a specified ancestor type g_type of the instance.

Note that while calling a GInstanceInitFunc(), the class pointer gets modified, so it might not always return the expected pointer.

This macro should only be used in type implementations.

Returns the class structure of a given instance, casted to a specified ancestor type g_type of the instance.

Warning

Note that while calling a GInstanceInitFunc(), the class pointer gets modified, so it might not always return the expected pointer.

This macro should only be used in type implementations.

instance : Location of the GTypeInstance structure.
g_type : The GType of the class to be returned.
c_type : The C type of the class structure.

G_TYPE_INSTANCE_GET_INTERFACE()

#define G_TYPE_INSTANCE_GET_INTERFACE(instance, g_type, c_type) (_G_TYPE_IGI ((instance), (g_type), c_type))

Get the interface structure for interface g_type of a given instance.

This macro should only be used in type implementations.

Returns the interface structure for interface g_type of a given instance.

This macro should only be used in type implementations.

instance : Location of the GTypeInstance structure.
g_type : The GType of the interface to be returned.
c_type : The C type of the interface structure.

G_TYPE_INSTANCE_GET_PRIVATE()

#define G_TYPE_INSTANCE_GET_PRIVATE(instance, g_type, c_type)   ((c_type*) g_type_instance_get_private ((GTypeInstance*) (instance), (g_type)))

Gets the private structure for a particular type. The private structure must have been registered in the class_init function with g_type_class_add_private().

This macro should only be used in type implementations.

Gets the private structure for a particular type. The private structure must have been registered in the class_init function with g_type_class_add_private().

This macro should only be used in type implementations.

instance : the instance of a type deriving from private_type.
g_type : the type identifying which private data to retrieve.
c_type : The C type for the private structure.

Since 2.4


G_TYPE_CHECK_INSTANCE()

#define G_TYPE_CHECK_INSTANCE(instance)				(_G_TYPE_CHI ((GTypeInstance*) (instance)))

Checks if instance is a valid GTypeInstance structure, otherwise issues a warning and returns FALSE.

This macro should only be used in type implementations.

Returns TRUE if instance is a valid GTypeInstance structure, otherwise emits a warning and returns FALSE.

This macro should only be used in type implementations.

instance : Location of a GTypeInstance structure.

G_TYPE_CHECK_INSTANCE_CAST()

#define G_TYPE_CHECK_INSTANCE_CAST(instance, g_type, c_type)    (_G_TYPE_CIC ((instance), (g_type), c_type))

Checks that instance is an instance of the type identified by g_type and issues a warning if this is not the case. Returns instance casted to a pointer to c_type.

This macro should only be used in type implementations.

Checks that instance is an instance of the type identified by g_type and emits a warning if this is not the case. Returns instance casted to a pointer to c_type.

This macro should only be used in type implementations.

instance : Location of a GTypeInstance structure.
g_type : The type to be returned.
c_type : The corresponding C type of g_type.

G_TYPE_CHECK_INSTANCE_TYPE()

#define G_TYPE_CHECK_INSTANCE_TYPE(instance, g_type)            (_G_TYPE_CIT ((instance), (g_type)))

Checks if instance is an instance of the type identified by g_type.

This macro should only be used in type implementations.

Returns TRUE if instance is an instance of the type identified by g_type. Otherwise emits a warning and returns FALSE.

This macro should only be used in type implementations.

instance : Location of a GTypeInstance structure.
g_type : The type to be checked

G_TYPE_CHECK_CLASS_CAST()

#define G_TYPE_CHECK_CLASS_CAST(g_class, g_type, c_type)        (_G_TYPE_CCC ((g_class), (g_type), c_type))

Checks that g_class is a class structure of the type identified by g_type and issues a warning if this is not the case. Returns g_class casted to a pointer to c_type.

This macro should only be used in type implementations.

Checks that g_class is a class structure of the type identified by g_type and emits a warning if this is not the case. Returns g_class casted to a pointer to c_type.

This macro should only be used in type implementations.

g_class : Location of a GTypeClass structure.
g_type : The type to be returned.
c_type : The corresponding C type of class structure of g_type.

G_TYPE_CHECK_CLASS_TYPE()

#define G_TYPE_CHECK_CLASS_TYPE(g_class, g_type)                (_G_TYPE_CCT ((g_class), (g_type)))

Checks if g_class is a class structure of the type identified by g_type.

This macro should only be used in type implementations.

Returns TRUE if g_class is a class structure of the type identified by g_type. Otherwise emits a warning and returns FALSE.

This macro should only be used in type implementations.

g_class : Location of a GTypeClass structure.
g_type : The type to be checked.

G_TYPE_CHECK_VALUE()

#define G_TYPE_CHECK_VALUE(value)				(_G_TYPE_CHV ((value)))

Checks if value has been initialized to hold values of a value type.

This macro should only be used in type implementations.

Returns TRUE if value has been initialized to hold values of a value type.

This macro should only be used in type implementations.

value : a GValue

G_TYPE_CHECK_VALUE_TYPE()

#define G_TYPE_CHECK_VALUE_TYPE(value, g_type)			(_G_TYPE_CVH ((value), (g_type)))

Checks if value has been initialized to hold values of type g_type.

This macro should only be used in type implementations.

Returns TRUE if value has been initialized to hold values of type g_type.

This macro should only be used in type implementations.

value : a GValue
g_type : The type to be checked.

G_TYPE_FLAG_RESERVED_ID_BIT

#define	G_TYPE_FLAG_RESERVED_ID_BIT	((GType) (1 << 0))

A bit in the type number that's supposed to be left untouched.

A bit in the type number that's supposed to be left untouched.


g_type_init ()

void                g_type_init                         (void);

Prior to any use of the type system, g_type_init() has to be called to initialize the type system and assorted other code portions (such as the various fundamental type implementations or the signal system).

Prior to any use of the type system, g_type_init() has to be called to initialize the type system and assorted other code portions (such as the various fundamental type implementations or the signal system).


enum GTypeDebugFlags

typedef enum	/*< skip >*/
{
  G_TYPE_DEBUG_NONE	= 0,
  G_TYPE_DEBUG_OBJECTS	= 1 << 0,
  G_TYPE_DEBUG_SIGNALS	= 1 << 1,
  G_TYPE_DEBUG_MASK	= 0x03
} GTypeDebugFlags;

The GTypeDebugFlags enumeration values can be passed to g_type_init_with_debug_flags() to trigger debugging messages during runtime. Note that the messages can also be triggered by setting the GOBJECT_DEBUG environment variable to a ':'-separated list of "objects" and "signals".

The GTypeDebugFlags enumeration values can be passed to g_type_init_with_debug_flags() to trigger debugging messages during runtime. Note that the messages can also be triggered by setting the GOBJECT_DEBUG environment variable to a ':'-separated list of "objects" and "signals".


g_type_init_with_debug_flags ()

void                g_type_init_with_debug_flags        (GTypeDebugFlags debug_flags);

Similar to g_type_init(), but additionally sets debug flags.

Similar to g_type_init(), but additionally sets debug flags.

debug_flags : Bitwise combination of GTypeDebugFlags values for debugging purposes.

g_type_name ()

const gchar*        g_type_name                         (GType type);

Get the unique name that is assigned to a type ID. Note that this function (like all other GType API) cannot cope with invalid type IDs. G_TYPE_INVALID may be passed to this function, as may be any other validly registered type ID, but randomized type IDs should not be passed in and will most likely lead to a crash.

Returns the unique name that is assigned to a type ID. Note that this function (like all other GType API) cannot cope with invalid type IDs. G_TYPE_INVALID may be passed to this function, as may be any other validly registered type ID, but randomized type IDs should not be passed in and will most likely lead to a crash.

type : Type to return name for.
Returns : Static type name or NULL.

g_type_qname ()

GQuark              g_type_qname                        (GType type);

Get the corresponding quark of the type IDs name.

Return the corresponding quark of the type IDs name.

type : Type to return quark of type name for.
Returns : The type names quark or 0.

g_type_from_name ()

GType               g_type_from_name                    (const gchar *name);

Lookup the type ID from a given type name, returning 0 if no type has been registered under this name (this is the preferred method to find out by name whether a specific type has been registered yet).

Lookup the type ID from a given type name, returning 0 if no type has been registered under this name (this is the preferred method to find out by name whether a specific type has been registered yet).

name : Type name to lookup.
Returns : Corresponding type ID or 0.

g_type_parent ()

GType               g_type_parent                       (GType type);

Return the direct parent type of the passed in type. If the passed in type has no parent, i.e. is a fundamental type, 0 is returned.

Return the direct parent type of the passed in type. If the passed in type has no parent, i.e. is a fundamental type, 0 is returned.

type : The derived type.
Returns : The parent type.

g_type_depth ()

guint               g_type_depth                        (GType type);

Returns the length of the ancestry of the passed in type. This includes the type itself, so that e.g. a fundamental type has depth 1.

Returns the length of the ancestry of the passed in type. This includes the type itself, so that e.g. a fundamental type has depth 1.

type : A GType value.
Returns : The depth of type.

g_type_next_base ()

GType               g_type_next_base                    (GType leaf_type,
                                                         GType root_type);

Given a leaf_type and a root_type which is contained in its anchestry, return the type that root_type is the immediate parent of. In other words, this function determines the type that is derived directly from root_type which is also a base class of leaf_type. Given a root type and a leaf type, this function can be used to determine the types and order in which the leaf type is descended from the root type.

Given a leaf_type and a root_type which is contained in its anchestry, return the type that root_type is the immediate parent of. In other words, this function determines the type that is derived directly from root_type which is also a base class of leaf_type. Given a root type and a leaf type, this function can be used to determine the types and order in which the leaf type is descended from the root type.

leaf_type : Descendant of root_type and the type to be returned.
root_type : Immediate parent of the returned type.
Returns : Immediate child of root_type and anchestor of leaf_type.

g_type_is_a ()

gboolean            g_type_is_a                         (GType type,
                                                         GType is_a_type);

If is_a_type is a derivable type, check whether type is a descendant of is_a_type. If is_a_type is an interface, check whether type conforms to it.

If is_a_type is a derivable type, check whether type is a descendant of is_a_type. If is_a_type is an interface, check whether type conforms to it.

type : Type to check anchestry for.
is_a_type : Possible anchestor of type or interface type could conform to.
Returns : TRUE if type is_a is_a_type holds true.

g_type_class_ref ()

gpointer            g_type_class_ref                    (GType type);

Increments the reference count of the class structure belonging to type. This function will demand-create the class if it doesn't exist already.

Increments the reference count of the class structure belonging to type. This function will demand-create the class if it doesn't exist already.

type : Type ID of a classed type.
Returns : The GTypeClass structure for the given type ID.

g_type_class_peek ()

gpointer            g_type_class_peek                   (GType type);

This function is essentially the same as g_type_class_ref(), except that the classes reference count isn't incremented. As a consequence, this function may return NULL if the class of the type passed in does not currently exist (hasn't been referenced before).

This function is essentially the same as g_type_class_ref(), except that the classes reference count isn't incremented. As a consequence, this function may return NULL if the class of the type passed in does not currently exist (hasn't been referenced before).

type : Type ID of a classed type.
Returns : The GTypeClass structure for the given type ID or NULL if the class does not currently exist.

g_type_class_peek_static ()

gpointer            g_type_class_peek_static            (GType type);

A more efficient version of g_type_class_peek() which works only for static types.

A more efficient version of g_type_class_peek() which works only for static types.

type : Type ID of a classed type.
Returns : The GTypeClass structure for the given type ID or NULL if the class does not currently exist or is dynamically loaded.

Since 2.4


g_type_class_unref ()

void                g_type_class_unref                  (gpointer g_class);

Decrements the reference count of the class structure being passed in. Once the last reference count of a class has been released, classes may be finalized by the type system, so further dereferencing of a class pointer after g_type_class_unref() are invalid.

Decrements the reference count of the class structure being passed in. Once the last reference count of a class has been released, classes may be finalized by the type system, so further dereferencing of a class pointer after g_type_class_unref() are invalid.

g_class : The GTypeClass structure to unreference.

g_type_class_peek_parent ()

gpointer            g_type_class_peek_parent            (gpointer g_class);

This is a convenience function often needed in class initializers. It returns the class structure of the immediate parent type of the class passed in. Since derived classes hold a reference count on their parent classes as long as they are instantiated, the returned class will always exist. This function is essentially equivalent to:

g_type_class_peek (g_type_parent (G_TYPE_FROM_CLASS (g_class)));

This is a convenience function often needed in class initializers. It returns the class structure of the immediate parent type of the class passed in. Since derived classes hold a reference count on their parent classes as long as they are instantiated, the returned class will always exist. This function is essentially equivalent to:

g_type_class_peek (g_type_parent (G_TYPE_FROM_CLASS (g_class)));

g_class : The GTypeClass structure to retrieve the parent class for.
Returns : The parent class of g_class.

g_type_class_add_private ()

void                g_type_class_add_private            (gpointer g_class,
                                                         gsize private_size);

Registers a private structure for an instantiatable type; when an object is allocated, the private structures for the type and all of its parent types are allocated sequentially in the same memory block as the public structures. This function should be called in the type's class_init() function. The private structure can be retrieved using the G_TYPE_INSTANCE_GET_PRIVATE() macro. The following example shows attaching a private structure MyObjectPrivate to an object MyObject defined in the standard GObject fashion.

typedef struct _MyObjectPrivate MyObjectPrivate;

struct _MyObjectPrivate {
  int some_field;
};

#define MY_OBJECT_GET_PRIVATE(o)  \
   (G_TYPE_INSTANCE_GET_PRIVATE ((o), MY_TYPE_OBJECT, MyObjectPrivate))

static void
my_object_class_init (MyObjectClass *klass)
{
  g_type_class_add_private (klass, sizeof (MyObjectPrivate));
}

static int
my_object_get_some_field (MyObject *my_object)
{
  MyObjectPrivate *priv = MY_OBJECT_GET_PRIVATE (my_object);

  return priv->some_field;
}

Registers a private structure for a instantiatable type; when an object is allocated, the private structures for the type and and all of its parent types are allocated sequentially in the same memory block as the public structures. This function should be called in the type's class_init() function. The private structure can be retrieved using the G_TYPE_INSTANCE_GET_PRIVATE() macro. The following example shows attaching a private structure MyObjectPrivate to an object MyObject defined in the standard GObject fashion.

typedef struct _MyObjectPrivate MyObjectPrivate;

struct _MyObjectPrivate {
  int some_field;
};

#define MY_OBJECT_GET_PRIVATE(o)  \
   (G_TYPE_INSTANCE_GET_PRIVATE ((o), MY_TYPE_OBJECT, MyObjectPrivate))

static void
my_object_class_init (MyObjectClass *klass)
{
  g_type_class_add_private (klass, sizeof (MyObjectPrivate));
}

static int
my_object_get_some_field (MyObject *my_object)
{
  MyObjectPrivate *priv = MY_OBJECT_GET_PRIVATE (my_object);

  return priv->some_field;
}
g_class : class structure for an instantiatable type
private_size : size of private structure.

Since 2.4


g_type_interface_peek ()

gpointer            g_type_interface_peek               (gpointer instance_class,
                                                         GType iface_type);

Returns the GTypeInterface structure of an interface to which the passed in class conforms.

Returns the GTypeInterface structure of an interface to which the passed in class conforms.

instance_class : A GTypeClass structure.
iface_type : An interface ID which this class conforms to.
Returns : The GTypeInterface structure of iface_type if implemented by instance_class, NULL otherwise

g_type_interface_peek_parent ()

gpointer            g_type_interface_peek_parent        (gpointer g_iface);

Returns the corresponding GTypeInterface structure of the parent type of the instance type to which g_iface belongs. This is useful when deriving the implementation of an interface from the parent type and then possibly overriding some methods.

Returns the corresponding GTypeInterface structure of the parent type of the instance type to which g_iface belongs. This is useful when deriving the implementation of an interface from the parent type and then possibly overriding some methods.

g_iface : A GTypeInterface structure.
Returns : The corresponding GTypeInterface structure of the parent type of the instance type to which g_iface belongs, or NULL if the parent type doesn't conform to the interface.

g_type_default_interface_ref ()

gpointer            g_type_default_interface_ref        (GType g_type);

Increments the reference count for the interface type g_type, and returns the default interface vtable for the type.

If the type is not currently in use, then the default vtable for the type will be created and initalized by calling the base interface init and default vtable init functions for the type (the @base_init and class_init members of GTypeInfo). Calling g_type_default_interface_ref() is useful when you want to make sure that signals and properties for an interface have been installed.

Increments the reference count for the interface type g_type, and returns the default interface vtable for the type.

If the type is not currently in use, then the default vtable for the type will be created and initalized by calling the base interface init and default vtable init functions for the type (the @base_init and class_init members of GTypeInfo). Calling g_type_default_interface_ref() is useful when you want to make sure that signals and properties for an interface have been installed.

g_type : an interface type
Returns : the default vtable for the interface; call g_type_default_interface_unref() when you are done using the interface.

Since 2.4


g_type_default_interface_peek ()

gpointer            g_type_default_interface_peek       (GType g_type);

If the interface type g_type is currently in use, returns its default interface vtable.

If the interface type g_type is currently in use, returns its default interface vtable.

g_type : an interface type
Returns : the default vtable for the interface, or NULL if the type is not currently in use.

Since 2.4


g_type_default_interface_unref ()

void                g_type_default_interface_unref      (gpointer g_iface);

Decrements the reference count for the type corresponding to the interface default vtable g_iface. If the type is dynamic, then when no one is using the interface and all references have been released, the finalize function for the interface's default vtable (the class_finalize member of GTypeInfo) will be called.

Decrements the reference count for the type corresponding to the interface default vtable g_iface. If the type is dynamic, then when no one is using the interface and all references have been released, the finalize function for the interface's default vtable (the class_finalize member of GTypeInfo) will be called.

g_iface : the default vtable structure for a interface, as returned by g_type_default_interface_ref()

Since 2.4


g_type_children ()

GType*              g_type_children                     (GType type,
                                                         guint *n_children);

Return a newly allocated and 0-terminated array of type IDs, listing the child types of type. The return value has to be g_free()ed after use.

Return a newly allocated and 0-terminated array of type IDs, listing the child types of type. The return value has to be g_free()ed after use.

type : The parent type.
n_children : Optional guint pointer to contain the number of child types.
Returns : Newly allocated and 0-terminated array of child types.

g_type_interfaces ()

GType*              g_type_interfaces                   (GType type,
                                                         guint *n_interfaces);

Return a newly allocated and 0-terminated array of type IDs, listing the interface types that type conforms to. The return value has to be g_free()ed after use.

Return a newly allocated and 0-terminated array of type IDs, listing the interface types that type conforms to. The return value has to be g_free()ed after use.

type : The type to list interface types for.
n_interfaces : Optional guint pointer to contain the number of interface types.
Returns : Newly allocated and 0-terminated array of interface types.

g_type_interface_prerequisites ()

GType*              g_type_interface_prerequisites      (GType interface_type,
                                                         guint *n_prerequisites);

Returns the prerequisites of an interfaces type.

Returns the prerequisites of an interfaces type.

interface_type : an interface type
n_prerequisites : location to return the number of prerequisites, or NULL
Returns : a newly-allocated zero-terminated array of GType containing the prerequisites of interface_type

Since 2.2


g_type_set_qdata ()

void                g_type_set_qdata                    (GType type,
                                                         GQuark quark,
                                                         gpointer data);

Attaches arbitrary data to a type.

Attaches arbitrary data to a type.

type : a GType
quark : a GQuark id to identify the data
data : the data

g_type_get_qdata ()

gpointer            g_type_get_qdata                    (GType type,
                                                         GQuark quark);

Obtains data which has previously been attached to type with g_type_set_qdata().

Obtains data which has previously been attached to type with g_type_set_qdata().

type : a GType
quark : a GQuark id to identify the data
Returns : the data, or NULL if no data was found

g_type_query ()

void                g_type_query                        (GType type,
                                                         GTypeQuery *query);

Queries the type system for information about a specific type. This function will fill in a user-provided structure to hold type-specific information. If an invalid GType is passed in, the type member of the GTypeQuery is 0. All members filled into the GTypeQuery structure should be considered constant and have to be left untouched.

Queries the type system for information about a specific type. This function will fill in a user-provided structure to hold type-specific information. If an invalid GType is passed in, the type member of the GTypeQuery is 0. All members filled into the GTypeQuery structure should be considered constant and have to be left untouched.

type : the GType value of a static, classed type.
query : A user provided structure that is filled in with constant values upon success.

GTypeQuery

typedef struct {
  GType		type;
  const gchar  *type_name;
  guint		class_size;
  guint		instance_size;
} GTypeQuery;

A structure holding information for a specific type. It is filled in by the g_type_query() function.

A structure holding information for a specific type. It is filled in by the g_type_query() function.

GType type; the GType value of the type.
const gchar *type_name; the name of the type.
guint class_size; the size of the class structure.
guint instance_size; the size of the instance structure.

GBaseInitFunc ()

void                (*GBaseInitFunc)                    (gpointer g_class);

A callback function used by the type system to do base initialization of the class structures of derived types. It is called as part of the initialization process of all derived classes and should reallocate or reset all dynamic class members copied over from the parent class. For example, class members (such as strings) that are not sufficiently handled by a plain memory copy of the parent class into the derived class have to be altered. See GClassInitFunc() for a discussion of the class intialization process.<