#include <BESUncompressManager.h>
Inheritance diagram for BESUncompressManager:
Public Member Functions | |
virtual | ~BESUncompressManager (void) |
virtual bool | add_method (const string &name, p_bes_uncompress method) |
add a uncompress method to the list | |
virtual bool | remove_method (const string &name) |
removes a uncompress method from the list | |
virtual p_bes_uncompress | find_method (const string &name) |
returns the uncompression method specified | |
virtual string | get_method_names () |
returns the comma separated list of all uncompression methods currently registered. | |
virtual string | uncompress (const string &src, BESCache &cache) |
find the method that can uncompress the specified src and pass control to that method. | |
virtual void | dump (ostream &strm) const |
dumps information about this object | |
Static Public Member Functions | |
static BESUncompressManager * | TheManager () |
Protected Member Functions | |
BESUncompressManager (void) | |
constructs an uncompression manager adding gz and bz2 uncompression methods by default. |
The BESUncompressManager allows the developer to add or remove named uncompression methods from the list for this server. By default a gz and bz2 and Z function is provided.
What is actually added to the list are static uncompression functions. Each of these functions is responsible for uncompressing a specific type of compressed file. The manager knows which type to uncompress by the file extension. All extensions are converted to lower case in order to make a match, so, for example, all .Z compressed files will be matched with the static function registered with the name z.
Definition at line 66 of file BESUncompressManager.h.
BESUncompressManager::BESUncompressManager | ( | void | ) | [protected] |
constructs an uncompression manager adding gz and bz2 uncompression methods by default.
Definition at line 51 of file BESUncompressManager.cc.
References add_method(), BESKeys::get_key(), TheBESKeys::TheKeys(), BESUncompressZ::uncompress(), BESUncompressBZ2::uncompress(), and BESUncompressGZ::uncompress().
Here is the call graph for this function:
virtual BESUncompressManager::~BESUncompressManager | ( | void | ) | [inline, virtual] |
Definition at line 79 of file BESUncompressManager.h.
bool BESUncompressManager::add_method | ( | const string & | name, | |
p_bes_uncompress | method | |||
) | [virtual] |
add a uncompress method to the list
This method actually adds to the list a static method that knows how to uncompress a particular type of file. For example, a .gz or .bz2 file.
name | name of the method to add to the list | |
method | the static function that uncompress the particular type of file |
Definition at line 93 of file BESUncompressManager.cc.
Referenced by BESUncompressManager().
bool BESUncompressManager::remove_method | ( | const string & | name | ) | [virtual] |
removes a uncompress method from the list
The static method that knows how to uncompress the specified type of file is removed from the list.
name | name of the method to remove |
Definition at line 115 of file BESUncompressManager.cc.
p_bes_uncompress BESUncompressManager::find_method | ( | const string & | name | ) | [virtual] |
returns the uncompression method specified
This method looks up the uncompression method with the given name and returns that method.
name | name of the uncompression method to find |
Definition at line 136 of file BESUncompressManager.cc.
Referenced by uncompress().
string BESUncompressManager::get_method_names | ( | ) | [virtual] |
returns the comma separated list of all uncompression methods currently registered.
Definition at line 153 of file BESUncompressManager.cc.
string BESUncompressManager::uncompress | ( | const string & | src, | |
BESCache & | cache | |||
) | [virtual] |
find the method that can uncompress the specified src and pass control to that method.
First, the cache passed is locked to make sure no one else attempts to purge the cache at the same time we're checking the cache.
Secondly, the cache is checked to determine if the target file already exists. The check method on the cache returns the target file, whether it is cached or not. If it is cached then that target file is returned and the cache is unlocked.
If it is not cached then it is uncompressed using the static function registered with the same name as the file extension to be uncomressed (converted to lower case). For example, if the source file is a .GZ file (gzipped file) then we find the uncompress function with the name gz. The cache is then unlocked and the target returned.
If the file extension can not be found in the list then the source file is returned as the target file. If, for example, a compressed file with the extension .bozo is passed as the source file, and there is no uncompression function with the name bozo, then the src file with the extension .bozo is returned as is.
src | file to be uncompressed | |
cache | BESCache object to uncompress the src file in |
BESContainerStorageException | if there is a problem uncompressing the file. |
Definition at line 198 of file BESUncompressManager.cc.
References BESDEBUG, BESCache::cache_dir(), find_method(), BESCache::is_cached(), BESCache::lock(), BESCache::purge(), and BESCache::unlock().
Referenced by BESFileContainer::access(), and uncompressT::run().
Here is the call graph for this function:
void BESUncompressManager::dump | ( | ostream & | strm | ) | const [virtual] |
dumps information about this object
Displays the pointer value of this instance along with the names of the registered uncompression methods.
strm | C++ i/o stream to dump the information to |
Implements BESObj.
Definition at line 313 of file BESUncompressManager.cc.
References BESIndent::Indent(), BESIndent::LMarg(), and BESIndent::UnIndent().
Here is the call graph for this function:
BESUncompressManager * BESUncompressManager::TheManager | ( | ) | [static] |
Definition at line 338 of file BESUncompressManager.cc.
Referenced by BESFileContainer::access(), and uncompressT::run().