#include <genesis/utils/io/base_input_source.hpp>
Inherited by FileInputSource, GzipInputSource, StreamInputSource, and StringInputSource.
Abstract base class for reading byte data from input sources.
It offers to read() a certain amount of bytes into a char buffer.
Definition at line 50 of file base_input_source.hpp.
◆ BaseInputSource() [1/3]
◆ BaseInputSource() [2/3]
◆ BaseInputSource() [3/3]
◆ ~BaseInputSource()
◆ is_trivial()
bool is_trivial |
( |
| ) |
const |
|
inline |
Return whether reading from this source is trivial, such as reading from a file, or involves more complex operations, such as reading from a compressed input that needs to be decompressed first.
This helps downstream processes to decide if reading can be done in a cheap async thread, or needs to use the global thread pool in order to not oversubscribe the system when many such inputs (e.g., many gzipped files) are read in parallel. A thread that is just reading a block of data from a file is not using computation, and will spend its time in I/O wait, so it's okay to have many of those. However, compressed files need computation, and are hence not trivial.
Definition at line 116 of file base_input_source.hpp.
◆ operator=() [1/2]
◆ operator=() [2/2]
◆ read()
size_t read |
( |
char * |
buffer, |
|
|
size_t |
size |
|
) |
| |
|
inline |
Read size
many bytes into the char buffer
.
Returns the number of bytes that have actually been read, which might be lower than the initial target size
, e.g., if the end of the input source was reached.
Definition at line 79 of file base_input_source.hpp.
◆ source_name()
std::string source_name |
( |
| ) |
const |
|
inline |
Get a name of the input source. This is intended for user output.
Definition at line 88 of file base_input_source.hpp.
◆ source_string()
std::string source_string |
( |
| ) |
const |
|
inline |
Get a string representing the input source. This is intended for the reader classes, which for example might want to examine the input file name.
Definition at line 98 of file base_input_source.hpp.
The documentation for this class was generated from the following file: