Component index
Section index

Component streamp_do


Search

Type

Function

Summary

Extracts records out of a byte stream

Description

The component receives some bytes and a control buffer (STREAMP_BUF). The bytes are added to the control buffer and the process() functag is called to extract some records. The amount of bytes received may be as large as needed: The component will iterate until all bytes have been moved to the control buffer, If some bytes may not be inserted in the control buffer (because the process functag refuse to pick any records), -1 is returned.

int process (const void *buf, int len, bool &end)

Examples

sample / streamp_do component

Prototypes

int streamp_do (STREAMP_BUF &ctl, const void *data, int len)

Functags

int process (const void *buf, int len, bool &end) Mandatory

Process one record if there is enough bytes

The functag must check for record. For example, if the function process text line, it will make sure there is an end of line character in the buffer. The function returns the number of bytes used in the buffer or 0 if there were not enough bytes (incomplete record).