Alexandria 2.31.0
SDC-CH common library for the Euclid project
Loading...
Searching...
No Matches
TableReader.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2012-2021 Euclid Science Ground Segment
3 *
4 * This library is free software; you can redistribute it and/or modify it under
5 * the terms of the GNU Lesser General Public License as published by the Free
6 * Software Foundation; either version 3.0 of the License, or (at your option)
7 * any later version.
8 *
9 * This library is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12 * details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this library; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19/*
20 * @file TableReader.h
21 * @author nikoapos
22 */
23
24#ifndef _TABLE_TABLEREADER_H
25#define _TABLE_TABLEREADER_H
26
27#include "Table/Table.h"
28
29namespace Euclid {
30namespace Table {
31
49
50public:
51 TableReader() = default;
52
55
56 TableReader(const TableReader&) = delete;
58
59 virtual ~TableReader() = default;
60
64 virtual std::string getComment() = 0;
65
74 virtual const ColumnInfo& getInfo() = 0;
75
91 Table read(long rows = -1) {
92 return readImpl(rows);
93 }
94
105 virtual void skip(long rows) = 0;
106
118 virtual bool hasMoreRows() = 0;
119
128 virtual std::size_t rowsLeft() = 0;
129
130protected:
143 virtual Table readImpl(long rows) = 0;
144};
145
146} // namespace Table
147} // namespace Euclid
148
149#endif /* _TABLE_TABLEREADER_H */
Provides information about the columns of a Table.
Definition ColumnInfo.h:52
Interface for classes reading tables.
Definition TableReader.h:48
virtual bool hasMoreRows()=0
Checks if there are any rows left to read.
virtual std::string getComment()=0
TableReader & operator=(const TableReader &)=delete
virtual const ColumnInfo & getInfo()=0
Returns the column information of the table.
virtual void skip(long rows)=0
Skips next rows.
TableReader & operator=(TableReader &&)=default
virtual Table readImpl(long rows)=0
Method to be implemented by subclasses for reading the table.
Table read(long rows=-1)
Reads next rows as a table.
Definition TableReader.h:91
virtual std::size_t rowsLeft()=0
Returns the number of rows left to read.
TableReader(const TableReader &)=delete
virtual ~TableReader()=default
TableReader(TableReader &&)=default
Represents a table.
Definition Table.h:49