LIBRCSC Docs
Documentation for HELIOS's BASE LIBRCSC library for RoboCup 2D Simulation League.
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
Public Types | Public Member Functions | Protected Member Functions | List of all members
rcsc::gzfilterstreambuf Class Reference

gzip filtering stream buffer class. More...

#include <gzfilterstream.h>

Inheritance diagram for rcsc::gzfilterstreambuf:
Inheritance graph
[legend]
Collaboration diagram for rcsc::gzfilterstreambuf:
Collaboration graph
[legend]

Public Types

enum  CompressionLevel { DEFAULT_COMPRESSION = 6 , NO_COMPRESSION = 0 , BEST_SPEED = 1 , BEST_COMPRESSION = 9 }
 typical compression level enumeration More...
 
enum  FlushType {
  NO_FLUSH = 0 , PARTIAL_FLUSH = 1 , SYNC_FLUSH = 2 , FULL_FLUSH = 3 ,
  FINISH = 4
}
 flush type enumeration.
 

Public Member Functions

 gzfilterstreambuf (std::streambuf &strm, int level=DEFAULT_COMPRESSION, std::size_t buf_size=8192)
 constructor with another stream buffer More...
 
 ~gzfilterstreambuf ()
 destructor More...
 
bool setLevel (const int level)
 change complession level More...
 

Protected Member Functions

bool writeData (int flush_type=NO_FLUSH)
 write data to buffer and/or destination More...
 
int readData (char *dest, int &dest_size)
 read data from destination. More...
 
virtual int_type overflow (int_type c)
 flush current internal buffer. More...
 
virtual int sync ()
 syncronize data to output devide More...
 
virtual int_type underflow ()
 read data from input device More...
 

Detailed Description

gzip filtering stream buffer class.

Member Enumeration Documentation

◆ CompressionLevel

typical compression level enumeration

The list of compresion level defined in zlib.h

  • Z_NO_COMPRESSION
  • Z_BEST_SPEED
  • Z_BEST_COMPRESSION
  • Z_DEFAULT_COMPRESSION

Constructor & Destructor Documentation

◆ gzfilterstreambuf()

rcsc::gzfilterstreambuf::gzfilterstreambuf ( std::streambuf &  strm,
int  level = DEFAULT_COMPRESSION,
std::size_t  buf_size = 8192 
)
explicit

constructor with another stream buffer

Parameters
strmfiltered stream buffer.
levelgzip compression level
buf_sizeallocated buffer size (default: 8192)

Default constructor creates an internal file buffer using unique_ptr. This buffer is deleted automatically.

◆ ~gzfilterstreambuf()

rcsc::gzfilterstreambuf::~gzfilterstreambuf ( )

destructor

Destructor flushes buffered data and releases all allocated buffers.

Member Function Documentation

◆ overflow()

virtual int_type rcsc::gzfilterstreambuf::overflow ( int_type  c)
protectedvirtual

flush current internal buffer.

this method is overrided method and called from close(), sync() and overflow().

◆ readData()

int rcsc::gzfilterstreambuf::readData ( char *  dest,
int &  dest_size 
)
protected

read data from destination.

Parameters
destbuffer to record the data.
dest_sizereference to the buffer size variable
Returns
size of the read data

◆ setLevel()

bool rcsc::gzfilterstreambuf::setLevel ( const int  level)

change complession level

Parameters
levelnew compression level(0-9)
Returns
true if level is validated value, else false.

Compression strategy is set to Z_DEFAULT_STRATEGY automatically.

◆ sync()

virtual int rcsc::gzfilterstreambuf::sync ( )
protectedvirtual

syncronize data to output devide

this method is overrided method

◆ underflow()

virtual int_type rcsc::gzfilterstreambuf::underflow ( )
protectedvirtual

read data from input device

this method is overrided method and supposed to read some bytes from the input device to internal buffer.

◆ writeData()

bool rcsc::gzfilterstreambuf::writeData ( int  flush_type = NO_FLUSH)
protected

write data to buffer and/or destination

Parameters
flush_typezlib flush type parameter. see deflate in zlib.h.
Returns
true if successfully written, else false.

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