Alexandria  2.14.1
Please provide a description of the project.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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
FitsWriter & setFormat(Format format)
Set the FITS table format.
Definition: FitsWriter.cpp:41
FITS binary table HDU format.
FitsWriter(const std::string &filename, bool override_flag=false)
Creates a FitsWriter that writes to a specific file.
Definition: FitsWriter.cpp:34
std::shared_ptr< CCfits::FITS > m_fits
Definition: FitsWriter.h:196
FITS ASCII table HDU format.
TableWriter implementation for writing tables in FITS format.
Definition: FitsWriter.h:76
STL class.
void init(const Table &table) override
Definition: FitsWriter.cpp:67
Format
The format of the HDUs a FitsWriter creates.
Definition: FitsWriter.h:81
std::vector< std::string > m_comments
Definition: FitsWriter.h:201
FitsWriter & setHduName(const std::string &name)
Set the HDU name where the table is written.
Definition: FitsWriter.cpp:50
void addComment(const std::string &message) override
Adds a comment to the stream.
Definition: FitsWriter.cpp:59
Represents a table.
Definition: Table.h:49
FitsWriter & operator=(FitsWriter &&)=default
void append(const Table &table) override
Definition: FitsWriter.cpp:121
Interface for classes writing tables.
Definition: TableWriter.h:49
virtual ~FitsWriter()=default
Destructor.