RecAPI
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Properties Modules Pages
Input/output Stream Handling Module

API for handling input and output files through memory or other non-standard I/O devices. Supported on: Windows, Linux, MacOS. More...

Classes

struct  _R_IOStreamfuncs
 Container structure of the IOStream callback functions. More...
 

Macros

#define NOT_APPLICATION_STREAM   ((size_t)-1)
 Return this value if the given name is not handled by your stream callbacks.
 

Typedefs

typedef int CALLBACK open_stream_f(const char *streamName, int openMode, size_t *streamID)
 callback function for the OPEN operation. See R_IOStreamfuncs::ropen_stream
 
typedef struct _R_IOStreamfuncs R_IOStreamfuncs
 Container structure of the IOStream callback functions.
 

Functions

RECERR RECAPIKRN kRecSetIOStreamCB (R_IOStreamfuncs *iosCB)
 IOStream.
 

Detailed Description

API for handling input and output files through memory or other non-standard I/O devices. Supported on: Windows, Linux, MacOS.

Typedef Documentation

◆ R_IOStreamfuncs

Container structure of the IOStream callback functions.

Note
See kRecSetIOStreamCB

Function Documentation

◆ kRecSetIOStreamCB()

RECERR RECAPIKRN kRecSetIOStreamCB ( R_IOStreamfuncs * iosCB)

IOStream.

This function sets the application callback API for streaming IO.

Parameters
[in]iosCBPointer to the R_IOStreamfuncs structure containing callback functions. Must be provided and implemented by the application. Use NULL to turn off the callback mechanism.
Note
After the IOStream API has been set, all CSDK file opens are hooked and the callback R_IOStreamfuncs::ropen_stream is called first. You must invent a naming convention that you use to tell normal files and your streams apart (for example start all your stream names like "mystream:"). If the actual name belongs to the application (i.e. it fits your naming convention), ropen_stream must return a unique ID in streamID. Otherwise you must return NOT_APPLICATION_STREAM in the streamID parameter and the file will be handled normally.
Your generated stream ID will be passed to your other callbacks. You can map these IDs to handler objects inside your application to perform the required operation.
Return errno compatible error code when your stream operation has an error.
See Sample71.cpp for a sample implementation of the usage of the IOStream API on RECAPI.
For .NET application Objects API sample #71 (Samples\CSClassSamples\Sample71.cs) contains a worked out sample solution.
In .NET both FileStream and MemoryStream are directly supported as well as byte[] objects. These standard streams can be set using IOStreamCB.SetStream("userStreamName", Stream or byte[]) Any other non standard IO has to be completely implemented in the callbacks by the application.
The specification of this function in Java is:
int kRecSetIOStreamCB(IOStreamCallbacks iosCB)
RECERR RECAPIKRN kRecSetIOStreamCB(R_IOStreamfuncs *iosCB)
IOStream.
The specification of this function in Python is:
def kRecSetIOStreamCB(iosCB: "IOStreamCallbacks") -> int