Brew MP 1.0.2
This type definition specifies the prototype for the function pointer used to retrieve
specific pieces of data stored in a value model. The value model allows objects to attach
themselves to data of some arbitrary size and structure. The data may be as simple and
straightforward as a single boolean
or integer value -- or it might be very complex,
comprised of many fields, structures or could even be dynamic. Quite frequently, it is
desirable for a value model to retrieve only a specific portion of a given data structure.
For example, a value model that stores directory service information would likely possess
fields for name, address and phone number, and perhaps a JPEG image of the person identified
by a given record. BREW calls the PFNADAPTGET
callback (when present) each time
IValueModel_GetValue() is called. The callback then may retrieve a specific portion of the
stored data -- perhaps just the phone number or the photo in the example above. The callback
provides the code to retrieve the specifically requested information from the data stored in
the value model.
pvCtx: A pointer to a private context controlled by the value model. The callback
will use this context information to retrieve specific pieces of information
from the data stored in a given value model. For example, 'pvCtx' could
identify a specific field to be retrieved, known only to the value model.
pValueIn: A pointer to the current data stored in the value model. The value model's
PFNADAPTGET function might use the current data as the basis for retrieving the
next piece of data.
nLen: The length of the data currently stored in the value model. The value model's
PFNADAPTGET function might use the length of the current data as the basis for
retrieving the next piece of data.
ppValueOut: A pointer to the data retrieved by the value model.
pnLenOut: A pointer to the length of the data retrieved by the value model.
typedef void (*PFNADAPTGET)(void *pvCtx, void *pValueIn, int nLen, void **ppValueOut, int *pnLenOut);