#ifndef _FX_STREAM_C_H_
#define _FX_STREAM_C_H_

#ifdef __cplusplus
extern "C" {
#endif


typedef struct _FSIFX_FileStream FSIFX_FileStream;

typedef struct _FSIFX_StreamRead {

  void* user_data;

  void (*Release)(void* user_data);

  FS_BOOL (*IsEOF)(void* user_data);

  FS_INT64 (*GetPosition)(void* user_data);

  size_t (*ReadBlock)(void* user_data, void* buffer, size_t size);

  FS_INT64 (*SetPosition)(void* user_data, FS_INT64 pos);

} FSIFX_StreamRead;

typedef struct _FSIFX_FileWrite {
  void* user_data;
  void      (*Release)(void* user_data);
  FS_INT64    (*GetSize)(void* user_data);
  FS_BOOL      (*Flush)(void* user_data);
  FS_BOOL      (*WriteBlock)(void* user_data, const void* pData, FS_INT64 offset, size_t size);
  
} FSIFX_FileWrite;

typedef FSIFX_FileWrite FSWriterCallback;

typedef struct _FSIFX_FileRead {
  void* user_data;
  FSIFX_StreamRead *ifx_streamread;
  void      (*Release)(void* user_data);
  FS_INT64    (*GetSize)(void* user_data);
  FS_BOOL      (*ReadBlock)(void* user_data, void* buffer, FS_INT64 offset, size_t size);
  
} FSIFX_FileRead;

typedef FSIFX_FileRead FSReaderCallback;

typedef struct _FSIFX_FileStream {
  void* user_data;
  FSIFX_FileStream*    (*Retain)(void* user_data);
  void        (*Release)(void* user_data);
  FS_INT64      (*GetSize)(void* user_data);
  FS_BOOL        (*IsEOF)(void* user_data);
  FS_INT64      (*GetPosition)(void* user_data);
  FS_BOOL        (*ReadBlock)(void* user_data, void* buffer, FS_INT64 offset, size_t size);
  size_t        (*ReadBlock0)(void* user_data, void* buffer, size_t size);
  FS_BOOL        (*WriteBlock)(void* user_data, const void* buffer, FS_INT64 offset, size_t size);
  FS_BOOL        (*Flush)(void* user_data);
  
} FSIFX_FileStream;

typedef FSIFX_FileStream FSStreamCallback;

#ifdef __cplusplus
}
#endif
#endif
