Next: , Up: The Concept of Operations   [Contents][Index]


1.1.1 The GLib Dynamic Type System

Information on the project’s data types are stored in The GLib Dynamic Type System1. The GLib Dynamic Type System’s model for a data type is that you create a class and then make instances of that class. For it, each type can be described with the following information

This type system has inheritance: each type may be a specialization of a parent type. Note that the class-and-instance capability of The GLib Dynamic Type System is its own unique beast: not identical to C++ classes or to GOOPS.

When the introspection layer describes constants, variables, and function arguments, each of these must have a type that is registered by The GLib Dynamic Type System. There are a set of fundamental GType IDs, denoted with the form G_TYPE_XXX, and the type of each variable or argument traces to a fundamental GType ID or one that is subclassed from a fundamental type.

To allow introspection, there are GType IDs for all the standard native types: char has G_TYPE_CHAR, int has G_TYPE_INT, etc. Each enumerated type or collection of flags has its own type, which is a subclass of G_TYPE_FLAGS or G_TYPE_ENUM. Types that describe information stored in a typed pointer, such as native struct, each have their own type that is a subclass of G_TYPE_BOXED.

And, most importantly for GTK, there are types that descend from G_TYPE_OBJECT. As we’ll discuss in the next section, GObject is the fundamental type providing the common attributes and methods for all object types in GTK+, Pango, and other libraries based on GObject.


Footnotes

(1)

The GLib Dynamic Type System is sometimes called GType for short, but, since the word GType is used for other things, we’ll keep using the full name ad nauseum.


Next: The GObject Class, Up: The Concept of Operations   [Contents][Index]