MrSID Decode SDK for Raster Reference Manual  9.5.4.4709
LTIOStreamInf Class Reference

Abstract definition of a stream. More...

#include <lt_ioStreamInf.h>

Inheritance diagram for LTIOStreamInf:
LTIOBufferedStream LTIOCallbackStream LTIODynamicMemStream LTIOFileStream LTIOMemStream LTIOSubStream

List of all members.

Public Member Functions

virtual ~LTIOStreamInf ()=0
virtual char * readString (int delimiter= '\0')
 read a delimiter-terminated string
Status accessors
virtual bool isEOF ()=0
 Test for end-of-stream.
virtual bool isOpen ()=0
 Test for stream openness.
Opening and closing
virtual LT_STATUS open ()=0
 Opens the stream.
virtual LT_STATUS close ()=0
 Closes the stream.
Data access
virtual lt_uint32 read (lt_uint8 *pDest, lt_uint32 numBytes)=0
 Retrieve the specified number of bytes from the data source and place them in pDest.
virtual lt_uint32 write (const lt_uint8 *pSrc, lt_uint32 numBytes)=0
 Store the specified number of bytes in the data source.
Positioning
virtual LT_STATUS seek (lt_int64 offset, LTIOSeekDir origin)=0
 Moves the data access position to origin + offset.
virtual lt_int64 tell ()=0
 Returns the current data access position as an offset from the start of the data.
Other operations
virtual LTIOStreamInfduplicate ()=0
 Clone the stream.
virtual LT_STATUS getLastError () const =0
 Get status code of last error event.
virtual const char * getID () const =0
 Get a URI describing the stream object.

Detailed Description

This class is intentionally very sparse, and completely abstract to facilitate COM usage. The semantics of the LTIOStreamInf class are very similar to the unix stdio model.

Examples:
DerivedImageWriter.cpp, and DerivedStream.cpp.

Definition at line 30 of file lt_ioStreamInf.h.


Constructor & Destructor Documentation

virtual LTIOStreamInf::~LTIOStreamInf ( ) [pure virtual]

Member Function Documentation

virtual LT_STATUS LTIOStreamInf::close ( ) [pure virtual]

Puts the stream in a state that does not allow data access. May free up resources, but only in such a way that doesn't inhibit successful future calls to open()

Return values:
LT_STS_SuccessOn success, or if the stream is already closed.
LT_STS_FailureOtherwise.

Implemented in LTIOSubStream, LTIOCallbackStream, LTIODynamicMemStream, LTIOFileStream, LTIOMemStream, and LTIOBufferedStream.

Examples:
DerivedStream.cpp.
virtual LTIOStreamInf* LTIOStreamInf::duplicate ( ) [pure virtual]

Create new stream of the same type with the same initialization parameters. The transmission of these parameters is the responsibility of the derived type. The new stream should initially return false for isOpen().

Return values:
NULLthe stream could not be duplicated; valid LTIOStreamInf* otherwise.

Implemented in LTIOSubStream, LTIODynamicMemStream, LTIOCallbackStream, LTIOFileStream, LTIOMemStream, and LTIOBufferedStream.

Examples:
DerivedStream.cpp.
virtual const char* LTIOStreamInf::getID ( ) const [pure virtual]

This function returns a UTF-8, null-terminated string which is a URI describing the origin of the stream object -- for example, "file://foo.txt" or "lt_memstream:". This string is only intended for diagnostic purposes, i.e. it may not be valid to pass it to the ctor in an attempt to reopen the stream.

Return values:
urithe uri string

Implemented in LTIOSubStream, LTIODynamicMemStream, LTIOCallbackStream, LTIOFileStream, LTIOMemStream, and LTIOBufferedStream.

Examples:
DerivedStream.cpp.
virtual LT_STATUS LTIOStreamInf::getLastError ( ) const [pure virtual]

read(), write(), tell(), and duplicate() do not explicitly return status codes in the event of an error. When an error has occurred, this function returns the appropriate status code. Note calling this function after a successful I/O operation will return an undefined value.

Return values:
statusthe error code

Implemented in LTIOSubStream, LTIODynamicMemStream, LTIOCallbackStream, LTIOFileStream, LTIOMemStream, and LTIOBufferedStream.

Examples:
DerivedImageWriter.cpp, and DerivedStream.cpp.
virtual bool LTIOStreamInf::isEOF ( ) [pure virtual]

Returns true after the first read operation that attempts to read past the end of the stream. It returns false if the current position is not end of stream.

Return values:
trueend of stream
falseotherwise

Implemented in LTIOSubStream, LTIOCallbackStream, LTIODynamicMemStream, LTIOFileStream, LTIOMemStream, and LTIOBufferedStream.

Examples:
DerivedStream.cpp.
virtual bool LTIOStreamInf::isOpen ( ) [pure virtual]
Return values:
trueThe stream is open
falseotherwise

Implemented in LTIOSubStream, LTIOCallbackStream, LTIODynamicMemStream, LTIOFileStream, LTIOMemStream, and LTIOBufferedStream.

Examples:
DerivedStream.cpp.
virtual LT_STATUS LTIOStreamInf::open ( ) [pure virtual]

Opening a stream puts it in a state that allows data access based on cached initialization parameters.

Return values:
LT_STS_IOStreamUninitializedThe stream has not been initialized with enough information to open the stream
LT_STS_IOStreamInvalidStateThe stream is already open
LT_STS_SuccessOn success.
LT_STS_FailureFailure.
otherImplementations may return other codes

Implemented in LTIOSubStream, LTIOCallbackStream, LTIODynamicMemStream, LTIOFileStream, LTIOMemStream, and LTIOBufferedStream.

Examples:
DerivedStream.cpp.
virtual lt_uint32 LTIOStreamInf::read ( lt_uint8 pDest,
lt_uint32  numBytes 
) [pure virtual]
Parameters:
pDestbuffer in which to store read data
numBytesnumber of bytes to read from stream
Return values:
numBytesThe number of bytes actually read

Implemented in LTIOSubStream, LTIOCallbackStream, LTIODynamicMemStream, LTIOFileStream, LTIOMemStream, and LTIOBufferedStream.

Examples:
DerivedStream.cpp.
virtual char* LTIOStreamInf::readString ( int  delimiter = '\0') [virtual]
Return values:
returnsNULL on failure

Reimplemented in LTIODynamicMemStream.

virtual LT_STATUS LTIOStreamInf::seek ( lt_int64  offset,
LTIOSeekDir  origin 
) [pure virtual]
Parameters:
offsetnumber of bytes from origin at which to the next read or write will take place
originplace in stream from which to seek
Return values:
LT_STS_IOStreamUnsupportedThe stream is not seekable
LT_STS_IOStreamInvalidArgsThe offset and origin do not specify a valid location in the stream
LT_STS_SuccessOn success
LT_STS_FailureOtherwise
otherImplementations may return other codes

Implemented in LTIOSubStream, LTIOCallbackStream, LTIODynamicMemStream, LTIOFileStream, LTIOMemStream, and LTIOBufferedStream.

Examples:
DerivedStream.cpp.
virtual lt_int64 LTIOStreamInf::tell ( ) [pure virtual]
Return values:
postionNumber of bytes from the start of the data
-1On error.
otherImplementations may return other codes

Implemented in LTIOSubStream, LTIOCallbackStream, LTIODynamicMemStream, LTIOFileStream, LTIOMemStream, and LTIOBufferedStream.

Examples:
DerivedStream.cpp.
virtual lt_uint32 LTIOStreamInf::write ( const lt_uint8 pSrc,
lt_uint32  numBytes 
) [pure virtual]
Parameters:
pSrcbuffer from which to store data
numBytesnumber of bytes to write to stream
Return values:
numBytesnumber of bytes actually written

Implemented in LTIOSubStream, LTIOCallbackStream, LTIODynamicMemStream, LTIOFileStream, LTIOMemStream, and LTIOBufferedStream.

Examples:
DerivedImageWriter.cpp, and DerivedStream.cpp.

The documentation for this class was generated from the following file: