Home Libraries Author Links

cpipe.h File Reference


Detailed Description

Specification of data types and functions for the handling of multi-stage filter chains between a data drain and a data sink connected through data pipes.

Version:
1.11-r317
Date:
2007-11-12 19:44:01 (Tom)
Author:
Tom Michaelis
SysToMath
Wittelsbacherstr. 7
D-80469 Munich
Contact:
http://www.SysToMath.com
mailto:Tom.Michaelis@SysToMath.com
This C header file contains declarations of data types and functions specifying the handling of multi-stage filter chains between a data drain and a data sink connected through data pipes. They are implemented in the C program file cpipe.c belonging to the SysToMath Base C Library stmbase.

Definition in file cpipe.h.

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

StmPipe Error Handling

#define StmPipeErrors
 Definition of StmPipe error numbers and messages.
#define StmPipeErr(nr, txt)   nr
 Definition of the StmPipe error number nr for error message text txt.
enum  StmPipeErrnos
 Definition of all possible StmPipe error numbers. More...
int stmPipeGetErrno (StmPipe pipe)
 Return the current StmPipe error number.
int stmPipeClearErrno (StmPipe pipe)
 Clear the current StmPipe error number.
const char * stmPipeGetErrorMsg (StmPipe pipe)
 Return the current StmPipe error message.
const char * stmPipeGetDebugMsg (StmPipe pipe)
 Return the current StmPipe debug message.
int stmPipeSetDebugMsg (StmPipe pipe, const char *debugMsg)
 Set a user defined StmPipe debug message.

StmPipeWord Representation

An object of abstract data type StmPipeWord is represented as an object of its implementation structure.

enum  StmPipeWordStatus {
  StmPipeNormal = 0,
  StmPipeAgain = 1,
  StmPipeNeedItem = 2,
  StmPipeError = 3,
  StmPipeCtrl = 0x80,
  StmPipeAllCtrl = 0xff
}
 Status constants stored in the hi StmByte part of a StmPipeWord word. More...
typedef struct StmPipeWord StmPipeWord
 Implementation structure.

StmPipeWord Generation

StmPipeWord stmPipeWordMake (StmWord word)
 Return a StmPipeWord object with StmWord content word.
StmPipeWord stmPipeWordLoMake (StmByte lo)
 Return a StmPipeWord object with StmByte data content lo.
StmPipeWord stmPipeWordHiMake (StmByte hi)
 Return a StmPipeWord object with StmByte status content hi.
StmPipeWord stmPipeWordHiLoMake (StmByte hi, StmByte lo)
 Return a StmPipeWord object with StmByte status content hi and StmByte data content lo.
StmPipeWord stmPipeWordErrNoMake (StmByte errNo)
 Return a StmPipeWord object containing an error code errNo.
StmPipeWord stmPipeWordEofMake (void)
 Return a StmPipeWord object containing the global control code EOF.

StmPipeWord Method Functions

StmWord stmPipeWord (StmPipeWord item)
 Return the StmWord content of the StmPipeWord object item.
StmByte stmPipeWordLo (StmPipeWord item)
 Return the StmByte data content of the StmPipeWord object item.
StmByte stmPipeWordHi (StmPipeWord item)
 Return the StmByte status content of the StmPipeWord object item.
StmBool stmPipeWordIsEof (StmPipeWord item)
 Return StmTrue, if the StmPipeWord object item contains the global control code EOF.

StmPipeStream Creation and Destruction

StmPipeStream stmPipeStreamFileDrainCreate (FILE *file)
 Creation of a new StmPipeStream object modelling the drain end of a data pipe reading from a stream represented by a FILE pointer.
StmPipeStream stmPipeStreamFdDrainCreate (int fd)
 Creation of a new StmPipeStream object modelling the drain end of a data pipe reading from an input channel represented by a file descriptor.
StmPipeStream stmPipeStreamAppDrainCreate (void *data, StmBool(*isByteAvailable)(void *data), int(*deliverByte)(void *data))
 Creation of a new StmPipeStream object modelling the drain end of a data pipe reading by means of an application defined protocol.
StmPipeStream stmPipeStreamFileSinkCreate (FILE *file)
 Creation of a new StmPipeStream object modelling the sink end of a data pipe writing to a stream represented by a FILE pointer.
StmPipeStream stmPipeStreamFdSinkCreate (int fd)
 Creation of a new StmPipeStream object modelling the sink end of a data pipe writing to an oiutput channel represented by a file descriptor.
StmPipeStream stmPipeStreamAppSinkCreate (void *data, StmBool(*isByteWelcome)(void *data), int(*acceptByte)(void *data, StmByte byte))
 Creation of a new StmPipeStream object modelling the sink end of a data pipe writing by means of an application defined protocol.
void stmPipeStreamDestroy (StmPipeStream stream)
 Destruction of the StmPipeStream object stream.

StmPipeStream Method Functions

StmBool stmPipeStreamIsItemAvailable (StmPipeStream stream)
 Determine, if a StmPipeWord is available from the StmPipeStream object stream.
StmPipeWord stmPipeStreamDeliverItem (StmPipeStream stream)
 Return a StmPipeWord from the StmPipeStream object stream.
StmBool stmPipeStreamIsItemWelcome (StmPipeStream stream)
 Determine, if the StmPipeStream object stream is able to accept a StmPipeWord.
StmPipeWord stmPipeStreamAcceptItem (StmPipeStream stream, StmPipeWord item)
 Write the StmPipeWord item to the StmPipeStream object stream.

StmPipeFilter Creation and Destruction

StmPipeFilter stmPipeFilterCreate (StmPipeWord(*operate)(StmPipeFilter filter, StmPipeWord item), void *(*createData)(StmPipeFilter filter), void(*destroyData)(StmPipeFilter filter), void *env)
 Creation of a new StmPipeFilter object modelling a filter for a StmPipe object not yet attached to any data pipe.
int stmPipeFilterDestroy (StmPipeFilter filter)
 Destruction of the StmPipeFilter object filter.

StmPipeFilter Method Functions

StmPipe stmPipeFilterGetPipe (StmPipeFilter filter)
 Return the StmPipe object the StmPipeFilter object filter is attached to.
StmPipeStream stmPipeFilterGetInput (StmPipeFilter filter)
 Return the input of the StmPipeFilter object filter.
StmPipeStream stmPipeFilterGetOutput (StmPipeFilter filter)
 Return the output of the StmPipeFilter object filter.
int stmPipeFilterGetStage (StmPipeFilter filter)
 Return the filter stage index of the StmPipeFilter object filter.
void * stmPipeFilterGetData (StmPipeFilter filter)
 Return a pointer to the filter internal data of the StmPipeFilter object filter.
void * stmPipeFilterGetEnv (StmPipeFilter filter)
 Return a pointer to the filter environment of the StmPipeFilter object filter.

StmPipe Creation and Destruction

StmPipe stmPipeCreate (StmPipeStream input, StmPipeStream output, FILE *debug, StmPipeFilter *filters, size_t order, size_t bufferSize)
 Creation of a new StmPipe object modelling a data pipe consisting of a multi-stage filter chain between a data drain and a data sink.
void stmPipeDestroy (StmPipe pipe)
 Destruction of the StmPipe object pipe.

StmPipe Method Functions

StmPipeStream stmPipeGetInput (StmPipe pipe)
 Return the input of the StmPipe object pipe.
StmPipeStream stmPipeGetOutput (StmPipe pipe)
 Return the output of the StmPipe object pipe.
FILE * stmPipeGetDebug (StmPipe pipe)
 Return the debug stream of the StmPipe object pipe.
int stmPipeGetOrder (StmPipe pipe)
 Return the order of the StmPipe object pipe.
StmPipeFilter stmPipeGetFilter (StmPipe pipe, size_t stage)
 Return the StmPipeFilter object at index stage of the filter chain of the StmPipe object pipe.
int stmPipeGetBufferSize (StmPipe pipe)
 Return the buffer size used for the internal buffers of the StmPipeStream objects connecting the filters of the filter chain of the StmPipe object pipe.
int stmPipeExec (StmPipe pipe)
 Execution of the StmPipe object pipe.


© Copyright Tom Michaelis 2002-2007

Distributed under the SysToMath Software License (See the accompanying file license.txt or a copy at www.SysToMath.com).