The SEDRIS Data Representation Model
APPENDIX C - Types
SE_DRM_Field_Structure
/*
 * STRUCT: SE_DRM_Field_Structure
 *
 *   Used in SE_DRM_Type_Structure to provide meta-data (the name, length,
 *   offset, etc.) about a field within a C struct. (Also used in
 *   SE_Class_Structure to provide meta-data about a class' fields.)  This
 *   meta-data is available for all the C 'typedefs' defined in the SEDRIS
 *   DRM. The list of SEDRIS C 'typedefs' is defined by the SE_DRM_Type
 *   enumeration, and the function to obtain the meta-data for any of those
 *   'typedefs' is SE_GetDRMTypeStructure().
 *
 *   name_ptr - name of field, e.g. "length" is the name of the 1st
 *              member of the SE_String type
 *
 *   offset - offset (in bytes). Within an SE_Class_Structure, offset is
 *            measured from the beginning of the class' fields, while within
 *            an SE_DRM_Type_Structure, it is measured from the beginning of
 *            the type definition.
 *
 *   size -  size (in bytes) of field
 *
 *   field_modifier - whether, when the field was declared within the typedef,
 *      it was modified by a pointer or an array symbol next to the field name.
 *      The answer can be:
 *        a 1-dimensional array
 *        a 2-dimensional array
 *        a pointer
 *        a union (unions are special - they count as modifiers)
 *        just a plain field (a field with no modifications)
 *
 *   underlying_drm_type - specifies the field's underlying type, unless this
 *                         is a union field (in which case it is
 *                         SE_DRM_TYP_NULL). Note that this is stored as
 *                         an SE_Integer rather than an SE_DRM_Type,
 *                         to allow its use for more than one version of
 *                         the DRM at a time (backward/forward compatibility).
 *
 * EXAMPLES:
 * EDCS_Classification_Code tag, the first field of <Classification Data>,
 * has
 *        name_ptr            = "tag";
 *        offset              = offsetof(SE_Classification_Data_Fields, tag);
 *        size                = sizeof(EDCS_Classification_Code);
 *        field_modifier      = SE_FLD_MDFR_PLAIN;
 *        underlying_drm_type = SE_DRM_TYP_EDCS_CLASSIFICATION_CODE;
 *        first_dimension     = 0;
 *        second_dimension    = 0;
 *        union_member_count  = 0;
 *        union_members       = NULL;
 *
 * SRM_Long_Float mat[3][3], the first field of SRM_Matrix_3x3, has
 *        name_ptr            = "mat";
 *        offset              = offsetof(SE_Matrix_3x3, mat);
 *        size                = sizeof(SRM_Long_Float[3][3]);
 *        field_modifier      = SE_FLD_MDFR_2D_ARRAY;
 *        underlying_drm_type = SE_DRM_TYP_SRM_LONG_FLOAT;
 *        first_dimension     = 3;
 *        second_dimension    = 3;
 *        union_member_count  = 0;
 *        union_members       = NULL;
 *
 * SE_Character *characters, the 2nd field of SE_String, has
 *        name_ptr            = "characters";
 *        offset              = offsetof(SE_String, characters);
 *        size                = sizeof(SE_Character *);
 *        field_modifier      = SE_FLD_MDFR_POINTER;
 *        underlying_drm_type = SE_DRM_TYP_SE_CHARACTER;
 *        first_dimension     = 0;
 *        second_dimension    = 0;
 *        union_member_count  = 0;
 *        union_members       = NULL;
 *
 * union u in SE_Colour_Data
 *        name_ptr            = "u";
 *        offset              = offsetof(SE_Colour_Data,u);
 *        size                = MAX(sizeof(SE_CMY_Data),
 *                                  MAX(sizeof(HSV_Data), sizeof(RGB_Data));
 *        field_modifier      = SE_FLD_MDFR_UNION;
 *        underlying_drm_type = (SE_Integer)SE_NULL_DRM_TYPE;
 *        first_dimension     = 0;
 *        second_dimension    = 0;
 *        union_member_count  = 3;
 *
 *        union_members[0].name_ptr       = "cmy";
 *        union_members[0].offset         = 0; // from beginning of union
 *        union_members[0].size           = sizeof(SE_CMY_Data);
 *        union_members[0].field_modifier    = SE_FLD_MDFR_PLAIN;
 *        union_members[0].underlying_drm_type = SE_DRM_TYP_SE_CMY_DATA;
 *        union_members[0].first_dimension   = 0;
 *        union_members[0].second_dimension  = 0;
 *        union_members[0].union_member_count = 0;
 *        union_members[0].union_members     = NULL;
 *
 *        union_members[1].name_ptr       = "hsv";
 *        union_members[1].offset         = 0; // from beginning of union
 *        union_members[1].size           = sizeof(SE_HSV_Data);
 *        union_members[1].field_modifier    = SE_FLD_MDFR_PLAIN;
 *        union_members[1].underlying_drm_type = SE_DRM_TYP_SE_HSV_DATA;
 *        union_members[1].first_dimension   = 0;
 *        union_members[1].second_dimension  = 0;
 *        union_members[1].union_member_count = 0;
 *        union_members[1].union_members     = NULL;
 *
 *        union_members[2].name_ptr       = "rgb";
 *        union_members[2].offset         = 0; // from beginning of union
 *        union_members[2].size           = sizeof(SE_RGB_Data);
 *        union_members[2].field_modifier    = SE_FLD_MDFR_PLAIN;
 *        union_members[2].underlying_drm_type = SE_DRM_TYP_SE_RGB_DATA;
 *        union_members[2].first_dimension   = 0;
 *        union_members[2].second_dimension  = 0;
 *        union_members[2].union_member_count = 0;
 *        union_members[2].union_members     = NULL;
 */
typedef structse_drm_field_structure
{
const SE_Character *name_ptr;
SE_Short_Integer_Unsigned offset;
SE_Short_Integer_Unsigned size;
SE_Field_Modifier field_modifier;
SE_Integer underlying_drm_type;
SE_Short_Integer_Unsigned first_dimension; (notes)
SE_Short_Integer_Unsigned second_dimension; (notes)
SE_Short_Integer_Unsigned union_member_count; (notes)
const SE_Short_Integer_Unsigned *union_members; (notes)
} SE_DRM_Field_Structure;


Field Notes


first_dimension

 If this field is an array, size of 1st dimension; otherwise 0.

second_dimension

 If this field is a 2D array, size of 2nd dimension; otherwise 0.

union_member_count

 If this field is a union, # members; otherwise 0.

union_members

 If this field is a union, array of members of the union; otherwise NULL.



Prev: SE_DRM_Class. Next: SE_DRM_Status_Code.


Return to: Top of this Page, Type Index

Last updated: May 15, 2003 Copyright © 2003 SEDRIS™