Next: , Previous: bpipe_dpktf_arr, Up: Data Packet Field Manipulations


A.3.4 bpipe_dpktf_array_add

Add a one-dimensional array field to the core image of a data packet.

Synopsis

     #include <bpipe/bpipe.h>
     
     
     
int bpipe_dpktf_array_add( BPipe *bpipe, const char *name, BPDataType type, size_t extent );

Parameters

BPipe *bpipe
the binary pipe to which to add the new data packet field
const char *name
the name of the new field
BPDataType type
the data type of the new field
          
          
Possible values for a BPDataType are as follows: BPDType_char, BPDType_double, BPDType_int, BPDType_uint, BPDType_DVector2, BPDType_DVector3, BPDType_IVector2, BPDType_IVector3, BPDType_UIVector2, BPDType_UIVector3, BPDType_DComplex, BPDType_DCVector2, BPDType_DCVector3
size_t extent
the extent of the array

Description

This routine adds a one dimensional array field to the definition of the core image of a data packet. If no similarly named field exists, a new field with the given name is created and placed at the end of the list of current fields. The name data is duplicated.

This routine simplifies the addition of one-dimensional arrays. Normally one must construct a matrix specification and call bpipe_dpktf_add. This routine takes care of that.

Returns

It returns ‘0’ upon success. If a field with the same name already exists, it returns ‘1’. It returns ‘-1’ upon error, and sets bpipe_errno.

Errors

Upon error bpipe_errno is set to one of the following:

BPEBADARG

BPENOMEM
a memory allocation failed