CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
129 lines
2.4 KiB
C++
129 lines
2.4 KiB
C++
|
|
#ifndef zfstream_h
|
|
#define zfstream_h
|
|
|
|
#include <fstream.h>
|
|
#include "zlib.h"
|
|
|
|
class gzfilebuf : public streambuf {
|
|
|
|
public:
|
|
|
|
gzfilebuf( );
|
|
virtual ~gzfilebuf();
|
|
|
|
gzfilebuf *open( const char *name, int io_mode );
|
|
gzfilebuf *attach( int file_descriptor, int io_mode );
|
|
gzfilebuf *close();
|
|
|
|
int setcompressionlevel( int comp_level );
|
|
int setcompressionstrategy( int comp_strategy );
|
|
|
|
inline int is_open() const { return (file !=NULL); }
|
|
|
|
virtual streampos seekoff( streamoff, ios::seek_dir, int );
|
|
|
|
virtual int sync();
|
|
|
|
protected:
|
|
|
|
virtual int underflow();
|
|
virtual int overflow( int = EOF );
|
|
|
|
private:
|
|
|
|
gzFile file;
|
|
short mode;
|
|
short own_file_descriptor;
|
|
|
|
int flushbuf();
|
|
int fillbuf();
|
|
|
|
};
|
|
|
|
class gzfilestream_common : virtual public ios {
|
|
|
|
friend class gzifstream;
|
|
friend class gzofstream;
|
|
friend gzofstream &setcompressionlevel( gzofstream &, int );
|
|
friend gzofstream &setcompressionstrategy( gzofstream &, int );
|
|
|
|
public:
|
|
virtual ~gzfilestream_common();
|
|
|
|
void attach( int fd, int io_mode );
|
|
void open( const char *name, int io_mode );
|
|
void close();
|
|
|
|
protected:
|
|
gzfilestream_common();
|
|
|
|
private:
|
|
gzfilebuf *rdbuf();
|
|
|
|
gzfilebuf buffer;
|
|
|
|
};
|
|
|
|
class gzifstream : public gzfilestream_common, public istream {
|
|
|
|
public:
|
|
|
|
gzifstream();
|
|
gzifstream( const char *name, int io_mode = ios::in );
|
|
gzifstream( int fd, int io_mode = ios::in );
|
|
|
|
virtual ~gzifstream();
|
|
|
|
};
|
|
|
|
class gzofstream : public gzfilestream_common, public ostream {
|
|
|
|
public:
|
|
|
|
gzofstream();
|
|
gzofstream( const char *name, int io_mode = ios::out );
|
|
gzofstream( int fd, int io_mode = ios::out );
|
|
|
|
virtual ~gzofstream();
|
|
|
|
};
|
|
|
|
template<class T> class gzomanip {
|
|
friend gzofstream &operator<<(gzofstream &, const gzomanip<T> &);
|
|
public:
|
|
gzomanip(gzofstream &(*f)(gzofstream &, T), T v) : func(f), val(v) { }
|
|
private:
|
|
gzofstream &(*func)(gzofstream &, T);
|
|
T val;
|
|
};
|
|
|
|
template<class T> gzofstream &operator<<(gzofstream &s, const gzomanip<T> &m)
|
|
{
|
|
return (*m.func)(s, m.val);
|
|
}
|
|
|
|
inline gzofstream &setcompressionlevel( gzofstream &s, int l )
|
|
{
|
|
(s.rdbuf())->setcompressionlevel(l);
|
|
return s;
|
|
}
|
|
|
|
inline gzofstream &setcompressionstrategy( gzofstream &s, int l )
|
|
{
|
|
(s.rdbuf())->setcompressionstrategy(l);
|
|
return s;
|
|
}
|
|
|
|
inline gzomanip<int> setcompressionlevel(int l)
|
|
{
|
|
return gzomanip<int>(&setcompressionlevel,l);
|
|
}
|
|
|
|
inline gzomanip<int> setcompressionstrategy(int l)
|
|
{
|
|
return gzomanip<int>(&setcompressionstrategy,l);
|
|
}
|
|
|
|
#endif
|