Panda3D
Public Member Functions | Public Attributes | List of all members
Extractor Class Reference

This class automatically extracts the contents of a Multifile to the current directory (or to a specified directory) in the background. More...

#include "extractor.h"

Public Member Functions

PN_stdfloat get_progress () const
 
int request_all_subfiles ()
 Requests all subfiles in the Multifile to be extracted. More...
 
bool request_subfile (const Filename &subfile_name)
 Requests a particular subfile to be extracted when step() or run() is called. More...
 
void reset ()
 Interrupts the Extractor in the middle of its business and makes it ready to accept a new list of subfiles to extract. More...
 
bool run ()
 A convenience function to extract the Multifile all at once, when you don't care about doing it in the background. More...
 
void set_extract_dir (const Filename &extract_dir)
 Specifies the directory into which all extracted subfiles will be written. More...
 
bool set_multifile (const Filename &multifile_name)
 Specifies the filename of the Multifile that the Extractor will read. More...
 
int step ()
 After all of the requests have been made via request_file() or request_all_subfiles(), call step() repeatedly until it stops returning EU_ok. More...
 

Public Attributes

 get_progress
 Returns the fraction of the Multifile extracted so far. More...
 

Detailed Description

This class automatically extracts the contents of a Multifile to the current directory (or to a specified directory) in the background.

It is designed to limit its use of system resources and run unobtrusively in the background. After specifying the files you wish to extract via repeated calls to request_subfile(), begin the process by calling run() repeatedly. Each call to run() extracts another small portion of the Multifile. Call run() whenever you have spare cycles until run() returns EU_success.

Definition at line 35 of file extractor.h.

Member Function Documentation

◆ request_all_subfiles()

int Extractor::request_all_subfiles ( )

Requests all subfiles in the Multifile to be extracted.

Returns the number requested.

Definition at line 98 of file extractor.cxx.

◆ request_subfile()

bool Extractor::request_subfile ( const Filename subfile_name)

Requests a particular subfile to be extracted when step() or run() is called.

Returns true if the subfile exists, false otherwise.

Definition at line 83 of file extractor.cxx.

◆ reset()

void Extractor::reset ( )

Interrupts the Extractor in the middle of its business and makes it ready to accept a new list of subfiles to extract.

Definition at line 64 of file extractor.cxx.

References Multifile::close_read_subfile().

◆ run()

bool Extractor::run ( )

A convenience function to extract the Multifile all at once, when you don't care about doing it in the background.

First, call request_file() or request_all_files() to specify the files you would like to extract, then call run() to do the extraction. Also see step() for when you would like the extraction to happen as a background task.

Definition at line 265 of file extractor.cxx.

References step().

◆ set_extract_dir()

void Extractor::set_extract_dir ( const Filename extract_dir)

Specifies the directory into which all extracted subfiles will be written.

Relative paths of subfiles within the Multifile will be written as relative paths to this directory.

Definition at line 55 of file extractor.cxx.

◆ set_multifile()

bool Extractor::set_multifile ( const Filename multifile_name)

Specifies the filename of the Multifile that the Extractor will read.

Returns true on success, false if the mulifile name is invalid.

Definition at line 43 of file extractor.cxx.

◆ step()

int Extractor::step ( )

After all of the requests have been made via request_file() or request_all_subfiles(), call step() repeatedly until it stops returning EU_ok.

step() extracts the next small unit of data from the Multifile. Returns EU_ok if progress is continuing, EU_error_abort if there is a problem, or EU_success when the last piece has been extracted.

Also see run().

Definition at line 121 of file extractor.cxx.

References TrueClock::get_global_ptr().

Referenced by run().

Member Data Documentation

◆ get_progress

PN_stdfloat Extractor::get_progress

Returns the fraction of the Multifile extracted so far.

Definition at line 54 of file extractor.h.


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