cuSBF
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
cusbf::detail::GzStreambuf Class Reference

std::streambuf over a gzip file (zlib gzread). More...

#include <gzstreambuf.hpp>

Inheritance diagram for cusbf::detail::GzStreambuf:
[legend]
Collaboration diagram for cusbf::detail::GzStreambuf:
[legend]

Public Member Functions

 GzStreambuf (const GzStreambuf &)=delete
 
GzStreambufoperator= (const GzStreambuf &)=delete
 
 GzStreambuf (GzStreambuf &&)=delete
 
GzStreambufoperator= (GzStreambuf &&)=delete
 
 ~GzStreambuf () override
 

Static Public Member Functions

static Result< std::unique_ptr< GzStreambuf > > open (const std::filesystem::path &path)
 Opens path for binary gzip read.
 

Protected Member Functions

int_type underflow () override
 

Detailed Description

std::streambuf over a gzip file (zlib gzread).

Definition at line 18 of file gzstreambuf.hpp.

Constructor & Destructor Documentation

◆ GzStreambuf() [1/2]

cusbf::detail::GzStreambuf::GzStreambuf ( const GzStreambuf )
delete

◆ GzStreambuf() [2/2]

cusbf::detail::GzStreambuf::GzStreambuf ( GzStreambuf &&  )
delete

◆ ~GzStreambuf()

cusbf::detail::GzStreambuf::~GzStreambuf ( )
inlineoverride

Definition at line 40 of file gzstreambuf.hpp.

40 {
41 if (file_) {
42 gzclose(file_);
43 }
44 }
consteval bool separatorPositionAlwaysEncodesInvalid(char *input, uint64_t separatorPosition, uint64_t index)
Recursively tests whether placing the separator byte at any position in an input of valid bytes alway...
Definition Alphabet.cuh:37
Here is the call graph for this function:

Member Function Documentation

◆ open()

static Result< std::unique_ptr< GzStreambuf > > cusbf::detail::GzStreambuf::open ( const std::filesystem::path &  path)
inlinestatic

Opens path for binary gzip read.

Parameters
pathFilesystem path to a .gz file.

Definition at line 30 of file gzstreambuf.hpp.

32 {
33 auto streambuf = std::unique_ptr<GzStreambuf>(new GzStreambuf(path));
34 if (!streambuf->file_) {
35 return Err(Error::io(std::format("Failed to open gzip file: {}", path.string())));
36 }
37 return streambuf;
38 }
GzStreambuf(const GzStreambuf &)=delete
cuda::std::unexpected< Error > Err(Error error)
Failure return; converts to any Result<T> via cuda::std::unexpected.
Definition error.hpp:219
static Error io(std::string message)
Definition error.hpp:119
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=() [1/2]

GzStreambuf & cusbf::detail::GzStreambuf::operator= ( const GzStreambuf )
delete

◆ operator=() [2/2]

GzStreambuf & cusbf::detail::GzStreambuf::operator= ( GzStreambuf &&  )
delete

◆ underflow()

int_type cusbf::detail::GzStreambuf::underflow ( )
inlineoverrideprotected

Definition at line 47 of file gzstreambuf.hpp.

47 {
48 if (gptr() < egptr()) {
49 return traits_type::to_int_type(*gptr());
50 }
51
52 auto bytesRead = gzread(file_, buffer_, kBufferSize);
53 if (bytesRead <= 0) {
54 return traits_type::eof();
55 }
56
57 setg(buffer_, buffer_, buffer_ + bytesRead);
58 return traits_type::to_int_type(*gptr());
59 }
Here is the call graph for this function:

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