Next: hdrf_node_name_cmp, Previous: hdrf_name_cmp, Up: Internal Functions
Create and initialize a header data field.
#include <bpipe/bpipe.h>static HdrField *hdrf_new( char *name, BPDataType type, BPMatrix *matrix, void *data, int copy );
char *name
- the field's name
BPDataType type
- the 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
- the field's storage spec
void *data
- a pointer to the data
int copy
- if true, make a copy of the data, else just stash the pointer
This routine creates and initializes a header data field structure.
It duplicates the passed field name and type. It assumes
responsibility for the passed matrix specification. All of the
passed data are assumed to be valid. The matrix specification may
be NULL
, in which case a matrix specification for a scalar
is generated. If the argument copy
is true, then the data
will be copied. Otherwise, the memory pointed to by the
data
pointer will be used. If data
is NULL
enough memory to hold the matrix is allocated, regardless of the
state of the copy
variable.
It returns a pointer to a dynamically allocated and initialized
structure. Upon error it returns NULL
and sets
bpipe_errno
.
Upon error bpipe_errno
is set to one of the following:
BPENOMEM