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().
 *
 * 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_tag_index     = -1;
 *        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_tag_index     = -1;
 *        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_DRM_TYP_NULL;
 *        first_dimension     = 0;
 *        second_dimension    = 0;
 *        union_tag_index     = 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_tag_index   = -1;
 *        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_tag_index   = -1;
 *        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_tag_index   = -1;
 *        union_members[2].union_member_count = 0;
 *        union_members[2].union_members     = NULL;
 */
typedef struct se_drm_field_structure
{

const SE_Character *name_ptr;1
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;2
SE_Short_Integer_Unsigned second_dimension;3
SE_Integer union_tag_index;
SE_Short_Integer_Unsigned union_member_count;4
const struct se_drm_field_structure *union_members;5
} SE_DRM_Field_Structure;


Field Notes

name_ptr

name of field; for example, "length" is the name of the 1st member of the SE_String type

1 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.

2 size (in bytes) of field

3 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)

4 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).

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, the number of members; otherwise 0.

union_members

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




Prev: SE_DRM_Class_Fields. Next: SE_DRM_Status_Code.


Return to: Top of this Page, Type Index