Public Types | Public Member Functions | Protected Attributes | Static Private Attributes

cmtk::CompressedStream::ReaderBase Class Reference

Abstract base class for low-level reader engines. More...

Inheritance diagram for cmtk::CompressedStream::ReaderBase:
Inheritance graph
[legend]

List of all members.

Public Types

typedef ReaderBase Self
 This class.
typedef SmartPointer< SelfSmartPtr
 Smart pointer to this class.

Public Member Functions

 ReaderBase ()
 Default constructor.
virtual void Close ()=0
 Close current file stream.
virtual void Rewind ()
 Reset read pointer to beginning of stream.
virtual int Seek (const long int offset, int whence)
 Set filepointer.
virtual size_t Read (void *data, size_t size, size_t count)=0
 Read block of data.
virtual bool Get (char &c)=0
 Read a single character from the stream.
virtual int Tell () const =0
 Return number of bytes read from stream.
virtual bool Feof () const =0
 Return 1 if and only if end of file reached.

Protected Attributes

size_t m_BytesRead
 Count number of bytes read from file or pipe.

Static Private Attributes

static const size_t SeekBlockSize = 8192
 Block size for fake seek() operation.

Detailed Description

Abstract base class for low-level reader engines.

Definition at line 201 of file cmtkCompressedStream.h.


Member Typedef Documentation

Smart pointer to this class.

Reimplemented in cmtk::CompressedStream::File, cmtk::CompressedStream::Pipe, and cmtk::CompressedStream::Zlib.

Definition at line 208 of file cmtkCompressedStream.h.


Constructor & Destructor Documentation

cmtk::CompressedStream::ReaderBase::ReaderBase (  ) [inline]

Default constructor.

Definition at line 211 of file cmtkCompressedStream.h.


Member Function Documentation

virtual void cmtk::CompressedStream::ReaderBase::Close (  ) [pure virtual]
virtual bool cmtk::CompressedStream::ReaderBase::Feof (  ) const [pure virtual]

Return 1 if and only if end of file reached.

Implemented in cmtk::CompressedStream::File, cmtk::CompressedStream::Pipe, and cmtk::CompressedStream::Zlib.

virtual bool cmtk::CompressedStream::ReaderBase::Get ( char &  c ) [pure virtual]

Read a single character from the stream.

Implemented in cmtk::CompressedStream::File, cmtk::CompressedStream::Pipe, and cmtk::CompressedStream::Zlib.

virtual size_t cmtk::CompressedStream::ReaderBase::Read ( void *  data,
size_t  size,
size_t  count 
) [pure virtual]

Read block of data.

Implemented in cmtk::CompressedStream::File, cmtk::CompressedStream::Pipe, and cmtk::CompressedStream::Zlib.

Referenced by Seek().

virtual void cmtk::CompressedStream::ReaderBase::Rewind (  ) [inline, virtual]

Reset read pointer to beginning of stream.

Reimplemented in cmtk::CompressedStream::File, cmtk::CompressedStream::Pipe, and cmtk::CompressedStream::Zlib.

Definition at line 217 of file cmtkCompressedStream.h.

Referenced by Seek().

int cmtk::CompressedStream::ReaderBase::Seek ( const long int  offset,
int  whence 
) [virtual]

Set filepointer.

This class implements a naive seek that optionally calls "this->Rewind()" (if "whence" is SEEK_SET, then reads "offset" bytes from the input to position read pointer.

Parameters:
offsetOffset the file pointer is set to, depending on the value of whence.
whenceFile pointer set mode as defined for fseek.

Reimplemented in cmtk::CompressedStream::File, and cmtk::CompressedStream::Zlib.

Definition at line 36 of file cmtkCompressedStreamReaderBase.cxx.

References m_BytesRead, Read(), Rewind(), and SeekBlockSize.

virtual int cmtk::CompressedStream::ReaderBase::Tell (  ) const [pure virtual]

Return number of bytes read from stream.

Implemented in cmtk::CompressedStream::File, cmtk::CompressedStream::Pipe, and cmtk::CompressedStream::Zlib.


Member Data Documentation

Count number of bytes read from file or pipe.

Definition at line 250 of file cmtkCompressedStream.h.

Referenced by Seek().

const size_t cmtk::CompressedStream::ReaderBase::SeekBlockSize = 8192 [static, private]

Block size for fake seek() operation.

Definition at line 246 of file cmtkCompressedStream.h.

Referenced by Seek().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines