Previous: bpipe_dpktf_val, Up: Data Packet Field Manipulations


A.3.18 bpipe_dpktf_valn

Retrieve an element in data packet field data array.

Synopsis

     #include <bpipe.h>
     
     
     
type bpipe_dpktf_valn( DpktField *dpktf, void *core_image, C type type, size_t n );

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.
C-type type
The C type of the field (i.e., double, IVector2, etc.) as listed in Intrinsic Data Types.
n
An index into the array.

Description

This C preprocessor macro will be replaced by the value of the n'th element in a data packet field array. core_image should point to the memory buffer containing the core image of the data packet from which the field data is to be extracted. The type argument is the actual C type of the data, which is used to correctly de-reference the pointer to the data.

In the event that the field data is represented in C by a structure, structure members should be referenced via the “.” notation:

     x = bpipe_dpktf_valn(dpktf, data, DVector2, 2).x;

This is rather clumsy; For a cleaner method, see See bpipe_dpktf_arr.

Each of the arguments to the macro is used only once, so complex expressions with side effects will not result in unsavory results. All arguments are assumed to be legal.