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
50template<typename Index_ = unsigned long long>
52 ParserOptions popt;
53 popt.num_threads = options.num_threads;
54 popt.block_size = options.block_size;
55
57 gopt.buffer_size = options.buffer_size;
58 auto reader = std::make_unique<byteme::GzipFileReader>(path, gopt);
59 auto pb = std::make_unique<byteme::PerByteSerial<char> >(std::move(reader));
60 return Parser<std::unique_ptr<byteme::PerByteSerial<char> >, Index_>(std::move(pb), popt);
61}
62
70 std::size_t buffer_size = 65536;
71
75 int num_threads = 1;
76
81 std::size_t block_size = 65536;
82
87 int mode = 3;
88};
89
99template<typename Index_ = unsigned long long>
100Parser<std::unique_ptr<byteme::PerByteSerial<char> >, Index_> parse_zlib_buffer(const unsigned char* buffer, std::size_t len, const ParseZlibBufferOptions& options) {
101 ParserOptions popt;
102 popt.num_threads = options.num_threads;
103 popt.block_size = options.block_size;
104
106 zopt.buffer_size = options.buffer_size;
107 zopt.mode = options.mode;
108 auto reader = std::make_unique<byteme::ZlibBufferReader>(buffer, len, zopt);
109 auto pb = std::make_unique<byteme::PerByteSerial<char> >(std::move(reader));
110 return Parser<std::unique_ptr<byteme::PerByteSerial<char> >, Index_>(std::move(pb), popt);
111}
112
120 std::size_t buffer_size = 65536;
121
125 int num_threads = 1;
126
131 std::size_t block_size = 65536;
132};
133
142template<typename Index_ = unsigned long long>
144 ParserOptions popt;
145 popt.num_threads = options.num_threads;
146 popt.block_size = options.block_size;
147
149 sopt.buffer_size = options.buffer_size;
150 auto reader = std::make_unique<byteme::SomeFileReader>(path, sopt);
151 auto pb = std::make_unique<byteme::PerByteSerial<char> >(std::move(reader));
152
153 return Parser<std::unique_ptr<byteme::PerByteSerial<char> >, Index_>(std::move(pb), popt);
154}
155
163 std::size_t buffer_size = 65536;
164
168 int num_threads = 1;
169
174 std::size_t block_size = 65536;
175};
176
186template<typename Index_ = unsigned long long>
187Parser<std::unique_ptr<byteme::PerByteSerial<char> >, Index_> parse_some_buffer(const unsigned char* buffer, std::size_t len, const ParseSomeBufferOptions& options) {
188 ParserOptions popt;
189 popt.num_threads = options.num_threads;
190 popt.block_size = options.block_size;
191
193 sopt.buffer_size = options.buffer_size;
194 auto reader = std::make_unique<byteme::SomeBufferReader>(buffer, len, sopt);
195 auto pb = std::make_unique<byteme::PerByteSerial<char> >(std::move(reader));
196 return Parser<std::unique_ptr<byteme::PerByteSerial<char> >, Index_>(std::move(pb), popt);
197}
198
199}
200
201#endif
Parse a matrix from a Matrix Market file.
Parse a matrix from a Matrix Market file.
Definition Parser.hpp:275
Classes and methods for parsing Matrix Market files.
Parser< std::unique_ptr< byteme::PerByteSerial< char > >, Index_ > parse_zlib_buffer(const unsigned char *buffer, std::size_t len, const ParseZlibBufferOptions &options)
Definition from_gzip.hpp:100
Parser< std::unique_ptr< byteme::PerByteSerial< char > >, Index_ > parse_some_file(const char *path, const ParseSomeFileOptions &options)
Definition from_gzip.hpp:143
Parser< std::unique_ptr< byteme::PerByteSerial< char > >, Index_ > parse_some_buffer(const unsigned char *buffer, std::size_t len, const ParseSomeBufferOptions &options)
Definition from_gzip.hpp:187
Parser< std::unique_ptr< byteme::PerByteSerial< char > >, Index_ > parse_gzip_file(const char *path, const ParseGzipFileOptions &options)
Definition from_gzip.hpp:51
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:159
std::size_t block_size
Definition from_gzip.hpp:174
std::size_t buffer_size
Definition from_gzip.hpp:163
int num_threads
Definition from_gzip.hpp:168
Options for parse_some_file().
Definition from_gzip.hpp:116
std::size_t block_size
Definition from_gzip.hpp:131
int num_threads
Definition from_gzip.hpp:125
std::size_t buffer_size
Definition from_gzip.hpp:120
Options for parse_zlib_buffer().
Definition from_gzip.hpp:66
std::size_t buffer_size
Definition from_gzip.hpp:70
int mode
Definition from_gzip.hpp:87
int num_threads
Definition from_gzip.hpp:75
std::size_t block_size
Definition from_gzip.hpp:81
Options for the Parser constructor.
Definition Parser.hpp:32
std::size_t block_size
Definition Parser.hpp:43
int num_threads
Definition Parser.hpp:36