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/byteme.hpp"
9
15namespace eminem {
16
20// For back-compatibility.
21// If people want to parametrize the Reader construction, they should just directly create the Parser themselves.
22typedef ParserOptions ParseTextFileOptions;
23typedef ParserOptions ParseTextBufferOptions;
39template<typename Index_ = unsigned long long>
40auto parse_text_file(const char* path, const ParserOptions& options) {
41 auto reader = std::make_unique<byteme::RawFileReader>(path, byteme::RawFileReaderOptions());
42 return Parser<decltype(reader), Index_>(std::move(reader), options);
43}
44
57template<typename Index_ = unsigned long long>
58auto parse_text_buffer(const unsigned char* buffer, std::size_t len, const ParserOptions& options) {
59 auto reader = std::make_unique<byteme::RawBufferReader>(buffer, len);
60 return Parser<decltype(reader), Index_>(std::move(reader), options);
61}
62
63}
64
65#endif
Parse a matrix from a Matrix Market file.
Parse a matrix from a Matrix Market file.
Definition Parser.hpp:304
Classes and methods for parsing Matrix Market files.
auto parse_text_buffer(const unsigned char *buffer, std::size_t len, const ParserOptions &options)
Definition from_text.hpp:58
auto parse_text_file(const char *path, const ParserOptions &options)
Definition from_text.hpp:40
Options for the Parser constructor.
Definition Parser.hpp:32