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

cmtk::CompressedStream Class Reference
[cmtkSystem Library]

Stream with on-the-fly decompression. More...

#include <cmtkCompressedStream.h>

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

List of all members.

Classes

struct  ArchiveLookupEntry
 Entry for the suffix-to-archiver assignment table. More...
class  File
 Class for uncompressed file-based reader engine. More...
class  Pipe
 Class for reader engine using pipe. More...
class  ReaderBase
 Abstract base class for low-level reader engines. More...
class  Zlib
 Class for Zlib-based reader engine. More...

Public Types

typedef CompressedStream Self
 This class.

Public Member Functions

 CompressedStream ()
 Create stream object without opening any files.
 CompressedStream (const char *filename)
 Create stream from filename.
 ~CompressedStream ()
 Dispose stream object.
bool IsValid () const
 Return validity of stream.
bool IsCompressed () const
 Return flag whether this stream is actually using decompression or simply reads a file as-is.
bool Open (const char *filename)
 Open new stream from filename.
void Close ()
 Close current file stream.
void Rewind ()
 Set filepointer to beginning of file.
int Seek (const long int offset, int whence)
 Set filepointer.
size_t Read (void *data, size_t size, size_t count)
 Read block of data.
int Get (char &c)
 Read a single character from the stream.
int Tell () const
 Return number of bytes read from stream.
bool Feof () const
 Return 1 if and only if end of file reached.

Static Public Member Functions

static std::string GetBaseName (const std::string &path)
 Return base name of a path without compression suffix.
static int Stat (const char *path, struct stat *const buf=NULL)
 Do stat() on compressed file.

Private Member Functions

bool OpenDecompressionPipe (const char *filename, const char *suffix, const char *command, const char *compressedSuffix)
 Open decompressing pipe.

Private Attributes

ReaderBase::SmartPtr m_Reader
 The low-level reader object.
bool m_Compressed
 Flag whether current stream is from a compressed source.

Static Private Attributes

static const ArchiveLookupEntry ArchiveLookup []
 The suffix-to-archiver assignment table.

Detailed Description

Stream with on-the-fly decompression.

Definition at line 77 of file cmtkCompressedStream.h.


Member Typedef Documentation

This class.

Definition at line 83 of file cmtkCompressedStream.h.


Constructor & Destructor Documentation

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

Create stream object without opening any files.

Definition at line 86 of file cmtkCompressedStream.h.


Member Function Documentation

bool cmtk::CompressedStream::Feof (  ) const [inline]

Return 1 if and only if end of file reached.

Definition at line 151 of file cmtkCompressedStream.h.

Referenced by cmtk::VolumeFromFile::ReadBioRad().

int cmtk::CompressedStream::Get ( char &  c ) [inline]

Read a single character from the stream.

Definition at line 139 of file cmtkCompressedStream.h.

Referenced by cmtk::PGM::Read().

bool cmtk::CompressedStream::IsCompressed (  ) const [inline]

Return flag whether this stream is actually using decompression or simply reads a file as-is.

Definition at line 101 of file cmtkCompressedStream.h.

Referenced by cmtk::FileFormat::IdentifyFile().

bool cmtk::CompressedStream::IsValid (  ) const [inline]
size_t cmtk::CompressedStream::Read ( void *  data,
size_t  size,
size_t  count 
) [inline]
void cmtk::CompressedStream::Rewind (  ) [inline]

Set filepointer to beginning of file.

Definition at line 114 of file cmtkCompressedStream.h.

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

Set filepointer.

If the object represents a pipe with on-the-fly decompression, only the set mode "SEEK_CUR" is supported and will be simulated by successive reading of 8kB data blocks from the pipe.

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

Definition at line 127 of file cmtkCompressedStream.h.

Referenced by cmtk::ScalarImageIO::ReadAnalyze(), cmtk::VolumeFromFile::ReadAnalyzeHdr(), and cmtk::VolumeFromFile::ReadNifti().

int cmtk::CompressedStream::Tell (  ) const [inline]

Return number of bytes read from stream.

Definition at line 145 of file cmtkCompressedStream.h.


Member Data Documentation

Flag whether current stream is from a compressed source.

Definition at line 478 of file cmtkCompressedStream.h.

Referenced by Open().

The low-level reader object.

Definition at line 475 of file cmtkCompressedStream.h.

Referenced by Close(), and Open().


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