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.

ARGUMENTS

"bin_tag" is a binary tag, previously obtained from fddx_in. It specifies a binary data stream.

"field_tag" is a tag returned by fdds_member. It locates a field within the trace structure of the data stream.

"prime" identifies a DDS prime type. It must be compatible with the field's prime type. 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 by 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 zero-based index of field within bin_tag assuming elements of size prime, or -1 if an error occurred.

EXAMPLE

      integer bin, field
      integer i_RecNum, RecNum
      integer*2 buf_i2(*)
      ...
c  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)
    

AUTHOR

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