cdds_member - fetch field tag within DDS structures

SYNOPSIS

#include "cdds.h"

FIELD_TAG cdds_member(bin_tag, field_tag, field_name);

BIN_TAG bin_tag
FIELD_TAG field_tag
const char *field_name

DESCRIPTION

cdds_member returns the tag associated with the given field_name that is a member of the structure associated with the tag, field_tag. If field_tag is zero, it defaults to the SEQUENCE (trace type) associated with bin_tag. If field_name is blank, the returned value will be the tag associated with the first member of the structure. field_name can include structure names relative to the field_tag (eg. "Spare.Hdr.RecNum") or can specify the first member of a substructure (eg. "TmMsS1_union."). The functions, cdds_next, cdds_prev and cdds_parent allow traversing through the structure's members. The returned tag is the value that should be used in routines cdds_index and cdds_get.

NOTE: for the cdds_member, if the field_name is "Horz..." and the member cannot be found, the "Horz" will be replaced with "TVPT" and tried again so that "Horz01" thru "Horz20" can be overloaded and used in the cdds_getff and cdds_putff calls.

INPUT

bin_tag is the tag associated with an open binary, previously obtained from cdds_open. It specifies a particular binary stream.

field_tag is the tag associated with a particular field known by bin_tag.

field_name is a string that names a member or object field within field_tag. If field_name is zero length or blank, the returned tag defaults to the first member or object in the structure, field_tag.

OUTPUT

The return value is the field tag associate with the desired object or -1 if none found.

NOTE: for cases where "Horz..." was used in cdds_member, then the return value is the negative ( < -1) of the associated field so that cdds_getf will know to divert the call to cdds_getff with the absolute value of the tag.

EXAMPLE

      int ndx, rec, *ibuf;
      BIN_TAG bin;
      FIELD_TAG tag, ptag;
      ...
      // find index of header RecNum
      tag = cdds_member(bin, 0, "RecNum");
      ndx = cdds_index(bin, tag, DDS_INT);
      rec = ibuf[ndx];
      ...
      /* find all trace header tags  */
      tag = cdds_member(bin, 0, "");
      while (tag)
      {
          ptag = cdds_prime(bin, tag);
          ...
          tag = cdds_next(bin, tag);
      }
    

SEE ALSO

cdds_prec Field precision
cdds_count Field count
cdds_align Field alignment
cdds_genus Field generic type
cdds_name Field name
    

AUTHOR

Jerry Ehlers, BP America (May 2003)