Component index
Section index | Component STREAMP |
Search |
Type | Object |
Summary | Extract records out of a byte stream |
Description | The object matches small or big reads with large or small
records. The object uses fill() to grab bytes and then let
process() extract records out of them. fill() may be used
repeatedly to grab enough bytes to please process(). process()
may be called repeatedly to exhaust the bytes in the buffer.
STREAMP has meny functags and they are all optional. In general a combination of functags and methods are used to solved a problem. |
void eof () | ![]() ![]() | int fill (void *buf, int size, bool &end) |
void fill (const void *buf, int len) | ![]() ![]() | int process (const void *buf, int len, bool &end, bool nomore) |
int getrecord (void *buf, int size) | ![]() ![]() | int validrecord (const void *buf, int len, bool &end, bool nomore) |
void loop () | ![]() ![]() |
Setup the object but do nothing until loop() or getrecord() is called.
Process will be called until there is no more records.
process() will be called until there is no more records. fill() may be used several time until one record is found.
The record is placed in the buffer and its length is returned.
If both fill() and process() are used, loop will iterate normally until end of file. If fill() and validrecord are used, loop with iterate until one full record is available. If only process() is used, loop will iterate until there is no more record to process.
The functag must read some byte in buf. It returns the number of byte placed in buf, or <= 0 if end of file.
The function tries to extract a complete record out of the buffer. It returns 0 if none were found (incomplete record). It return the bytes processed from the buffer (the record size generally)
Return the number of bytes in the record. This function kind of overlap with the process functag. It is used with the getrecord() method. When validrecord is used, process() is not.