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


A.3.3 bpipe_dpktf_arr

Get a pointer to a data packet field's data.

Synopsis

     #include <bpipe.h>
     
     
     
C-type *bpipe_dpktf_arr( DpktField *dpktf, void *core_image, C-type type );

Parameters

DpktField *dpktf
A data packet field handle obtained from either bpipe_dpktf or bpipe_dpktf_next.
void *core_image
A pointer to memory which holds the core image of the data packet.

Description

This C preprocessor macro will be replaced by a pointer to the starting location in the specified core image of the data for the specified data packet field. The pointer will be cast to the C type specified by the type argument, which should be appropriate for the field's data type (see Intrinsic Data Types). The invoking routine may use this pointer to directly access the field's data.

This access method provides a cleaner way of retrieving structure members:

     DVector3 *position = bpipe_dpktf_arr( dpktf, image, DVector3 );
     
     position->x = ..

Each of the arguments to the macro is used only once, so complex expressions with side effects will not result in unsavory results. While this “function” has been coded as a macro for efficiency, if possible it should be used outside of a loop. All arguments are assumed to be legal.