Next: GAT Interface Model
Up: GAT Object Model
Previous: C ain't Object Oriented
  Contents
The GAT API is an object oriented API which makes use of several primitives of object oriented programming
such as encapsulation, inheritance, interfaces, polymorphism, ...C, however, doesn't naturally support any
of these constructs. So, the introduction of these constructs in to the C version of GAT API in many cases required
the reinvention of the wheel. However, you, the fearless application programmer, will never have to walk these
minefields but will only reap the many benefits of this Sisyphean task.
The GAT object model consists of a set of ``classes'' arranged in a shallow ``inheritance'' tree, see figure
.
Figure:
Structure of the GAT class inheritance tree.
|
[width=]inheritancetree
|
Each GAT ``class'' consists of an opaque pointer, the details of which will never be of concern to the application
programmer. Furthermore, as C does not natively support inheritance, the ``inheritance'' depicted in figure
is actually a stand-in for an inheritance with language support . The means through which inheritance in actually implemented in GAT will never be of concern to the
application programmer; however, the repercussions of this inheritance are of concern to the application
programmer and are our next topic of discussion.
The class GATObject, from which all GAT classes inherit, posses a set of various functions, see figure
.
Figure:
Structure of GATObject.
|
[width=]object
|
where GATType is an enum whose values correspond to the various GAT types, GATObject_const
is a const version of GATObject, GATResult indicates a function's completion status,
GATBool is a boolean, and GATInterface is and enum whose values correspond to the
various GAT interfaces. (Interfaces are a topic which we will examine in the next subsection.) Each subclass of
this GATObject possess a set of ``corresponding'' functions. So, for example, the class GATTime has
the functions depicted in figure .
Figure:
Structure of GATTime.
|
[width=]time
|
Furthermore, for each subclass of GATObject there exists a set of utility functions which allow
one to convert this subclass to a GATObject and from a GATObject. So, for example,
in the case of GATTime this set of utility functions is given by
GATTime GATObject_ToGATTime(GATObject object)
GATObject GATTime_ToGATObject(GATTime derived)
GATTime_const GATObject_ToGATTime_const(GATObject_const object)
GATObject_const GATTime_ToGATObject_const(GATTime_const derived)
A class possessing these two properties, functions corresponding to the GATObject functions and the ability
to convert to and from a GATObject, is said to inherit from GATObject. The full set of such GAT classes
are depicted in figure .
Figure:
The full set of GAT classes.
|
[width=]gatclasses
|
Next: GAT Interface Model
Up: GAT Object Model
Previous: C ain't Object Oriented
  Contents
Andre Merzky
2004-05-13
|