MrSID Decode SDK for Raster Reference Manual  9.0.0.3864
lt_ioCStream.h File Reference
#include "lt_base.h"
#include "lt_lib_io.h"
#include "lt_ioCallbackStreamTypes.h"

Go to the source code of this file.

Functions

C functions for operating on streams

These functions are C-callable analogues to the member functions in the LTIOStreamInf class.

LT_STATUS lt_ioCStreamDestroy (LTIOStreamH stream)
 destructor for C stream
LT_STATUS lt_ioCStreamOpen (LTIOStreamH stream)
 open C stream
LT_STATUS lt_ioCStreamClose (LTIOStreamH stream)
 close C stream
lt_uint32 lt_ioCStreamRead (LTIOStreamH stream, lt_uint8 *buf, lt_uint32 len)
 read C stream
lt_uint32 lt_ioCStreamWrite (LTIOStreamH stream, const lt_uint8 *buf, lt_uint32 len)
 write C stream
LT_STATUS lt_ioCStreamSeek (LTIOStreamH stream, lt_int64 offset, LTIOSeekDir dir)
 seek for C stream
lt_int64 lt_ioCStreamTell (LTIOStreamH stream)
 tell for C stream
lt_uint8 lt_ioCStreamIsEOF (LTIOStreamH stream)
 is end-of-file? for C stream
lt_uint8 lt_ioCStreamIsOpen (LTIOStreamH stream)
 is open? for C stream
LTIOStreamH lt_ioCStreamDuplicate (LTIOStreamH stream)
 duplicate C stream
LTIOStreamH lt_ioCallbackStreamCreate (LTIOCallbackStream_Open open, LTIOCallbackStream_Close close, LTIOCallbackStream_Read read, LTIOCallbackStream_Write write, LTIOCallbackStream_Seek seek, LTIOCallbackStream_Tell tell, LTIOCallbackStream_IsEOF isEOF, LTIOCallbackStream_IsOpen isOpen, LTIOCallbackStream_Duplicate duplicate, void *userData)
 create callback stream

Function Documentation

Create an LTIOCallbackStream, via C API. The parameters correspond to those used in LTIOCallbackStream::initialize().

Parameters:
openuser's open function
closeuser's close function
readuser's read function
writeuser's write function
seekuser's seek function
telluser's tell function
isEOFuser's isEOF function
isOpenuser's isOpen function
duplicateuser's duplicate function
userDatauser's stream data
Returns:
the created stream
Examples:
UsingCStream.c.

Closes a C stream. Note that lt_ioCStreamDestroy() must be called once the stream is no longer needed.

This function is equivalent to LTIOStreamInf::close().

Parameters:
streamstream to be closed
Returns:
success/failure code
Examples:
UsingCStream.c.

This function must be called once the stream is no longer needed to free up the stream's allocated resources, i.e. it calls the destructor of the underlying LTIOCallbackStream.

Parameters:
streamstream to be freed
Returns:
success/failure code

Duplicate a C stream.

This function is equivalent to LTIOStreamInf::duplicate().

Parameters:
streamstream to duplicate
Returns:
the new stream (or NULL if cannot duplicate)
Examples:
UsingCStream.c.

Check for EOF on a C stream.

This function is equivalent to LTIOStreamInf::isEOF().

Parameters:
streamstream to query
Returns:
true (1), iff the stream is at EOF

Check for open on a C stream.

This function is equivalent to LTIOStreamInf::isOpen().

Parameters:
streamstream to query
Returns:
true (1) iff the stream is open

Opens a previously-created C stream.

This function is equivalent to LTIOStreamInf::open().

Parameters:
streamstream to be opened
Returns:
success/failure code
Examples:
UsingCStream.c.
lt_uint32 lt_ioCStreamRead ( LTIOStreamH  stream,
lt_uint8 buf,
lt_uint32  len 
)

Read from a C stream.

This function is equivalent to LTIOStreamInf::read().

Parameters:
streamstream to read from
bufbuffer to read into
lennumber of bytes to read
Returns:
number of bytes read
Examples:
UsingCStream.c.
LT_STATUS lt_ioCStreamSeek ( LTIOStreamH  stream,
lt_int64  offset,
LTIOSeekDir  dir 
)

Seek on a C stream.

This function is equivalent to LTIOStreamInf::seek().

Parameters:
streamstream to be seek on
offsetdistance to seek
dirseek direction
Returns:
success/failure code
Examples:
UsingCStream.c.
lt_int64 lt_ioCStreamTell ( LTIOStreamH  stream)

Tell on a C stream.

This function is equivalent to LTIOStreamInf::tell().

Parameters:
streamstream to get offset of
Returns:
stream's current offset
Examples:
UsingCStream.c.
lt_uint32 lt_ioCStreamWrite ( LTIOStreamH  stream,
const lt_uint8 buf,
lt_uint32  len 
)

Write to a C stream.

This function is equivalent to LTIOStreamInf::write().

Parameters:
streamstream to be written to
bufbuffer to write from
lennumber of bytes to write
Returns:
number of bytes written