Abstract base class for low-level reader engines. More...
Public Types | |
typedef ReaderBase | Self |
This class. | |
typedef SmartPointer< Self > | SmartPtr |
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. |
Abstract base class for low-level reader engines.
Definition at line 201 of file cmtkCompressedStream.h.
This class.
Reimplemented in cmtk::CompressedStream::File, cmtk::CompressedStream::Pipe, and cmtk::CompressedStream::Zlib.
Definition at line 205 of file cmtkCompressedStream.h.
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.
cmtk::CompressedStream::ReaderBase::ReaderBase | ( | ) | [inline] |
Default constructor.
Definition at line 211 of file cmtkCompressedStream.h.
virtual void cmtk::CompressedStream::ReaderBase::Close | ( | ) | [pure virtual] |
Close current file stream.
Implemented in cmtk::CompressedStream::File, cmtk::CompressedStream::Pipe, and cmtk::CompressedStream::Zlib.
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.
offset | Offset the file pointer is set to, depending on the value of whence. |
whence | File 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.
size_t cmtk::CompressedStream::ReaderBase::m_BytesRead [protected] |
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().