Loading...
Searching...
No Matches
io_utilities.h
Go to the documentation of this file.
CsvReader(Config c)
Constructs a reader with the given configuration.
Definition io_utilities.h:122
Result read(const filesystem::path &path) const
Reads and parses the CSV file at the given path.
Result read_string(string_view csv_text) const
Parses a CSV string already held in memory.
void read_at(void *buffer, size_t bytes, uint64_t offset) const
Reads bytes from a specific offset into the provided buffer (thread-safe).
FileReader(const FileReader &)=delete
void open(const filesystem::path &path)
Opens the file at the given path for reading.
uint64_t file_size() const
Returns the total size of the open file in bytes.
FileReader & operator=(FileReader &&)=delete
~FileReader()
FileReader(FileReader &&)=delete
FileReader & operator=(const FileReader &)=delete
FileReader()=default
FileWriter(FileWriter &&)=delete
FileWriter & operator=(const FileWriter &)=delete
void write(const void *buffer, size_t bytes)
Appends the given byte range to the open file.
FileWriter & operator=(FileWriter &&)=delete
FileWriter()=default
void open(const filesystem::path &tmp_path)
Opens a temporary file to which subsequent write() calls are appended.
FileWriter(const FileWriter &)=delete
~FileWriter()
void finish_with_rename(const filesystem::path &final_path)
Closes the stream and atomically renames the tmp file to final_path.
Definition adaptive_moment_estimation.h:14
void atomic_rename(const filesystem::path &from, const filesystem::path &to)
Atomically renames a file, replacing the destination if needed.
Reader configuration: field separator and an optional per-line validator.
Definition io_utilities.h:109
function< void(string_view)> line_validator
Definition io_utilities.h:111
Parsed CSV result; owns the source buffer that backs all row views.
Definition io_utilities.h:116