Import Geant4 7.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 12:11:21 +02:00
parent 516dbf1a58
commit d93e1e39a9
5384 changed files with 125662 additions and 82444 deletions
+78
View File
@@ -0,0 +1,78 @@
// Copyright FreeHEP, 2005.
#include "cheprep/GZIPOutputStreamBuffer.h"
/**
* @author Mark Donszelmann
* @version $Id: GZIPOutputStreamBuffer.cc,v 1.4 2005/06/02 21:28:45 duns Exp $
*/
namespace cheprep {
using namespace std;
GZIPOutputStreamBuffer::GZIPOutputStreamBuffer( streambuf *buffer)
: DeflateOutputStreamBuffer(buffer),
open(false) {
init(true);
}
void GZIPOutputStreamBuffer::setFilename( const string &name ) {
filename = name ;
}
void GZIPOutputStreamBuffer::setComment( const string &c ) {
comment = c ;
}
void GZIPOutputStreamBuffer::close() {
if (!open) return;
finish();
writeTrailer();
open = false ;
}
GZIPOutputStreamBuffer::~GZIPOutputStreamBuffer() {
close() ;
}
int GZIPOutputStreamBuffer::overflow( int c ) {
if (!open) {
writeHeader();
open = true;
}
return DeflateOutputStreamBuffer::overflow( c ) ;
}
void GZIPOutputStreamBuffer::writeHeader() {
unsigned char flag = 0x00;
flag |= (filename == "") ? 0x00 : 0x08;
flag |= (comment == "") ? 0x00 : 0x10;
putUB(0x1f); // Magic #
putUB(0x8b); // Magic #
putUB(0x08); // Deflater.DEFLATED
putUB(flag); // FLG
putUI(0x00000000); // MTIME
putUB(0x00); // XFLG
putUB(0x00); // OS
if (filename != "") {
putS(filename); // Filename
putUB(0x00);
}
if (comment != "") {
putS(comment); // Comment
putUB(0x00);
}
}
void GZIPOutputStreamBuffer::writeTrailer() {
putUI(getCRC());
putUI(getSize());
}
} // cheprep