added g_list_insert_before().
[platform/upstream/glib.git] / docs / reference / gobject / tmpl / types.sgml
1 <!-- ##### SECTION Title ##### -->
2 GType
3
4 <!-- ##### SECTION Short_Description ##### -->
5 The GLib Runtime type identification and management system
6
7 <!-- ##### SECTION Long_Description ##### -->
8 <para>
9 The GType API is the foundation of the GObject system.  It provides the
10 facilities for registering and managing all fundamental data types,
11 user-defined object and interface types.  Before using any GType
12 or GObject functions, g_type_init() must be called to initialize the
13 type system.
14 </para>
15 <para>
16 For type creation and registration purposes, all types fall into one of
17 two categories: static or dynamic.  Static types are never loaded or
18 unloaded at run-time as dynamic types may be.  Static types are created
19 with g_type_register_static() that gets type specific information passed
20 in via a #GTypeInfo structure.
21 Dynamic types are created with g_type_register_dynamic() which takes a
22 #GTypePlugin structure instead. The remaining type information (the
23 #GTypeInfo structure) is retrived during runtime through #GTypePlugin
24 and the g_type_plugin_*() API.
25 These registration functions are usually called only once from a 
26 function whose only purpose is to return the type identifier for a 
27 specific class.  Once the type (or class or interface) is registered,
28 it may be instantiated, inherited, or implemented depending on exactly
29 what sort of type it is.
30 There is also a third registration function for registering fundamental
31 types called g_type_register_fundamental() which requires both a #GTypeInfo
32 structure and a GTypeFundamentalInfo structure but it is seldom used
33 since most fundamental types are predefined rather than user-defined.
34 </para>
35
36 <!-- ##### SECTION See_Also ##### -->
37 <para>
38
39 </para>
40
41 <!-- ##### TYPEDEF GType ##### -->
42 <para>
43 A numerical value which represents the unique identifier of a registered
44 type.
45 </para>
46
47
48 <!-- ##### MACRO G_TYPE_FUNDAMENTAL ##### -->
49 <para>
50 Returns #TRUE if @type is a fundamental data type such as #G_TYPE_INT or
51 #G_TYPE_POINTER. Fundamental types are types that serve as fundaments for
52 the derived types, thus they are the roots of distinct inheritance heirachies.
53 </para>
54
55 @type: A #GType value.
56
57
58 <!-- ##### MACRO G_TYPE_FUNDAMENTAL_MAX ##### -->
59 <para>
60 An integer constant that represents the number of identifiers reserved
61 for types that are assigned at compile-time.
62 </para>
63
64
65
66 <!-- ##### MACRO G_TYPE_DERIVE_ID ##### -->
67 <para>
68
69 </para>
70
71 @ptype: 
72 @branch_seqno: 
73
74
75 <!-- ##### MACRO G_TYPE_BRANCH_SEQNO ##### -->
76 <para>
77
78 </para>
79
80 @type: 
81
82
83 <!-- ##### MACRO G_TYPE_FUNDAMENTAL_LAST ##### -->
84 <para>
85 An integer that currently represents the highest value of all
86 fundamental type identifiers. This is of interest for dynamic
87 introduction of new fundamental types (a
88 <emphasis>rarely</emphasis> needed feature).
89 </para>
90
91
92
93 <!-- ##### MACRO G_TYPE_IS_ABSTRACT ##### -->
94 <para>
95 Returns #TRUE if @type is an abstract type.  An abstract type can not be
96 instantiated and is normally used as an abstract base class for
97 derived classes.
98 </para>
99
100 @type: A #GType value.
101
102
103 <!-- ##### MACRO G_TYPE_IS_DERIVED ##### -->
104 <para>
105 Returns #TRUE if @type is derived (or in object-oriented terminolgy:
106 inherited) from another type (this holds true for all non-fundamental
107 types).
108 </para>
109
110 @type: A #GType value.
111
112
113 <!-- ##### MACRO G_TYPE_IS_FUNDAMENTAL ##### -->
114 <para>
115 Returns #TRUE if @type is a fundamental type.
116 </para>
117
118 @type: A #GType value.
119
120
121 <!-- ##### MACRO G_TYPE_IS_VALUE_TYPE ##### -->
122 <para>
123
124 </para>
125
126 @type: A #GType value.
127
128
129 <!-- ##### MACRO G_TYPE_IS_CLASSED ##### -->
130 <para>
131 Returns #TRUE if @type is a classed type.
132 </para>
133
134 @type: A #GType value.
135
136
137 <!-- ##### MACRO G_TYPE_IS_INSTANTIATABLE ##### -->
138 <para>
139 Returns #TRUE if @type can be instantiated.  Instantiation is the
140 process of creating an instance (object) of this type.
141 </para>
142
143 @type: A #GType value.
144
145
146 <!-- ##### MACRO G_TYPE_IS_DERIVABLE ##### -->
147 <para>
148 Returns #TRUE if @type is a derivable type.  A derivable type can
149 be used as the base class of a flat (single-level) class hierarchy.
150 </para>
151
152 @type: A #GType value.
153
154
155 <!-- ##### MACRO G_TYPE_IS_DEEP_DERIVABLE ##### -->
156 <para>
157 Returns #TRUE if @type is a deep derivable type.  A deep derivable type
158 can be used as the base class of a deep (multi-level) class hierarchy.
159 </para>
160
161 @type: A #GType value.
162
163
164 <!-- ##### MACRO G_TYPE_IS_INTERFACE ##### -->
165 <para>
166 Returns #TRUE if @type is an interface type.
167 Interface types are types that provide pure APIs, the implementation
168 of which is provided by another type (which is then said to conform
169 to the interface).  GLib interfaces are somewhat analogous to Java
170 interfaces and C++ classes containing only pure virtual functions.
171 </para>
172
173 @type: A #GType value.
174
175
176 <!-- ##### ENUM GTypeFundamentals ##### -->
177 <para>
178 The predefined identifiers of the reserved fundamental types.
179 </para>
180
181 @G_TYPE_INVALID:                Usually a return value indicating an error.
182 @G_TYPE_NONE:                   A synonym for the "void" type in C.
183 @G_TYPE_INTERFACE:              Root type of all interface types.
184 @G_TYPE_CHAR:                   Identifier for the built-in type "gchar".
185 @G_TYPE_UCHAR:                  Identifier for the built-in type "guchar".
186 @G_TYPE_BOOLEAN:                Identifier for the built-in type "gboolean".
187 @G_TYPE_INT:                    Identifier for the built-in type "gint".
188 @G_TYPE_UINT:                   Identifier for the built-in type "guint".
189 @G_TYPE_LONG:                   Identifier for the built-in type "glong".
190 @G_TYPE_ULONG:                  Identifier for the built-in type "gulong".
191 @G_TYPE_ENUM:                   Identifier for the "#GEnum" type.
192 @G_TYPE_FLAGS:                  Identifier for the "#GFlags" type.
193 @G_TYPE_FLOAT:                  Identifier for the built-in type "gfloat".
194 @G_TYPE_DOUBLE:                 Identifier for the built-in type "gdouble".
195 @G_TYPE_STRING:                 Identifier for a pointer to a null-terminated string "gchar*".
196 @G_TYPE_POINTER:                Identifier for anonymous pointers "void*".
197 @G_TYPE_BOXED:                  Identifier for the "#GBoxed" type.
198 @G_TYPE_PARAM:                  Identifier for the "#GParam" type.
199 @G_TYPE_OBJECT:                 Identifier for the "#GObject" type.
200 @G_TYPE_RESERVED_BSE_FIRST:     First fundamental type ID reserved for BSE.
201 @G_TYPE_RESERVED_BSE_LAST:      Last fundamental type ID reserved for BSE.
202 @G_TYPE_RESERVED_LAST_FUNDAMENTAL: Last reserved fundamental type ID.
203 @G_TYPE_CLOSURE: 
204 @G_TYPE_VALUE: 
205 @G_TYPE_VALUE_ARRAY: 
206 @G_TYPE_GSTRING: 
207 @G_TYPE_PARAM_CHAR:             Identifier for the "#GParamSpecChar" type.
208 @G_TYPE_PARAM_UCHAR:            Identifier for the "#GParamSpecUChar" type.
209 @G_TYPE_PARAM_BOOLEAN:          Identifier for the "#GParamSpecBoolean" type.
210 @G_TYPE_PARAM_INT:              Identifier for the "#GParamSpecInt" type.
211 @G_TYPE_PARAM_UINT:             Identifier for the "#GParamSpecUInt" type.
212 @G_TYPE_PARAM_LONG:             Identifier for the "#GParamSpecLong" type.
213 @G_TYPE_PARAM_ULONG:            Identifier for the "#GParamSpecULong" type.
214 @G_TYPE_PARAM_UNICHAR: 
215 @G_TYPE_PARAM_ENUM:             Identifier for the "#GParamSpecEnum" type.
216 @G_TYPE_PARAM_FLAGS:            Identifier for the "#GParamSpecFlags" type.
217 @G_TYPE_PARAM_FLOAT:            Identifier for the "#GParamSpecFloat" type.
218 @G_TYPE_PARAM_DOUBLE:           Identifier for the "#GParamSpecDouble" type.
219 @G_TYPE_PARAM_STRING:           Identifier for the "#GParamSpecString" type.
220 @G_TYPE_PARAM_PARAM:            Identifier for the "#GParamSpecParam" type.
221 @G_TYPE_PARAM_BOXED:            Identifier for the "#GParamSpecBoxed" type.
222 @G_TYPE_PARAM_POINTER:          Identifier for the "#GParamSpecPointer" type.
223 @G_TYPE_PARAM_VALUE_ARRAY:      Identifier for the "#GParamSpecValueArray" type.
224 @G_TYPE_PARAM_CLOSURE:          Identifier for the "#GParamClosure" type.
225 @G_TYPE_PARAM_OBJECT:           Identifier for the "#GParamSpecObject" type.
226
227 <!-- ##### STRUCT GTypeInterface ##### -->
228 <para>
229 An opaque structure used as the base of all interface types.
230 </para>
231
232
233 <!-- ##### STRUCT GTypeInstance ##### -->
234 <para>
235 An opaque structure used as the base of all type instances.
236 </para>
237
238
239 <!-- ##### STRUCT GTypeInfo ##### -->
240 <para>
241 This structure is used to provide the type system with the information
242 required to initialize and destruct (finalize) a type's class and
243 instances thereof.
244 The initialized structure is passed to the g_type_register_static() function
245 (or is copied into the provided #GTypeInfo structure in the
246 g_type_plugin_complete_type_info()). The type system will perform a deep
247 copy of this structure, so it's memory does not need to be persistent
248 across invocation of g_type_register_static().
249 </para>
250
251 @class_size:     Size of the class structure (required for interface, classed and instantiatable types).
252 @base_init:      Location of the base initialization function (optional).
253 @base_finalize:  Location of the base finalization function (optional).
254 @class_init:     Location of the class initialization function (optional, for classed and instantiatable types only).
255 @class_finalize: Location of the class finalization function (optional).
256 @class_data:     User-supplied data passed to the class init/finalize functions.
257 @instance_size:  Size of the instance (object) structure (required for instantiatable types only).
258 @n_preallocs:    Number of pre-allocated (cached) instances to reserve memory for (0 indicates no caching).
259 @instance_init:  Location of the instance initialization function (optional, for instantiatable types only).
260 @value_table:    A #GTypeValueTable function table for generic handling of GValues of this type (usualy only
261                  usefull for fundamental types).
262
263 <!-- ##### STRUCT GTypeFundamentalInfo ##### -->
264 <para>
265 A structure that provides information to the type system which is
266 used specifically for managing fundamental types.  
267 </para>
268
269 @type_flags: 
270
271 <!-- ##### STRUCT GInterfaceInfo ##### -->
272 <para>
273 A structure that provides information to the type system which is
274 used specifically for managing interface types.
275 </para>
276
277 @interface_init:        Location of the function that initializes the interface.
278 @interface_finalize:    Location of the function that finalizes the interface.
279 @interface_data:        Location of user data passed to the @interface_init and
280                         @interface_finalize functions (optional).
281
282 <!-- ##### MACRO G_TYPE_FROM_INSTANCE ##### -->
283 <para>
284 Returns the type identifier from a given @instance structure.
285 </para>
286
287 @instance: Location of a valid #GTypeInstance structure.
288
289
290 <!-- ##### MACRO G_TYPE_FROM_CLASS ##### -->
291 <para>
292 Returns the type identifier from a given @class structure.
293 </para>
294
295 @g_class: Location of a valid #GTypeClass structure.
296
297
298 <!-- ##### MACRO G_TYPE_FROM_INTERFACE ##### -->
299 <para>
300 Returns the type identifier from a given @interface structure.
301 </para>
302
303 @g_iface: Location of a valid #GTypeInterface structure.
304
305
306 <!-- ##### MACRO G_TYPE_INSTANCE_GET_CLASS ##### -->
307 <para>
308 Returns the class structure of a given @instance, casted
309 to a specified anchestor type @g_type of the instance.
310 </para>
311
312 @instance:      Location of the #GTypeInstance structure.
313 @g_type:        The anchestor type of the class to be returned.
314 @c_type:        The corresponding C type of @g_Type.
315
316
317 <!-- ##### MACRO G_TYPE_INSTANCE_GET_INTERFACE ##### -->
318 <para>
319
320 </para>
321
322 @instance: 
323 @g_type: 
324 @c_type: 
325
326
327 <!-- ##### MACRO G_TYPE_CHECK_INSTANCE ##### -->
328 <para>
329
330 </para>
331
332 @instance: 
333
334
335 <!-- ##### MACRO G_TYPE_CHECK_INSTANCE_CAST ##### -->
336 <para>
337
338 </para>
339
340 @instance: 
341 @g_type: 
342 @c_type: 
343
344
345 <!-- ##### MACRO G_TYPE_CHECK_INSTANCE_TYPE ##### -->
346 <para>
347
348 </para>
349
350 @instance: 
351 @g_type: 
352
353
354 <!-- ##### MACRO G_TYPE_CHECK_CLASS_CAST ##### -->
355 <para>
356
357 </para>
358
359 @g_class: 
360 @g_type: 
361 @c_type: 
362
363
364 <!-- ##### MACRO G_TYPE_CHECK_CLASS_TYPE ##### -->
365 <para>
366
367 </para>
368
369 @g_class: 
370 @g_type: 
371
372
373 <!-- ##### MACRO G_TYPE_CHECK_VALUE ##### -->
374 <para>
375
376 </para>
377
378 @value: 
379
380
381 <!-- ##### MACRO G_TYPE_CHECK_VALUE_TYPE ##### -->
382 <para>
383
384 </para>
385
386 @value: 
387 @g_type: 
388
389
390 <!-- ##### MACRO G_TYPE_FLAG_RESERVED_ID_BIT ##### -->
391 <para>
392
393 </para>
394
395
396
397 <!-- ##### FUNCTION g_type_init ##### -->
398 <para>
399 Prior to any use of the type system, g_type_init() has to be called to initialize
400 the type system and assorted other code portions (such as the various fundamental
401 type implementations or the signal system).
402 </para>
403
404 <!-- # Unused Parameters # -->
405 @debug_flags: Bitwise combination of #GTypeDebugFlags values for debugging purposes.
406
407
408 <!-- ##### FUNCTION g_type_name ##### -->
409 <para>
410 Return the unique name that is assigned to a type ID (this is the preferred method
411 to find out whether a specific type has been registered for the passed in ID yet).
412 </para>
413
414 @type:          Type to return name for.
415 @Returns:       Static type name or NULL.
416
417
418 <!-- ##### FUNCTION g_type_qname ##### -->
419 <para>
420 Return the corresponding quark of the type IDs name.
421 </para>
422
423 @type:    Type to return quark of type name for.
424 @Returns: The type names quark or 0.
425
426
427 <!-- ##### FUNCTION g_type_from_name ##### -->
428 <para>
429 Lookup the type ID from a given type name, returns 0 if no type has been registered under this name
430 (this is the preferred method to find out by name whether a specific type has been registered yet).
431 </para>
432
433 @name:    Type name to lookup.
434 @Returns: Corresponding type ID or 0.
435
436
437 <!-- ##### FUNCTION g_type_parent ##### -->
438 <para>
439 Return the direct parent type of the passed in type.
440 If the passed in type has no parent, i.e. is a fundamental type, 0 is returned.
441 </para>
442
443 @type:    The derived type.
444 @Returns: The parent type.
445
446
447 <!-- ##### FUNCTION g_type_next_base ##### -->
448 <para>
449 Given a @leaf_type and a @root_type which is contained in its anchestry, return
450 the type that @root_type is the immediate parent of.
451 In other words, this function determines the type that is derived directly from
452 @root_type which is also a base class of @leaf_type.  Given a root type and a
453 leaf type, this function can be used to determine the types and order in which
454 the leaf type is descended from the root type.
455 </para>
456
457 @leaf_type:     Descendant of @root_type and the type to be returned.
458 @root_type:     Immediate parent of the returned type.
459 @Returns:       Immediate child of @root_type and anchestor of @leaf_type.
460
461
462 <!-- ##### FUNCTION g_type_is_a ##### -->
463 <para>
464 Check whether @type is a descendant of @is_a_type.
465 </para>
466
467 @type:      Type to check anchestry for.
468 @is_a_type: Possible anchestor of @type.
469 @Returns:   %TRUE if @type is_a @is_a_type holds true.
470
471
472 <!-- ##### FUNCTION g_type_fundamental_branch_last ##### -->
473 <para>
474
475 </para>
476
477 @type: 
478 @Returns: 
479
480
481 <!-- ##### FUNCTION g_type_class_ref ##### -->
482 <para>
483 Increments the reference count of the class structure belonging to
484 @type. This function will demand-create the class if it doesn't
485 exist already.
486 </para>
487
488 @type:    Type ID of a classed type.
489 @Returns: The #GTypeClass structure for the given type ID.
490
491
492 <!-- ##### FUNCTION g_type_class_peek ##### -->
493 <para>
494 This function is essentially the same as g_type_class_ref(), except that
495 the classes reference count isn't incremented. Therefore, this function
496 may return NULL if the class of the type passed in does not currently
497 exist (hasn't been referenced before).
498 </para>
499
500 @type:          Type ID of a classed type.
501 @Returns:       The #GTypeClass structure for the given type ID or NULL
502                 if the class does not currently exist.
503
504
505 <!-- ##### FUNCTION g_type_class_unref ##### -->
506 <para>
507 Decrements the reference count of the class structure being passed in.
508 Once the last reference count of a class has been released, classes
509 may be finalized by the type system, so further dereferencing of a
510 class pointer after g_type_class_unref() are invalid.
511 </para>
512
513 @g_class:       The #GTypeClass structure to unreference.
514
515
516 <!-- ##### FUNCTION g_type_class_peek_parent ##### -->
517 <para>
518 This is a convenience function, often needed in class intializers.
519 It essentially takes the immediate parent type of the class passed in,
520 and returns the class structure thereof. Since derived classes hold
521 a reference count on their parent classes as long as they are instantiated,
522 the returned class will always exist. This function is essentially
523 equivalent to:
524
525 <msgtext><programlisting>
526 g_type_class_peek (g_type_parent (G_TYPE_FROM_CLASS (g_class)));
527 </programlisting></msgtext>
528
529 </para>
530
531 @g_class: The #GTypeClass structure to retrive the parent class for.
532 @Returns: The parent class of @g_class.
533
534
535 <!-- ##### FUNCTION g_type_interface_peek ##### -->
536 <para>
537
538 </para>
539
540 @instance_class: 
541 @iface_type: 
542 @Returns: 
543
544
545 <!-- ##### FUNCTION g_type_children ##### -->
546 <para>
547 Return a newly allocated and 0 terminated array of type IDs, listing the
548 child types of @type. The return value has to be g_free()ed after use.
549 </para>
550
551 @type:       The parent type.
552 @n_children: Optional #guint pointer to contain the number of child types.
553 @Returns:    Newly allocated and 0 terminated array of child types.
554
555
556 <!-- ##### FUNCTION g_type_interfaces ##### -->
557 <para>
558 Return a newly allocated and 0 terminated array of type IDs, listing the
559 interface types that @type conforms to. The return value has to be
560 g_free()ed after use.
561 </para>
562
563 @type:         The type to list interface types for.
564 @n_interfaces: Optional #guint pointer to contain the number of interface types.
565 @Returns:      Newly allocated and 0 terminated array of interface types.
566
567
568 <!-- ##### FUNCTION g_type_set_qdata ##### -->
569 <para>
570
571 </para>
572
573 @type: 
574 @quark: 
575 @data: 
576
577
578 <!-- ##### FUNCTION g_type_get_qdata ##### -->
579 <para>
580
581 </para>
582
583 @type: 
584 @quark: 
585 @Returns: 
586
587
588 <!-- ##### USER_FUNCTION GBaseInitFunc ##### -->
589 <para>
590 A callback function used by the type system to do base initialization
591 of the class structures of derived types. It is called as part of the
592 initialization process of all derived classes and should reallocate
593 or reset all dynamic class members copied over from the parent class.
594 Therefore class members, e.g. strings, that are not sufficiently
595 handled by a plain memory copy of the parent class into the derived class
596 have to be altered. See GClassInitFunc() for a discussion of the class
597 intialization process.
598 </para>
599
600 @g_class: The #GTypeClass structure to initialize.
601
602
603 <!-- ##### USER_FUNCTION GBaseFinalizeFunc ##### -->
604 <para>
605 A callback function used by the type system to finalize those portions
606 of a derived types class structure that were setup from the corresponding
607 GBaseInitFunc() function. Class finalization basically works the inverse
608 way in which class intialization is performed.
609 See GClassInitFunc() for a discussion of the class intialization process.
610 </para>
611
612 @g_class: The #GTypeClass structure to finalize.
613
614
615 <!-- ##### USER_FUNCTION GClassInitFunc ##### -->
616 <para>
617 A callback function used by the type system to initialize the class
618 of a specific type. This function should initialize all static class
619 members.
620 The initialization process of a class involves:
621 <variablelist>
622   <varlistentry><term></term><listitem><para>
623         1 - Copying common members from the parent class over to the
624         derived class structure.
625   </para></listitem></varlistentry>
626   <varlistentry><term></term><listitem><para>
627         2 -  Zero initialization of the remaining members not copied
628         over from the parent class.
629   </para></listitem></varlistentry>
630   <varlistentry><term></term><listitem><para>
631         3 - Invocation of the GBaseInitFunc initializers of all parent
632         types and the class' type.
633   </para></listitem></varlistentry>
634   <varlistentry><term></term><listitem><para>
635         4 - Invocation of the class' GClassInitFunc initializer.
636   </para></listitem></varlistentry>
637 </variablelist>
638 Since derived classes are partially initialized through a memory copy
639 of the parent class, the general rule is that GBaseInitFunc() and
640 GBaseFinalizeFunc() should take care of necessary reinitialization
641 and release of those class members that were introduced by the type
642 that specified these GBaseInitFunc()/GBaseFinalizeFunc().
643 GClassInitFunc() should only care about intializing static
644 class members, while dynamic class members (such as allocated strings
645 or reference counted resources) are better handled by a GBaseInitFunc()
646 for this type, so proper initialization of the dynamic class members
647 are performed for class intialization of derived types as well.
648 An example may help to corrsepond the intend of the different class
649 initializers:
650
651 <msgtext><programlisting>
652 typedef struct {
653   GObjectClass parent_class;
654   gint         static_integer;
655   gchar       *dynamic_string;
656 } TypeAClass;
657 static void
658 type_a_base_class_init (TypeAClass *class)
659 {
660   class->dynamic_string = g_strdup ("some string");
661 }
662 static void
663 type_a_base_class_finalize (TypeAClass *class)
664 {
665   g_free (class->dynamic_string);
666 }
667 static void
668 type_a_class_init (TypeAClass *class)
669 {
670   class->static_integer = 42;
671 }
672
673 typedef struct {
674   TypeAClass   parent_class;
675   gfloat       static_float;
676   GString     *dynamic_gstring;
677 } TypeBClass;
678 static void
679 type_b_base_class_init (TypeBClass *class)
680 {
681   class->dynamic_gstring = g_string_new ("some other string);
682 }
683 static void
684 type_b_base_class_finalize (TypeBClass *class)
685 {
686   g_string_free (class->dynamic_gstring);
687 }
688 static void
689 type_b_class_init (TypeBClass *class)
690 {
691   class->static_float = 3.14159265358979323846;
692 }
693 </programlisting></msgtext>
694 Initialization of TypeBClass will first cause initialization of
695 TypeAClass (derived classes reference their parent classes, see
696 g_type_class_ref() on this).
697 Initialization of TypeAClass roughly involves zero-intializing its fields,
698 then calling its GBaseInitFunc() type_a_base_class_init() that allocates
699 its dynamic members (dynamic_string) and finally calling its GClassInitFunc()
700 type_a_class_init() to initialize its static members (static_integer).
701 The first step in the initialization process of TypeBClass is then
702 a plain memory copy of the contents of TypeAClass into TypeBClass and 
703 zero intialization of the remaining fields in TypeBClass.
704 The dynamic members of TypeAClass within TypeBClass now need
705 reinitialization which is performed by calling type_a_base_class_init()
706 with an argument of TypeBClass.
707 After that, the GBaseInitFunc() of TypeBClass, type_b_base_class_init()
708 is called to allocate the dynamic members of TypeBClass (dynamic_gstring),
709 and finally the GClassInitFunc() of TypeBClass, type_b_class_init(),
710 is called to complete the initialization process with the static members
711 (static_float).
712 Corresponding finalization counter parts to the GBaseInitFunc() functions
713 have to be provided to release allocated resources at class finalization
714 time.
715 </para>
716
717 @g_class:       The #GTypeClass structure to initialize.
718 @class_data:    The @class_data member supplied via the #GTypeInfo structure.
719
720
721 <!-- ##### USER_FUNCTION GClassFinalizeFunc ##### -->
722 <para>
723 A callback function used by the type system to finalize a class.
724 This function is rarely needed, as dynamically allocated class resources
725 should be handled by GBaseInitFunc() and GBaseFinalizeFunc().
726 Also, specification of a GClassFinalizeFunc in the #GTypeInfo
727 structure of a static type is invalid, because classes of static types
728 will never be finalized (they are artificially kept alive when their
729 reference count drops to zero).
730 </para>
731
732 @g_class:       The #GTypeClass structure to finalize.
733 @class_data:    The @class_data member supplied via the #GTypeInfo structure.
734
735
736 <!-- ##### USER_FUNCTION GInstanceInitFunc ##### -->
737 <para>
738 A callback function used by the type system to initialize a new
739 instance of a type. This function initializes all instance members and
740 allocates any resources require by it.
741 Initialization of a derived instance involves calling all its parent
742 types instance initializers, therefore the class member of the instance
743 is altered during its initialization to always point to the class that
744 belongs to the type the current initializer was introduced for.
745 </para>
746
747 @instance:      The instance to initialize.
748 @g_class:       The class of the type the instance is created for.
749
750
751 <!-- ##### USER_FUNCTION GInterfaceInitFunc ##### -->
752 <para>
753 A callback function used by the type system to initialize a new
754 interface.  This function should initialize all internal data and
755 allocate any resources required by the interface.
756 </para>
757
758 @g_iface:       The interface structure to initialize.
759 @iface_data:    The @class_data supplied via the #GTypeInfo structure.
760
761
762 <!-- ##### USER_FUNCTION GInterfaceFinalizeFunc ##### -->
763 <para>
764 A callback function used by the type system to finalize an interface.
765 This function should destroy any internal data and release any resources
766 allocated by the corresponding GInterfaceInitFunc() function.
767 </para>
768
769 @g_iface:       The interface structure to finalize.
770 @iface_data:    The @class_data supplied via the #GTypeInfo structure.
771
772
773 <!-- ##### USER_FUNCTION GTypeClassCacheFunc ##### -->
774 <para>
775
776 </para>
777
778 @cache_data: 
779 @g_class: 
780 @Returns: 
781
782
783 <!-- ##### ENUM GTypeFlags ##### -->
784 <para>
785 Bit masks used to check or determine characteristics of a type.
786 </para>
787
788 @G_TYPE_FLAG_ABSTRACT:  Indicates an abstract type. No instances can be
789                         created for an abstract type.
790 @G_TYPE_FLAG_VALUE_ABSTRACT: 
791
792 <!-- ##### ENUM GTypeFundamentalFlags ##### -->
793 <para>
794 Bit masks used to check or determine specific characteristics of a
795 fundamental type.
796 </para>
797
798 @G_TYPE_FLAG_CLASSED:           Indicates a classed type.
799 @G_TYPE_FLAG_INSTANTIATABLE:    Indicates an instantiable type (implies classed).
800 @G_TYPE_FLAG_DERIVABLE:                 Indicates a flat derivable type.
801 @G_TYPE_FLAG_DEEP_DERIVABLE:    Indicates a deep derivable type (implies derivable).
802
803 <!-- ##### FUNCTION g_type_register_static ##### -->
804 <para>
805 Registers @type_name as the name of a new static type derived from
806 @parent_type.  The type system uses the information contained in the
807 #GTypeInfo structure pointed to by @info to manage the type and its
808 instances (if not abstract).  The value of @flags determines the nature
809 (e.g. abstract or not) of the type.
810 </para>
811
812 @parent_type:   Type which this type will be derived from.
813 @type_name:     Null-terminated string used as the name of the new type.
814 @info:          The #GTypeInfo structure for this type.
815 @flags:                 Bitwise combination of #GTypeFlags values.
816 @Returns:       The new type identifier.
817
818
819 <!-- ##### FUNCTION g_type_register_dynamic ##### -->
820 <para>
821 Registers @type_name as the name of a new dynamic type derived from
822 @parent_type.  The type system uses the information contained in the
823 #GTypePlugin structure pointed to by @plugin to manage the type and its
824 instances (if not abstract).  The value of @flags determines the nature
825 (e.g. abstract or not) of the type.
826 </para>
827
828 @parent_type:   Type which this type will be derived from.
829 @type_name:     Null-terminated string used as the name of the new type.
830 @plugin:        The #GTypePlugin structure to retrive the #GTypeInfo from.
831 @flags:                 Bitwise combination of #GTypeFlags values.
832 @Returns:       The new type identifier.
833 <!-- # Unused Parameters # -->
834 @Returns: #G_TYPE_INVALID if registration failed or the new type identifier.
835
836
837 <!-- ##### FUNCTION g_type_register_fundamental ##### -->
838 <para>
839 Registers @type_id as the predefined identifier and @type_name as the
840 name of a fundamental type.  The type system uses the information
841 contained in the #GTypeInfo structure pointed to by @info and the 
842 #GTypeFundamentalInfo structure pointed to by @finfo to manage the
843 type and its instances.  The value of @flags determines additional
844 characteristics of the funamental type.
845 </para>
846
847 @type_id:       A predefined #GTypeFundamentals value.
848 @type_name:     Null-terminated string used as the name of the new type.
849 @info:          The #GTypeInfo structure for this type.
850 @finfo:                 The #GTypeFundamentalInfo structure for this type.
851 @flags:                 Bitwise combination of #GTypeFlags values.
852 @Returns:       The predefined type identifier.
853
854
855 <!-- ##### FUNCTION g_type_add_interface_static ##### -->
856 <para>
857 Adds the static @interface_type to @instantiable_type.  The information
858 contained in the #GTypeInterfaceInfo structure pointed to by @info
859 is used to manage the relationship.
860 </para>
861
862 @instance_type:          #GType value of an instantiable type.
863 @interface_type: #GType value of an interface type.
864 @info:           The #GInterfaceInfo structure for this
865                  (@instance_type, @interface_type) combination.
866
867
868 <!-- ##### FUNCTION g_type_add_interface_dynamic ##### -->
869 <para>
870 </para>
871
872 @instance_type: 
873 @interface_type: 
874 @plugin: 
875
876
877 <!-- ##### FUNCTION g_type_get_plugin ##### -->
878 <para>
879 Returns the the #GTypePlugin structure for @type or
880 #NULL if @type does not have a #GTypePlugin structure.
881 </para>
882
883 @type:          The #GType to retrive the plugin for.
884 @Returns:       The corresponding plugin if @type is a dynamic type,
885                 NULL otherwise.
886
887
888 <!-- ##### FUNCTION g_type_interface_get_plugin ##### -->
889 <para>
890 </para>
891
892 @instance_type: 
893 @implementation_type: 
894 @Returns: 
895
896
897 <!-- ##### FUNCTION g_type_fundamental_last ##### -->
898 <para>
899 Returns the last fundamental type which is registered plus one,
900 i.e. the next fundamental type ID that may be registered.
901 </para>
902
903 @Returns: The nextmost not registered fundamental type ID.
904
905
906 <!-- ##### FUNCTION g_type_check_flags ##### -->
907 <para>
908 Determines whether a given set of #GTypeFlags and #GTypeFundamentalFlags
909 are set for @type.
910 </para>
911
912 @type:    The type to check for flags.
913 @flags:   Bitwise combination of #GTypeFlags and #GTypeFundamentalFlags.
914 @Returns: #TRUE if all @flags are set for @type, #FALSE otherwise.
915
916
917 <!-- ##### FUNCTION g_type_create_instance ##### -->
918 <para>
919 Creates and initializes an instance of @type if @type is valid and can
920 be instantiated. The type system only performs basic allocation and
921 structure setups for instances, actuall instance creation should happen
922 through functions supplied by the types fundamental type implementation.
923 So use of g_type_create_instance() is reserved for implementators of
924 fundamental types only. E.g. instances of the #GObject heirachy
925 should be created via g_object_new() and <emphasis>never</emphasis>
926 directly through g_type_create_instance() which doesn't handle
927 things like singleton objects or object construction.
928 </para>
929
930 @type:    An instantiabtable type to create an instance for.
931 @Returns: An allocated and initialized instance, subject to further
932           treatment by the fundamental type implementation.
933
934
935 <!-- ##### FUNCTION g_type_free_instance ##### -->
936 <para>
937 </para>
938
939 @instance: 
940
941
942 <!-- ##### FUNCTION g_type_add_class_cache_func ##### -->
943 <para>
944
945 </para>
946
947 @cache_data: 
948 @cache_func: 
949
950
951 <!-- ##### FUNCTION g_type_remove_class_cache_func ##### -->
952 <para>
953
954 </para>
955
956 @cache_data: 
957 @cache_func: 
958
959
960 <!-- ##### FUNCTION g_type_class_unref_uncached ##### -->
961 <para>
962
963 </para>
964
965 @g_class: 
966
967
968 <!-- ##### FUNCTION g_type_check_instance ##### -->
969 <para>
970 Private helper function to aid implementation of the G_TYPE_CHECK_INSTANCE()
971 macro.
972 </para>
973
974 @instance: A valid #GTypeInstance structure.
975 @Returns:  #TRUE if @instance is valid, #FALSE otherwise.
976
977
978 <!-- ##### FUNCTION g_type_check_instance_cast ##### -->
979 <para>
980 </para>
981
982 @instance: 
983 @iface_type: 
984 @Returns: 
985
986
987 <!-- ##### FUNCTION g_type_instance_is_a ##### -->
988 <para>
989 Determines if @instance adhears to the interface exported
990 by @iface_type. @iface_type is eitehr a type that @instance
991 is derived from, or an interface type that is suppoted by
992 the anchestry of @instance.
993 </para>
994
995 @instance:      A valid #GTypeInstance structure.
996 @iface_type:    A #GType value.
997 @Returns:       #TRUE if @instance conforms to @iface_type, #FALSE otherwise.
998
999
1000 <!-- ##### FUNCTION g_type_check_class_cast ##### -->
1001 <para>
1002 </para>
1003
1004 @g_class: 
1005 @is_a_type: 
1006 @Returns: 
1007
1008
1009 <!-- ##### FUNCTION g_type_class_is_a ##### -->
1010 <para>
1011 </para>
1012
1013 @g_class: 
1014 @is_a_type: 
1015 @Returns: 
1016
1017
1018 <!-- ##### FUNCTION g_type_check_value ##### -->
1019 <para>
1020 </para>
1021
1022 @value: 
1023 @Returns: 
1024
1025
1026 <!-- ##### FUNCTION g_type_value_table_peek ##### -->
1027 <para>
1028 Returns the location of the #GTypeValueTable associated with @type.
1029 <emphasis>Note, this function should only be used from source code
1030 that implements or has internal knowledge of the implementation of
1031 @type.</emphasis>
1032 </para>
1033
1034 @type:    A #GType value.
1035 @Returns: Location of the #GTypeValueTable associated with @type or
1036           #NULL if there is no #GTypeValueTable associated with @type.
1037
1038