next up previous contents index
Next: Strings Up: XDR Functions Previous: Basic GRAPE XDR Functions

Structures

We will use the SUPROP_DEV structure (see 7.1.1) which consists of four VEC3 and two double variables as an example on how structures are handled:

bool_t g_xdr_suprop_dev(XDR *xdrp, SUPROP_DEV *sd)
{
  return (g_xdr_vec3(xdrp, sd->emission) &&
          g_xdr_vec3(xdrp, sd->ambient) &&
          g_xdr_vec3(xdrp, sd->diffuse) &&
          g_xdr_vec3(xdrp, sd->specular) &&
            xdr_double(xdrp, &sd->specular_exp) &&
            xdr_double(xdrp, &sd->transparency));
}
The elements of the structure are handled one after the other, combining the XDR calls with && guarantees that the function is terminated and FALSE is returned if one of the XDR calls fails.

Currently XDR functions are provided for the GRAPE structures REFINE2/3D, SUPROP_DEV, LIGHTSOURCE_DEV and DEPTHCUE_TYPE, the name of the function always consists of the g_xdr_ prefix followed by the structure's typedef name in lowercase letters.



SFB 256 Universität Bonn and IAM Universität Freiburg

Copyright © by the Sonderforschungsbereich 256 at the Institut für Angewandte Mathematik, Universität Bonn.