Alexandria 2.31.0
SDC-CH common library for the Euclid project
|
Interface for classes reading tables. More...
#include <TableReader.h>
Public Member Functions | |
TableReader ()=default | |
TableReader (TableReader &&)=default | |
TableReader & | operator= (TableReader &&)=default |
TableReader (const TableReader &)=delete | |
TableReader & | operator= (const TableReader &)=delete |
virtual | ~TableReader ()=default |
virtual std::string | getComment ()=0 |
virtual const ColumnInfo & | getInfo ()=0 |
Returns the column information of the table. | |
Table | read (long rows=-1) |
Reads next rows as a table. | |
virtual void | skip (long rows)=0 |
Skips next rows. | |
virtual bool | hasMoreRows ()=0 |
Checks if there are any rows left to read. | |
virtual std::size_t | rowsLeft ()=0 |
Returns the number of rows left to read. | |
Protected Member Functions | |
virtual Table | readImpl (long rows)=0 |
Method to be implemented by subclasses for reading the table. | |
Interface for classes reading tables.
Each TableReader implementation should behave like a stream to a table. It must implement the methods getComment(), getInfo(), readImpl(), skip() and hasMoreRows(). See the documentation of these methods for more information of how to implement them.
Note that all TableReader implementations, as they are representing streams to a single table, should not be able to be copied, something that is forced by the TableReader interface. There is no such restriction for move operations.
Definition at line 48 of file TableReader.h.
|
default |
|
default |
|
delete |
|
virtualdefault |
|
pure virtual |
Implemented in Euclid::Table::AsciiReader, and Euclid::Table::FitsReader.
|
pure virtual |
Returns the column information of the table.
The different implementations should try to implement this method in such way so the full parsing of the table is not necessary and multiple calls of this method do not trigger the reading again.
Implemented in Euclid::Table::AsciiReader, and Euclid::Table::FitsReader.
|
pure virtual |
Checks if there are any rows left to read.
Implementations should implement this method to return true if there are still rows not read using the read() method and false otherwise. If the result of this method is true, a call to read() should successfully return a table object, If the result of this method is false, a call th read() will throw an Elements::Exception.
Implemented in Euclid::Table::AsciiReader, and Euclid::Table::FitsReader.
|
delete |
|
default |
|
inline |
Reads next rows as a table.
If the given parameter is a number bigger than the rows left, the result is a table with all of them (and size less than the parameter). If the parameter is a negative number, the returned Table object contains all the remaining rows. If the all the rows of the table have already been read, an exception is thrown.
rows | The number of rows to read |
Elements::Exception | If the reader has already read all the available rows |
Definition at line 91 of file TableReader.h.
References readImpl().
Referenced by Euclid::XYDataset::FitsParser::getDataset().
|
protectedpure virtual |
Method to be implemented by subclasses for reading the table.
Implementations should implement this method to behave as described at the documentation of the read() method.
rows | The number of rows to read |
Elements::Exception | If the reader has already read all the available rows |
Implemented in Euclid::Table::AsciiReader, and Euclid::Table::FitsReader.
Referenced by read().
|
pure virtual |
Returns the number of rows left to read.
When using this method keep in mind that some formats (like ASCII) might require to parse the full file.
Implemented in Euclid::Table::AsciiReader, and Euclid::Table::FitsReader.
|
pure virtual |
Skips next rows.
Implementations should implement this method so the next read() call will ignore that many rows as the given parameter. If the given number is greater or equal to the number of rows left, a consequent call of read() should throw an exception and a call to hasMoreRows() should return false.
rows | The number of rows to skip |
Implemented in Euclid::Table::AsciiReader, and Euclid::Table::FitsReader.