Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / rst / rstzip3 / rstzip_v2 / rstzip2if.C
CommitLineData
920dae64
AT
1// ========== Copyright Header Begin ==========================================
2//
3// OpenSPARC T2 Processor File: rstzip2if.C
4// Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
5// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
6//
7// The above named program is free software; you can redistribute it and/or
8// modify it under the terms of the GNU General Public
9// License version 2 as published by the Free Software Foundation.
10//
11// The above named program is distributed in the hope that it will be
12// useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14// General Public License for more details.
15//
16// You should have received a copy of the GNU General Public
17// License along with this work; if not, write to the Free Software
18// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
19//
20// ========== Copyright Header End ============================================
21#include <assert.h>
22
23#include "rstzip2if.H"
24#include "rstzipif.H"
25
26// C++ rstzip2 (de)compression class.
27
28Rstzip2if::Rstzip2if() {
29 rstzip = new RstzipIF;
30 assert(rstzip != NULL);
31}
32
33Rstzip2if::~Rstzip2if() {
34 delete rstzip;
35}
36
37// ==== Version routines ====
38
39int Rstzip2if::getMajorVersion() {
40 return RSTZIP_MAJOR_VERSION;
41}
42
43int Rstzip2if::getMinorVersion() {
44 return RSTZIP_MINOR_VERSION;
45}
46
47// ==== Compression routines ====
48
49int Rstzip2if::openRstzip(const char* outfile, int buffersize, int gzip, int stats, int numcpus) {
50 return rstzip->openRstzip(outfile, buffersize, gzip, stats, numcpus);
51}
52
53int Rstzip2if::compress(rstf_unionT* rstbuf, int nrecs) {
54 return rstzip->compress(rstbuf, nrecs);
55}
56
57void Rstzip2if::closeRstzip() {
58 rstzip->closeRstzip();
59}
60
61// ==== Decompression routines ====
62
63int Rstzip2if::openRstunzip(const char* infile, int buffersize, int gzip, int stats) {
64 return rstzip->openRstunzip(infile, buffersize, gzip, stats);
65}
66
67int Rstzip2if::decompress(rstf_unionT* rstbuf, int nrecs) {
68 return rstzip->decompress(rstbuf, nrecs);
69}
70
71void Rstzip2if::closeRstunzip() {
72 rstzip->closeRstunzip();
73}
74
75// C wrapper prototypes.
76
77int rz2_getMajorVersion(Rstzip2if* rstzip) {
78 return rstzip->getMajorVersion();
79}
80
81int rz2_getMinorVersion(Rstzip2if* rstzip) {
82 return rstzip->getMinorVersion();
83}
84
85Rstzip2if* rz2_openRstzip(char* outfile, int buffersize, int gzip, int stats, int numcpus) {
86 Rstzip2if* rstzip = new Rstzip2if;
87
88 assert(rstzip != NULL);
89 rstzip->openRstzip(outfile, buffersize, gzip, stats, numcpus);
90
91 return rstzip;
92}
93
94int rz2_compress(Rstzip2if* rstzip, rstf_unionT* rstbuf, int nrecs) {
95 return rstzip->compress(rstbuf, nrecs);
96}
97
98void rz2_closeRstzip(Rstzip2if* rstzip) {
99 rstzip->closeRstzip();
100 delete rstzip;
101}
102
103Rstzip2if* rz2_openRstunzip(char* infile, int buffersize, int gzip, int stats) {
104 Rstzip2if* rstunzip = new Rstzip2if;
105
106 assert(rstunzip != NULL);
107 rstunzip->openRstunzip(infile, buffersize, gzip, stats);
108
109 return rstunzip;
110}
111
112int rz2_decompress(Rstzip2if* rstunzip, rstf_unionT* rstbuf, int nrecs) {
113 return rstunzip->decompress(rstbuf, nrecs);
114}
115
116void rz2_closeRstunzip(Rstzip2if* rstunzip) {
117 rstunzip->closeRstunzip();
118 delete rstunzip;
119}