![]() |
v0.4.1
Fast, portable C library for geometry input/output
|
Stream that can get input from an arbitrary data source or can write output to an arbitrary data sink. More...
Data Fields | |
| void * | cookie |
| Opaque pointer on the user stream, passed as first argument to hook functions. More... | |
| bool(* | func_at_end )(void *cookie) |
| Function that checks end-of-stream indicator. More... | |
| int(* | func_error )(void *cookie) |
| Function that checks error indicator. More... | |
| size_t(* | func_read )(void *cookie, void *ptr, size_t size, size_t count) |
| Function that reads block of data from stream. More... | |
| size_t(* | func_write )(void *cookie, const void *ptr, size_t size, size_t count) |
| Function that writes block of data to stream. More... | |
| gmio_streamsize_t(* | func_size )(void *cookie) |
| Function that returns the size(in bytes) of the stream. More... | |
| int(* | func_get_pos )(void *cookie, struct gmio_streampos *pos) |
| Function that retrieves the current position in the stream. More... | |
| int(* | func_set_pos )(void *cookie, const struct gmio_streampos *pos) |
Function that restores the current position in the stream to pos. More... | |
Stream that can get input from an arbitrary data source or can write output to an arbitrary data sink.
It can be seen as generalization of the standard FILE*, and is pretty much the same as custom streams in the GNU C Library
It uses a cookie being basically an opaque pointer on a hidden data type.
The custom stream is implemented by defining hook functions that know how to read/write the data.
| void* gmio_stream::cookie |
Opaque pointer on the user stream, passed as first argument to hook functions.
| bool(* gmio_stream::func_at_end)(void *cookie) |
Function that checks end-of-stream indicator.
Checks whether the end-of-stream indicator associated with stream pointed by cookie is set, returning true if it is.
The function should behaves like C standard feof()
| int(* gmio_stream::func_error)(void *cookie) |
Function that checks error indicator.
Checks if the error indicator associated with stream pointed by cookie is set, returning a value different from zero if it is.
The function should behaves like C standard ferror()
| size_t(* gmio_stream::func_read)(void *cookie, void *ptr, size_t size, size_t count) |
Function that reads block of data from stream.
Reads an array of count elements, each one with a size of size bytes, from the stream pointed by cookie and stores them in the block of memory specified by ptr
The function should behaves like C standard fread()
| size_t(* gmio_stream::func_write)(void *cookie, const void *ptr, size_t size, size_t count) |
Function that writes block of data to stream.
Writes an array of count elements, each one with a size of size bytes, from the block of memory pointed by ptr to the current position in the stream pointed by cookie
The function should behaves like C standard fwrite()
| gmio_streamsize_t(* gmio_stream::func_size)(void *cookie) |
Function that returns the size(in bytes) of the stream.
| int(* gmio_stream::func_get_pos)(void *cookie, struct gmio_streampos *pos) |
Function that retrieves the current position in the stream.
| 0 | on success |
| !=0 | on error |
| int(* gmio_stream::func_set_pos)(void *cookie, const struct gmio_streampos *pos) |
Function that restores the current position in the stream to pos.
| 0 | on success |
| !=0 | on error |
| Fougue © 2017 | Last Update: Fri Apr 14 2017 |