DDS Developers Documentation → "C" API → put


Index
cdds_addaxis
cdds_align
cdds_axis_prod
cdds_binfd
cdds_calloc
cdds_check
cdds_close
cdds_closepr
cdds_closepr2
cdds_copy
cdds_count
cdds_datadefn
cdds_dict
cdds_errors
cdds_fflush
cdds_free
cdds_genus
cdds_get
cdds_history
cdds_in
cdds_index
cdds_info
cdds_initmpi
cdds_initmpix
cdds_initopenmp
cdds_isreg
cdds_key
cdds_lseek
cdds_lseek8
cdds_malloc
cdds_map
cdds_member
cdds_memuse
cdds_mod
cdds_name
cdds_newer
cdds_next
cdds_object
cdds_offset
cdds_open
cdds_openm
cdds_openpr
cdds_out
cdds_parent
cdds_prec
cdds_prev
cdds_prime
cdds_printf
cdds_printt
cdds_printv
cdds_prtcon
cdds_prterr
cdds_prthdr
cdds_prtmsg
cdds_put
cdds_read
cdds_readm
cdds_realloc
cdds_rmaxis
cdds_savepr
cdds_scale
cdds_scanf
cdds_scank
cdds_scant
cdds_scantn
cdds_scanv
cdds_switch
cdds_write
cdds_writem
setargcv

cdds_put - put one field into a DDS type buffer


SYNOPSIS

#include "cdds.h"

int cdds_putxx(bin, tag, out_buf, in_array, count);

BIN_TAG bin
FIELD_TAG tag
const void *out_buf
HostType *in_array
int count

DESCRIPTION

These functions put data into a type field and from an array variable. The data is converted from the host array type, into the type defined for the field. The array type is implied by the function name suffix. Vectors are truncated or padded, depending upon the source and destination count.

INPUT

The first three arguments describe an output field within a type buffer. bin is a binary tag, previously obtained from cdds_open.

tag identifies a specific field associated with bin obtained from fdds_member. Note that there is a distinct difference between tags generated from different bin values. This means that you should not be using a tag from the in_bin for anything related to the out_bin. If tag is zero, the default target (trace) is used.

out_buf is the output type buffer into which the output field is found.

The last two arguments describe an input array. The type of in_array is implied by the function name suffix. The number of elements is specified by count.

OUTPUT

The put functions copy (or convert) data from an input array into the output field. Vectors are truncated or padded, depending upon the source and destination count.

The function return value is count, or zero if an error occurred.

A simple byte copy is performed, if the binary formats are the same. The put functions convert between most numeric representations. The allowed combinations are implementation dependent. The functions also convert between ascii and ebcdic character formats. Byte fields can be copied, without conversion, from any array. The cdds_put function copies an array into any field type, without conversion. Conversion is not allowed between numeric and character types. If conversion is not possible, an error is reported and the output field is not changed.

Function     HostType         in_array Pad
cdds_put     char             zero
cdds_putcs   char             null terminated
cdds_putcb   char             blank
cdds_puti    int              zero
cdds_puts    short            zero
cdds_putl    long             zero
cdds_putu    unsigned         zero
cdds_putus   unsigned short   zero
cdds_putul   unsigned long    zero
cdds_putf    float            zero
cdds_putff   float            zero (USP fake float)
cdds_putd    double           zero
        
C assignment rules are used to convert float arrays to integer and unsigned fields. Character arrays passed by cdds_putcb are assumed to be padded with blanks. Trailing pad characters are ignored during put processing; they effectively shorten input character arrays. A null character, within a cdds_putcs character array, effectively reduces its count. cdds_putff stuffs floats into consecutive 4-bytes (fake floats).

EXAMPLES

      BIN_TAG out_bin;
      FIELD_TAG tag;
      char *out_buf;
      const int *in_array;
      ...
      tag = cdds_member(out_bin, 0, "TagName");
      ...
      // Store 100 integers of "TagName" header from in_array in out_buf at correct offsets
      cdds_puti(out_bin, tag, out_buf, in_array, 100);
      // Write a single trace to output
      cddx_write(out_bin, out_buf, 1);
    

SEE ALSO

      cdds_get Get one field from a buffer
    

AUTHOR

R. L. Selzler, EPTG (Oct 1995) Jerry Ehlers, BP America (May 2003)
For additional help, open an issue here