Next: bpipe_dpktf_size_cmp, Previous: bpipe_dpktf_matrix_override_cmp, Up: Internal Functions
add a data packet field to a data packet.
#include <bpipe/bpipe.h>int bpipe_dpktf_newP( BPipe *bpipe, const char *name, BPDataType type, BPMatrix *matrix, size_t offset, BPDataSite site );
BPipe *bpipe
- the binary pipe to which to add the data packet field
const char *name
- the name of the new field
BPDataType type
- the new field's data type
Possible values for aBPDataType
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
BPMatrix *matrix
- a description of the storage requirements of the field
size_t offset
- offset from start of input object
BPDataSite site
- the data site where the field is to be located
Possible values for aBPDataSite
are as follows:BPDSite_INPUT
,BPDSite_CORE
,BPDSite_OUTPUT
Adds a new field to either the input or core images of a data packet
field. It does not allow duplicate fields to be created. It
creates the necessary structures, replicates the user data (name,
type) and places the parameter at the end of the list of
fields as well as in the binary table of fields. If the matrix
specification is NULL
, a matrix specification for a scalar is
constructed.
bpipe_dpktf_newP
uses the passed matrix structure as is, and
directs the BPipe
cleanup code to take responsibility for
freeing it. The calling procedure should not free it, nor
should it pass it to any other BPipe
routine which takes
responsibility for freeing it.
This is a private routine, and should be called only be bpipe
internal routines. The public routine, bpipe_dpktf_add
,
calls this with the site set to DataSite_CORE
.
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
.
Upon error bpipe_errno
is set to one of the following:
BPEBADARG
BPENOMEM