eminem
Parse Matrix Market files in C++
Loading...
Searching...
No Matches
from_gzip.hpp
Go to the documentation of this file.
1#ifndef EMINEM_FROM_GZIP_HPP
2#define EMINEM_FROM_GZIP_HPP
3
4#include <memory>
5#include <cstddef>
6
7#include "Parser.hpp"
8#include "byteme/PerByte.hpp"
13
19namespace eminem {
20
28 std::size_t buffer_size = 65536;
29
33 int num_threads = 1;
34
39 std::size_t block_size = 65536;
40};
41
48 ParserOptions popt;
49 popt.num_threads = options.num_threads;
50 popt.block_size = options.block_size;
51
53 gopt.buffer_size = options.buffer_size;
54 auto reader = std::make_unique<byteme::GzipFileReader>(path, gopt);
55 auto pb = std::make_unique<byteme::PerByteSerial<char> >(std::move(reader));
56 return Parser<byteme::PerByteSerial<char> >(std::move(pb), popt);
57}
58
66 std::size_t buffer_size = 65536;
67
71 int num_threads = 1;
72
77 std::size_t block_size = 65536;
78
83 int mode = 3;
84};
85
92inline Parser<byteme::PerByteSerial<char> > parse_zlib_buffer(const unsigned char* buffer, std::size_t len, const ParseZlibBufferOptions& options) {
93 ParserOptions popt;
94 popt.num_threads = options.num_threads;
95 popt.block_size = options.block_size;
96
98 zopt.buffer_size = options.buffer_size;
99 zopt.mode = options.mode;
100 auto reader = std::make_unique<byteme::ZlibBufferReader>(buffer, len, zopt);
101 auto pb = std::make_unique<byteme::PerByteSerial<char> >(std::move(reader));
102 return Parser<byteme::PerByteSerial<char> >(std::move(pb), popt);
103}
104
112 std::size_t buffer_size = 65536;
113
117 int num_threads = 1;
118
123 std::size_t block_size = 65536;
124};
125
132 ParserOptions popt;
133 popt.num_threads = options.num_threads;
134 popt.block_size = options.block_size;
135
137 sopt.buffer_size = options.buffer_size;
138 auto reader = std::make_unique<byteme::SomeFileReader>(path, sopt);
139 auto pb = std::make_unique<byteme::PerByteSerial<char> >(std::move(reader));
140
141 return Parser<byteme::PerByteSerial<char> >(std::move(pb), popt);
142}
143
151 std::size_t buffer_size = 65536;
152
156 int num_threads = 1;
157
162 std::size_t block_size = 65536;
163};
164
171inline Parser<byteme::PerByteSerial<char> > parse_some_buffer(const unsigned char* buffer, std::size_t len, const ParseSomeBufferOptions& options) {
172 ParserOptions popt;
173 popt.num_threads = options.num_threads;
174 popt.block_size = options.block_size;
175
177 sopt.buffer_size = options.buffer_size;
178 auto reader = std::make_unique<byteme::SomeBufferReader>(buffer, len, sopt);
179 auto pb = std::make_unique<byteme::PerByteSerial<char> >(std::move(reader));
180 return Parser<byteme::PerByteSerial<char> >(std::move(pb), popt);
181}
182
183}
184
185#endif
Parse a matrix from a Matrix Market file.
Parse a matrix from a Matrix Market file.
Definition Parser.hpp:234
Classes and methods for parsing Matrix Market files.
Parser< byteme::PerByteSerial< char > > parse_some_buffer(const unsigned char *buffer, std::size_t len, const ParseSomeBufferOptions &options)
Definition from_gzip.hpp:171
Parser< byteme::PerByteSerial< char > > parse_gzip_file(const char *path, const ParseGzipFileOptions &options)
Definition from_gzip.hpp:47
Parser< byteme::PerByteSerial< char > > parse_zlib_buffer(const unsigned char *buffer, std::size_t len, const ParseZlibBufferOptions &options)
Definition from_gzip.hpp:92
Parser< byteme::PerByteSerial< char > > parse_some_file(const char *path, const ParseSomeFileOptions &options)
Definition from_gzip.hpp:131
Options for parse_gzip_file().
Definition from_gzip.hpp:24
std::size_t block_size
Definition from_gzip.hpp:39
std::size_t buffer_size
Definition from_gzip.hpp:28
int num_threads
Definition from_gzip.hpp:33
Options for parse_some_buffer().
Definition from_gzip.hpp:147
std::size_t block_size
Definition from_gzip.hpp:162
std::size_t buffer_size
Definition from_gzip.hpp:151
int num_threads
Definition from_gzip.hpp:156
Options for parse_some_file().
Definition from_gzip.hpp:108
std::size_t block_size
Definition from_gzip.hpp:123
int num_threads
Definition from_gzip.hpp:117
std::size_t buffer_size
Definition from_gzip.hpp:112
Options for parse_zlib_buffer().
Definition from_gzip.hpp:62
std::size_t buffer_size
Definition from_gzip.hpp:66
int mode
Definition from_gzip.hpp:83
int num_threads
Definition from_gzip.hpp:71
std::size_t block_size
Definition from_gzip.hpp:77
Options for the Parser constructor.
Definition Parser.hpp:36
std::size_t block_size
Definition Parser.hpp:47
int num_threads
Definition Parser.hpp:40