Alexandria  2.19
Please provide a description of the project.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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 
29 namespace Euclid {
30 namespace Table {
31 
48 class TableReader {
49 
50 public:
51  TableReader() = default;
52 
53  TableReader(TableReader&&) = default;
54  TableReader& operator=(TableReader&&) = default;
55 
56  TableReader(const TableReader&) = delete;
57  TableReader& operator=(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 
130 protected:
143  virtual Table readImpl(long rows) = 0;
144 };
145 
146 } // namespace Table
147 } // namespace Euclid
148 
149 #endif /* _TABLE_TABLEREADER_H */
Interface for classes reading tables.
Definition: TableReader.h:48
virtual std::size_t rowsLeft()=0
Returns the number of rows left to read.
virtual const ColumnInfo & getInfo()=0
Returns the column information of the table.
virtual void skip(long rows)=0
Skips next rows.
STL class.
TableReader & operator=(TableReader &&)=default
virtual bool hasMoreRows()=0
Checks if there are any rows left to read.
Represents a table.
Definition: Table.h:49
Provides information about the columns of a Table.
Definition: ColumnInfo.h:52
Table read(long rows=-1)
Reads next rows as a table.
Definition: TableReader.h:91
virtual Table readImpl(long rows)=0
Method to be implemented by subclasses for reading the table.
virtual ~TableReader()=default
virtual std::string getComment()=0