eminem
Parse Matrix Market files in C++
Loading...
Searching...
No Matches
from_text.hpp
Go to the documentation of this file.
1#ifndef EMINEM_FROM_TEXT_HPP
2#define EMINEM_FROM_TEXT_HPP
3
4#include <memory>
5#include <cstddef>
6
7#include "Parser.hpp"
8#include "byteme/PerByte.hpp"
11
17namespace eminem {
18
26 std::size_t buffer_size = 65536;
27
31 int num_threads = 1;
32
37 std::size_t block_size = 65536;
38};
39
46 ParserOptions popt;
47 popt.num_threads = options.num_threads;
48 popt.block_size = options.block_size;
49
51 topt.buffer_size = options.buffer_size;
52 auto reader = std::make_unique<byteme::RawFileReader>(path, topt);
53 auto pb = std::make_unique<byteme::PerByteSerial<char> >(std::move(reader));
54 return Parser<byteme::PerByteSerial<char> >(std::move(pb), popt);
55}
56
64 int num_threads = 1;
65
70 std::size_t block_size = 65536;
71};
72
79inline Parser<byteme::PerByteSerial<char> > parse_text_buffer(const unsigned char* buffer, std::size_t len, const ParseTextBufferOptions& options) {
80 ParserOptions popt;
81 popt.num_threads = options.num_threads;
82 popt.block_size = options.block_size;
83
84 auto reader = std::make_unique<byteme::RawBufferReader>(buffer, len);
85 auto pb = std::make_unique<byteme::PerByteSerial<char> >(std::move(reader));
86 return Parser<byteme::PerByteSerial<char> >(std::move(pb), popt);
87}
88
89}
90
91#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_text_buffer(const unsigned char *buffer, std::size_t len, const ParseTextBufferOptions &options)
Definition from_text.hpp:79
Parser< byteme::PerByteSerial< char > > parse_text_file(const char *path, const ParseTextFileOptions &options)
Definition from_text.hpp:45
Options for parse_text_buffer().
Definition from_text.hpp:60
int num_threads
Definition from_text.hpp:64
std::size_t block_size
Definition from_text.hpp:70
Options for parse_text_file().
Definition from_text.hpp:22
std::size_t block_size
Definition from_text.hpp:37
int num_threads
Definition from_text.hpp:31
std::size_t buffer_size
Definition from_text.hpp:26
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