CernVM-FS  2.9.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
zlib::Compressor Class Referenceabstract

#include <compression.h>

Inheritance diagram for zlib::Compressor:
Collaboration diagram for zlib::Compressor:

Public Member Functions

 Compressor (const Algorithms &)
 
virtual ~Compressor ()
 
virtual bool Deflate (const bool flush, unsigned char **inbuf, size_t *inbufsize, unsigned char **outbuf, size_t *outbufsize)=0
 
virtual size_t DeflateBound (const size_t bytes)=0
 
virtual CompressorClone ()=0
 
- Public Member Functions inherited from PolymorphicConstructionImpl< Compressor, Algorithms, void >
virtual ~PolymorphicConstructionImpl ()
 

Static Public Member Functions

static void RegisterPlugins ()
 
- Static Public Member Functions inherited from PolymorphicConstruction< Compressor, Algorithms >
static IntrospectionData Introspect ()
 
- Static Public Member Functions inherited from PolymorphicConstructionImpl< Compressor, Algorithms, void >
static Compressor * Construct (const Algorithms &param)
 

Additional Inherited Members

- Public Types inherited from PolymorphicConstruction< Compressor, Algorithms >
typedef std::vector< void > IntrospectionData
 
- Protected Types inherited from PolymorphicConstructionImpl< Compressor, Algorithms, void >
typedef AbstractFactory
< Compressor, Algorithms, void > 
Factory
 
typedef std::vector< Factory * > RegisteredPlugins
 
- Protected Member Functions inherited from PolymorphicConstructionImpl< Compressor, Algorithms, void >
virtual bool Initialize ()
 
- Static Protected Member Functions inherited from PolymorphicConstructionImpl< Compressor, Algorithms, void >
static void LazilyRegisterPlugins ()
 
static void RegisterPlugin ()
 
- Static Protected Attributes inherited from PolymorphicConstructionImpl< Compressor, Algorithms, void >
static RegisteredPlugins registered_plugins_
 

Detailed Description

Abstract Compression class which is inherited by implementations of compression engines such as zlib.

In order to add a new compression method, you simply need to add a new class which is a sub-class of the Compressor. The subclass needs to implement the Deflate, DeflateBound, Clone, and WillHandle functions. For information on the WillHandle function, read up on the PolymorphicConstruction class. The new sub-class must be listed in the implemention of the Compressor::RegisterPlugins function.

Definition at line 61 of file compression.h.

Constructor & Destructor Documentation

zlib::Compressor::Compressor ( const Algorithms )
inlineexplicit

Definition at line 63 of file compression.h.

virtual zlib::Compressor::~Compressor ( )
inlinevirtual

Definition at line 64 of file compression.h.

Member Function Documentation

virtual Compressor* zlib::Compressor::Clone ( )
pure virtual
virtual bool zlib::Compressor::Deflate ( const bool  flush,
unsigned char **  inbuf,
size_t *  inbufsize,
unsigned char **  outbuf,
size_t *  outbufsize 
)
pure virtual

Deflate function. The arguments and returns closely match the input and output of the zlib deflate function. Input:

  • outbuf - Ouput buffer to write the compressed data.
  • outbufsize - Size of the output buffer
  • inbuf - Input data to be compressed
  • inbufsize - Size of the input buffer
  • flush - Whether the compression stream should be flushed / finished Upon return: returns: true - if done compressing, false otherwise
  • outbuf - output buffer pointer (unchanged from input)
  • outbufsize - The number of bytes used in the outbuf
  • inbuf - Pointer to the next byte of input to read in
  • inbufsize - the remaining bytes of input to read in.
  • flush - unchanged from input

Implemented in zlib::EchoCompressor, and zlib::ZlibCompressor.

Referenced by swissknife::CommandGraft::ChecksumFdWithChunks().

Here is the caller graph for this function:

virtual size_t zlib::Compressor::DeflateBound ( const size_t  bytes)
pure virtual

Return an upper bound on the number of bytes required in order to compress an input number of bytes. Returns: Upper bound on the number of bytes required to compress.

Implemented in zlib::EchoCompressor, and zlib::ZlibCompressor.

void zlib::Compressor::RegisterPlugins ( )
static

Definition at line 858 of file compression.cc.


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