Next: Some Not So Useful
Up: GAT Object Model
Previous: GAT Object Model
  Contents
In addition to introducing notions of class, subclass, superclass, inheritance...GAT also introduces the notion
of ``interface.'' The GAT interface model consists of a set of ``interfaces,'' see figure .
Figure:
Structure of the GAT interface inheritance tree.
|
[width=11cm]interfacetree
|
Each GAT ``interface'' consists of a struct containing function pointers. As C does not support interfaces,
the ``interfaces'' depicted in figure are simply a stand-in for interfaces with language
support .
To clarify the concept of interfaces in GAT let us consider a few examples. The class GATFile realizes the
interface GATInterface_ISerialisable, as rendered in figure .
Figure:
GATFile's realization of the interface GATInterface_ISerialisable.
|
[width=4cm]fileinterface
|
As a result of this realization, there exists a set of GATFile functions implementing this realization. These
functions are detailed in figure .
Figure:
Details of GATFile's realization of the interface GATInterface_ISerialisable.
|
[width=12cm]fileinterfacedetails
|
Similarly, the class GATEndpoint realizes the interface GATInterface_ISerialisable. Thus, there exist a
set of ``corresponding'' GATEndpoint functions implementing this realization, see figure
.
Figure:
Details of GATEndpoint's realization of the interface GATInterface_ISerialisable.
|
[width=13cm]endpointinterfacedetails
|
As previously mentioned, an interface in GAT is a struct containing a set of function pointers. For example,
these function pointers for the GATInterface_ISerialisable interface of GATFile are the functions
specified in figure above. To obtain reference to the struct containing these
function pointers one must use the ``GetInterface'' member function of the apropos GAT object.
As an example, in the case of a GATFile one would obtain such a struct as follows,
GATFile file;
GATResult result;
void const *serialisableInterface;
/* Create a new GATFile */
file = ...
/* Obtain the struct for the GATInterface_ISerialisable interface */
result = GATFile_GetInterface(file, GATInterface_ISerialisable, &serialisableInterface);
Upon successful return from the function GATFile_GetInterface the variable *serialisable
Interface will point to a struct containing the aforementioned functions.
Next: Some Not So Useful
Up: GAT Object Model
Previous: GAT Object Model
  Contents
Andre Merzky
2004-05-13
|