Geant4  10.02.p03
cheprep::GZIPOutputStreamBuffer Class Reference

#include <GZIPOutputStreamBuffer.h>

Inheritance diagram for cheprep::GZIPOutputStreamBuffer:
Collaboration diagram for cheprep::GZIPOutputStreamBuffer:

Public Member Functions

 GZIPOutputStreamBuffer (std::streambuf *outbuf)
 
int overflow (int)
 
void setFilename (const std::string &filename)
 
void setComment (const std::string &comment)
 
void close ()
 
virtual ~GZIPOutputStreamBuffer ()
 
- Public Member Functions inherited from cheprep::DeflateOutputStreamBuffer
 DeflateOutputStreamBuffer (std::streambuf *buffer)
 
void init (bool compress)
 
void finish ()
 
virtual ~DeflateOutputStreamBuffer ()
 

Private Member Functions

void writeHeader ()
 
void writeTrailer ()
 

Private Attributes

std::string filename
 
std::string comment
 
bool open
 

Additional Inherited Members

- Protected Member Functions inherited from cheprep::DeflateOutputStreamBuffer
int overflow (int c=EOF)
 
bool flushOut ()
 
void putUI (unsigned int ui)
 
void putUS (unsigned short us)
 
void putUB (unsigned char ub)
 
void putS (const std::string s)
 
std::streampos pos ()
 
unsigned int getSize ()
 
unsigned int getCRC ()
 

Detailed Description

Definition at line 15 of file GZIPOutputStreamBuffer.h.

Constructor & Destructor Documentation

◆ GZIPOutputStreamBuffer()

cheprep::GZIPOutputStreamBuffer::GZIPOutputStreamBuffer ( std::streambuf *  outbuf)

Definition at line 13 of file GZIPOutputStreamBuffer.cc.

14  : DeflateOutputStreamBuffer(aBuffer),
15  open(false) {
16 
17  init(true);
18  }
Here is the call graph for this function:

◆ ~GZIPOutputStreamBuffer()

cheprep::GZIPOutputStreamBuffer::~GZIPOutputStreamBuffer ( )
virtual

Definition at line 37 of file GZIPOutputStreamBuffer.cc.

37  {
38  close() ;
39  }
Here is the call graph for this function:

Member Function Documentation

◆ close()

void cheprep::GZIPOutputStreamBuffer::close ( )

Definition at line 28 of file GZIPOutputStreamBuffer.cc.

28  {
29  if (!open) return;
30 
31  finish();
32  writeTrailer();
33 
34  open = false ;
35  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ overflow()

int cheprep::GZIPOutputStreamBuffer::overflow ( int  c)

Definition at line 41 of file GZIPOutputStreamBuffer.cc.

Here is the call graph for this function:

◆ setComment()

void cheprep::GZIPOutputStreamBuffer::setComment ( const std::string &  comment)

Definition at line 24 of file GZIPOutputStreamBuffer.cc.

24  {
25  comment = c ;
26  }
Here is the caller graph for this function:

◆ setFilename()

void cheprep::GZIPOutputStreamBuffer::setFilename ( const std::string &  filename)

Definition at line 20 of file GZIPOutputStreamBuffer.cc.

20  {
21  filename = name ;
22  }
G4String name
Definition: TRTMaterials.hh:40
Here is the caller graph for this function:

◆ writeHeader()

void cheprep::GZIPOutputStreamBuffer::writeHeader ( )
private

Definition at line 49 of file GZIPOutputStreamBuffer.cc.

49  {
50  unsigned char flag = 0x00;
51  flag |= (filename == "") ? 0x00 : 0x08;
52  flag |= (comment == "") ? 0x00 : 0x10;
53 
54  putUB(0x1f); // Magic #
55  putUB(0x8b); // Magic #
56  putUB(0x08); // Deflater.DEFLATED
57  putUB(flag); // FLG
58  putUI(0x00000000); // MTIME
59  putUB(0x00); // XFLG
60  putUB(0x00); // OS
61 
62  if (filename != "") {
63  putS(filename); // Filename
64  putUB(0x00);
65  }
66 
67  if (comment != "") {
68  putS(comment); // Comment
69  putUB(0x00);
70  }
71  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ writeTrailer()

void cheprep::GZIPOutputStreamBuffer::writeTrailer ( )
private

Definition at line 73 of file GZIPOutputStreamBuffer.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ comment

std::string cheprep::GZIPOutputStreamBuffer::comment
private

Definition at line 35 of file GZIPOutputStreamBuffer.h.

◆ filename

std::string cheprep::GZIPOutputStreamBuffer::filename
private

Definition at line 34 of file GZIPOutputStreamBuffer.h.

◆ open

bool cheprep::GZIPOutputStreamBuffer::open
private

Definition at line 36 of file GZIPOutputStreamBuffer.h.


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