Previous: Data Packet Creation and Deletion, Up: Manipulating Data Packet Fields


4.4.3 Resizing

Resizing of data packet fields is very similar to the resizing of header fields. There are, however, two routines available, one for resizing the core image of a field (bpipe_dpktf_resize_core), and one for resizing an output image of a field (bpipe_dpktf_resize_core). Data packet fields are resized when they are converted from input to core images or from core to output images. They may only be resized before the call to bpipe_map or bpipe_map_alloc. After a resize, any previously retrieved matrix-spec is invalid and must be retrieved again. (Note that since the BPMatrix structure returned by bpipe_hdrf_matrix is a copy of the field's matrix-spec, the application has the responsibility of freeing it.)

Apart from when the field is resized, the substantive difference between header fields and data packet fields is in the initialization of the new field matrices. Since the application has free access to the data packet core image before data is read in, it may initialize it without any help from the bpipe interface. To make life easier, the routine bpipe_dpktf_init will initialize a field without the application having to extract the matrix-spec for the field to determine the number of elements to initialize. For other routines which may be used for more complicated initializations, bpipe_dpktf_init.

Initialization of the output images is done internally by the library, as the application has no access to that image. All data are initialized to appropriate values of ‘0’.