fdds_index - field index within DDS type


SYNOPSIS

#include <fdds.h> (fixed-format sources)
#include <f90dds.h> (free-format sources)

integer function fdds_index(bin_tag, field_tag, prime)

integer bin_tag
integer field_tag
integer prime

DESCRIPTION

This function returns the index of a field within a DDS type. The index is an array subscript relative to a DDS prime type. This allows the field value to be accessed within a type buffer.

INPUT

bin_tag is a binary tag, previously obtained from fdds_open. It specifies a particular binary stream.

field_tag is a tag that identifies a field within bin_tag obtained from fdds_member.

Prime is a tag that identifies a DDS prime type. It must be compatible with the field's prime type. (For a simple byte offst, use fdds_offset.) The field offset must be compatible with the type's precision a fractional index would be useless. An error is issued, if these assumptions are violated.

Symbolic names for DDS prime types are provided in fdds.h. They correspond to Fortran types on the host computer. This allows the prime argument to be host independent. Possible values include:

Host Dependent values
prime                   Host Type
-----                   ---------
DDS_CHARACTER           character
DDS_INTEGER             integer
DDS_INTEGER2            integer2
DDS_LOGICAL             logical
DDS_LOGICAL1            logical1
DDS_REAL                real
DDS_DOUBLE              double
DDS_COMPLEX             complex
DDS_DBL_CPX             double complex
        

OUTPUT

The return value is the index of field_tag within bin_tag, or -1 if an error occurred.

EXAMPLE

      integer bin, field
      integer i_RecNum, RecNum
      integer*2 buf_i2(*)
      ...
      ! index to RecNum field (integer*2)
      field = fdds_member(bin, 0, 'RecNum')
      i_RecNum = 1 + fdds_index(bin, field, DDS_INTEGER2)
      ...
      RecNum = buf_i2(i_RecNum)
    

SEE ALSO

fdds_offset
    

AUTHOR

R. L. Selzler, EPTG (May, 1994)