next up previous contents
Next: Calling SIDL methods from Up: C Bindings Previous: Header files   Contents

Mapping for classes, interfaces and arrays

Because C doesn't have builtin mechanisms for protecting the global namespace, the C mapping attempts to avoid namespace collisions by using struct and method names that incorporate all the naming information from the package, class and method names. For a type Z in package X.Y, the name of the type that C clients use for an object reference is X_Y_Z. X_Y_Z is defined as follows in the X_Y_Z.h header file:


struct X_Y_Z__object;
struct X_Y_Z__array;
typedef struct X_Y_Z__object* X_Y_Z;

This code fragment also shows that struct X_Y_Z__array is used for a multi-dimensional array of X.Y.Z objects. Here are some additional concrete examples of the object and interface reference types derived by the C mapping:


/**
 * Symbol "SIDL.BaseClass" (version 0.5.1)
 * 
 * Every class implicitly inherits from <code>BaseClass</code>.  This
 * class implements the methods in <code>BaseInterface</code>.
 */
struct SIDL_BaseClass__object;
struct SIDL_BaseClass__array;
typedef struct SIDL_BaseClass__object* SIDL_BaseClass;

/**
 * Symbol "SIDL.BaseInterface" (version 0.5.1)
 * 
 * Every interface in <code>SIDL</code> implicitly inherits
 * from <code>BaseInterface</code>, and it is implemented
 * by <code>BaseClass</code> below.
 */
struct SIDL_BaseInterface__object;
struct SIDL_BaseInterface__array;
typedef struct SIDL_BaseInterface__object* SIDL_BaseInterface;





babel-0.8.6
users_guide Last Modified 2003-07-09

http://www.llnl.gov/CASC/components
components@llnl.gov