Alexandria 2.31.0
SDC-CH common library for the Euclid project
Loading...
Searching...
No Matches
AsciiWriter.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
25#ifndef _TABLE_ASCIIWRITER_H
26#define _TABLE_ASCIIWRITER_H
27
29#include "Table/TableWriter.h"
30
31namespace Euclid {
32namespace Table {
33
80class AsciiWriter : public TableWriter {
81
82public:
108 template <typename StreamType, typename... Args>
109 static AsciiWriter create(Args&&... args);
110
112 explicit AsciiWriter(std::ostream& stream);
113
116 explicit AsciiWriter(const std::string& filename);
117
120
121 AsciiWriter(const AsciiWriter&) = delete;
123
127 virtual ~AsciiWriter() = default;
128
143
153 AsciiWriter& showColumnInfo(bool show);
154
166 void addComment(const std::string& message) override;
167
168protected:
171 void init(const Table& table) override;
172
175 void append(const Table& table) override;
176
177private:
179
181 bool m_writing_started = false;
182 bool m_initialized = false;
186
187}; // End of AsciiWriter class
188
189} // namespace Table
190} // namespace Euclid
191
193
194#endif
TableWriter implementation for writing ASCII tables to streams.
Definition AsciiWriter.h:80
AsciiWriter(const AsciiWriter &)=delete
std::unique_ptr< InstOrRefHolder< std::ostream > > m_stream_holder
static AsciiWriter create(Args &&... args)
Constructs an AsciiWriter which contains an object of type StreamType.
AsciiWriter & operator=(const AsciiWriter &)=delete
void append(const Table &table) override
std::vector< size_t > m_column_lengths
void init(const Table &table) override
virtual ~AsciiWriter()=default
Destructor.
AsciiWriter & showColumnInfo(bool show)
Sets if the column information will be written to the stream.
AsciiWriter & operator=(AsciiWriter &&)=default
void addComment(const std::string &message) override
Adds a comment to the stream.
AsciiWriter & setCommentIndicator(const std::string &indicator)
Set the comment indicator.
AsciiWriter(AsciiWriter &&)=default
Interface for classes writing tables.
Definition TableWriter.h:49
Represents a table.
Definition Table.h:49