Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

Decompressor Class Reference

This manages run-time decompression of a zlib-compressed stream, as a background or foreground task. More...

#include <decompressor.h>

List of all members.

Public Member Functions

 Decompressor ()
 ~Decompressor ()
int initiate (const Filename &source_file)
 Begins a background decompression of the named file (whose filename must end in ".pz") to a new file without the .pz extension.

int initiate (const Filename &source_file, const Filename &dest_file)
 Begins a background decompression from the named source file to the named destination file.

int run ()
 Called each frame to do the next bit of work in the background task.

bool decompress (const Filename &source_file)
 Performs a foreground decompression of the named file; does not return until the decompression is complete.

bool decompress (Ramfile &source_and_dest_file)
 Does an in-memory decompression of the indicated Ramfile.

float get_progress () const
 Returns the ratio through the decompression step in the background.


Private Member Functions

void cleanup (void)
 Called to reset a previous decompressor state and clean up properly.


Private Attributes

Filename _source_filename
istream * _source
istream * _decompress
ostream * _dest
size_t _source_length


Detailed Description

This manages run-time decompression of a zlib-compressed stream, as a background or foreground task.

Definition at line 41 of file decompressor.h.


Constructor & Destructor Documentation

Decompressor::Decompressor  ) 
 

Definition at line 45 of file decompressor.cxx.

References cleanup().

Decompressor::~Decompressor  ) 
 

Definition at line 59 of file decompressor.cxx.

References dest_file, Filename::get_extension(), Filename::get_fullpath_wo_extension(), and initiate().


Member Function Documentation

void Decompressor::cleanup void   )  [private]
 

Called to reset a previous decompressor state and clean up properly.

Definition at line 305 of file decompressor.cxx.

Referenced by Decompressor().

bool Decompressor::decompress Ramfile source_and_dest_file  ) 
 

Does an in-memory decompression of the indicated Ramfile.

The decompressed contents are written back into the same Ramfile on completion.

Definition at line 252 of file decompressor.cxx.

References _source_length.

bool Decompressor::decompress const Filename source_file  ) 
 

Performs a foreground decompression of the named file; does not return until the decompression is complete.

Definition at line 221 of file decompressor.cxx.

float Decompressor::get_progress  )  const
 

Returns the ratio through the decompression step in the background.

Definition at line 280 of file decompressor.cxx.

int Decompressor::initiate const Filename source_file,
const Filename dest_file
 

Begins a background decompression from the named source file to the named destination file.

The source file is removed after successful completion.

Definition at line 107 of file decompressor.cxx.

References _source_length, and EU_error_file_empty.

int Decompressor::initiate const Filename source_file  ) 
 

Begins a background decompression of the named file (whose filename must end in ".pz") to a new file without the .pz extension.

The source file is removed after successful completion.

Definition at line 78 of file decompressor.cxx.

References EU_error_abort.

Referenced by ~Decompressor().

int Decompressor::run  ) 
 

Called each frame to do the next bit of work in the background task.

Returns EU_ok if a chunk is completed but there is more to go, or EU_success when we're all done. Any other return value indicates an error.

Definition at line 180 of file decompressor.cxx.

References EU_success.


Member Data Documentation

istream* Decompressor::_decompress [private]
 

Definition at line 61 of file decompressor.h.

ostream* Decompressor::_dest [private]
 

Definition at line 62 of file decompressor.h.

istream* Decompressor::_source [private]
 

Definition at line 60 of file decompressor.h.

Filename Decompressor::_source_filename [private]
 

Definition at line 58 of file decompressor.h.

size_t Decompressor::_source_length [private]
 

Definition at line 64 of file decompressor.h.

Referenced by decompress(), and initiate().


The documentation for this class was generated from the following files:
Generated on Fri May 2 00:49:15 2003 for Panda by doxygen1.3