Alexandria  2.14.1
Please provide a description of the project.
FitsWriter.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2020 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_FITSWRITER_H
26 #define _TABLE_FITSWRITER_H
27 
28 #include <CCfits/FITS.h>
29 #include "Table/TableWriter.h"
30 
31 namespace Euclid {
32 namespace Table {
33 
76 class FitsWriter : public TableWriter {
77 
78 public:
79 
81  enum class Format {
83  ASCII,
85  BINARY
86  };
87 
108  FitsWriter(const std::string& filename, bool override_flag=false);
109 
128 
129  FitsWriter(FitsWriter&&) = default;
130  FitsWriter& operator=(FitsWriter&&) = default;
131 
132  FitsWriter(const FitsWriter&) = delete;
133  FitsWriter& operator=(const FitsWriter&) = delete;
134 
138  virtual ~FitsWriter() = default;
139 
152  FitsWriter& setFormat(Format format);
153 
167  FitsWriter& setHduName(const std::string& name);
168 
181  void addComment(const std::string& message) override;
182 
183 protected:
184 
187  void init(const Table& table) override;
188 
191  void append(const Table& table) override;
192 
193 private:
194 
197  bool m_initialized = false;
198  bool m_override_file = true;
202  int m_hdu_index = -1;
203  long m_current_line = 0;
204 
205 }; /* End of FitsWriter class */
206 
207 } /* namespace Table */
208 } /* namespace Euclid */
209 
210 
211 #endif
Euclid::Table::FitsWriter::setFormat
FitsWriter & setFormat(Format format)
Set the FITS table format.
Definition: FitsWriter.cpp:41
std::string
STL class.
std::shared_ptr< CCfits::FITS >
Euclid::Table::FitsWriter::m_fits
std::shared_ptr< CCfits::FITS > m_fits
Definition: FitsWriter.h:196
Euclid::Table::FitsWriter::m_filename
std::string m_filename
Definition: FitsWriter.h:195
std::vector< std::string >
Euclid::Table::FitsWriter::FitsWriter
FitsWriter(const std::string &filename, bool override_flag=false)
Creates a FitsWriter that writes to a specific file.
Definition: FitsWriter.cpp:34
Euclid::Table::FitsWriter::m_override_file
bool m_override_file
Definition: FitsWriter.h:198
Euclid::Table::FitsWriter::m_hdu_index
int m_hdu_index
Definition: FitsWriter.h:202
Euclid::Table::FitsWriter::m_hdu_name
std::string m_hdu_name
Definition: FitsWriter.h:200
Euclid::Table::FitsWriter::init
void init(const Table &table) override
Definition: FitsWriter.cpp:67
Euclid::Table::FitsWriter::m_comments
std::vector< std::string > m_comments
Definition: FitsWriter.h:201
Euclid::Table::FitsWriter::m_current_line
long m_current_line
Definition: FitsWriter.h:203
Euclid::Table::FitsWriter::setHduName
FitsWriter & setHduName(const std::string &name)
Set the HDU name where the table is written.
Definition: FitsWriter.cpp:50
Euclid::Table::FitsWriter::m_format
Format m_format
Definition: FitsWriter.h:199
Euclid::Table::FitsWriter::addComment
void addComment(const std::string &message) override
Adds a comment to the stream.
Definition: FitsWriter.cpp:59
Euclid::Table::FitsWriter
TableWriter implementation for writing tables in FITS format.
Definition: FitsWriter.h:76
Euclid::Table::FitsWriter::Format
Format
The format of the HDUs a FitsWriter creates.
Definition: FitsWriter.h:81
TableWriter.h
Euclid::Table::FitsWriter::operator=
FitsWriter & operator=(FitsWriter &&)=default
Euclid::Table::TableWriter
Interface for classes writing tables.
Definition: TableWriter.h:49
Euclid::Table::FitsWriter::~FitsWriter
virtual ~FitsWriter()=default
Destructor.
Euclid::Table::FitsWriter::m_initialized
bool m_initialized
Definition: FitsWriter.h:197
Euclid::Table::FitsWriter::Format::BINARY
@ BINARY
FITS binary table HDU format.
Euclid::Table::Table
Represents a table.
Definition: Table.h:49
Euclid::Table::FitsWriter::Format::ASCII
@ ASCII
FITS ASCII table HDU format.
Euclid::Table::FitsWriter::append
void append(const Table &table) override
Definition: FitsWriter.cpp:121
Euclid
Definition: InstOrRefHolder.h:29