FTS bytestream i/o
[FTS bytestream class.]


Detailed Description

Using bytestreams for i/o.

These functions allow for implementing modules refering to bytestreams. These objects can receive data from the bytestream and send data to the bytestream.

An i/o module can check if a given object implements an FTS bytestream and whether it is an input and/or an output using the functions fts_bytestream_check(), fts_bytestream_is_input() and fts_bytestream_is_output(). The API provides functions for declaring a module as a listener to a bytestream (see fts_bytestream_add_listener()) and output functions sending events to a bytestream (see fts_bytestream_output()).


Functions

FTS_API int fts_bytestream_check (fts_object_t *obj)
 Check whether an FTS object implements the bytestream abstraction.
int fts_bytestream_is_input (fts_bytestream_t *stream)
 Check whether an FTS bytestream is an input.
int fts_bytestream_is_output (fts_bytestream_t *stream)
 Check whether an FTS bytestream is an input.
FTS_API void fts_bytestream_add_listener (fts_bytestream_t *stream, void *listener, fts_bytestream_callback_t fun)
 Register listener to a bytestream.
FTS_API void fts_bytestream_remove_listener (fts_bytestream_t *stream, void *listener)
 Remove listener from a bytestream.
FTS_API void fts_bytestream_output (fts_bytestream_t *stream, int n, const unsigned char *c)
 Send a string to a bytestream.
FTS_API void fts_bytestream_output_char (fts_bytestream_t *stream, unsigned char c)
 Send a single character to a bytestream.
FTS_API void fts_bytestream_flush (fts_bytestream_t *stream)
 Flush bytestreams output buffer (if any).


Function Documentation

FTS_API void fts_bytestream_add_listener ( fts_bytestream_t stream,
void *  listener,
fts_bytestream_callback_t  fun 
)

Register listener to a bytestream.

Parameters:
stream the listened bytestream
listener the listener
fun listener function to be called for incoming data
See also:
fts_bytestream_remove_listener()
In order to receive incoming data from a bytestream, an FTS object registers itself as a listener to the bytestream.

FTS_API int fts_bytestream_check ( fts_object_t obj  ) 

Check whether an FTS object implements the bytestream abstraction.

A module that wants to listen to or output via a bytestream should check if the object it referes to implements the bytestream abstraction

Parameters:
obj the object to be checked
Returns:
non-zero if object implements an FTS bytestream

FTS_API void fts_bytestream_flush ( fts_bytestream_t stream  ) 

Flush bytestreams output buffer (if any).

Parameters:
stream the bytestream
See also:
fts_bytestream_output

fts_bytestream_output_char

int fts_bytestream_is_input ( fts_bytestream_t stream  ) 

Check whether an FTS bytestream is an input.

Parameters:
stream the bytestream to be checked
Returns:
non-zero if stream is input

int fts_bytestream_is_output ( fts_bytestream_t stream  ) 

Check whether an FTS bytestream is an input.

Parameters:
stream the bytestream to be checked
Returns:
non-zero if stream is input

FTS_API void fts_bytestream_output ( fts_bytestream_t stream,
int  n,
const unsigned char *  c 
)

Send a string to a bytestream.

Parameters:
stream the bytestream
n the number of characters
c the characters
See also:
fts_bytestream_output_char

fts_bytestream_flush

FTS_API void fts_bytestream_output_char ( fts_bytestream_t stream,
unsigned char  c 
)

Send a single character to a bytestream.

Parameters:
stream the bytestream
c the character
See also:
fts_bytestream_output

fts_bytestream_flush

FTS_API void fts_bytestream_remove_listener ( fts_bytestream_t stream,
void *  listener 
)

Remove listener from a bytestream.

An object listening to a bytestream must be removed as listener before being destroyed. Typically this is done in the object's delete method.

Parameters:
stream the listened bytestream
listener the listener


Generated on Wed Aug 24 18:28:43 2011 for FTM API by  doxygen 1.5.6