Alexandria  2.19
Please provide a description of the project.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FitsWriter.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_FITSWRITER_H
26 #define _TABLE_FITSWRITER_H
27 
28 #include "Table/TableWriter.h"
29 #include <CCfits/FITS.h>
30 
31 namespace Euclid {
32 namespace Table {
33 
76 class FitsWriter : public TableWriter {
77 
78 public:
80  enum class Format {
82  ASCII,
84  BINARY
85  };
86 
107  explicit FitsWriter(const std::string& filename, bool override_flag = false);
108 
127 
128  FitsWriter(FitsWriter&&) = default;
129  FitsWriter& operator=(FitsWriter&&) = default;
130 
131  FitsWriter(const FitsWriter&) = delete;
132  FitsWriter& operator=(const FitsWriter&) = delete;
133 
137  virtual ~FitsWriter() = default;
138 
151  FitsWriter& setFormat(Format format);
152 
166  FitsWriter& setHduName(const std::string& name);
167 
180  void addComment(const std::string& message) override;
181 
182 protected:
185  void init(const Table& table) override;
186 
189  void append(const Table& table) override;
190 
191 private:
194  bool m_initialized = false;
195  bool m_override_file = true;
199  int m_hdu_index = -1;
200  long m_current_line = 0;
201 
202 }; /* End of FitsWriter class */
203 
204 } /* namespace Table */
205 } /* namespace Euclid */
206 
207 #endif
FitsWriter & setFormat(Format format)
Set the FITS table format.
Definition: FitsWriter.cpp:37
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:33
std::shared_ptr< CCfits::FITS > m_fits
Definition: FitsWriter.h:193
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:63
Format
The format of the HDUs a FitsWriter creates.
Definition: FitsWriter.h:80
std::vector< std::string > m_comments
Definition: FitsWriter.h:198
FitsWriter & setHduName(const std::string &name)
Set the HDU name where the table is written.
Definition: FitsWriter.cpp:46
void addComment(const std::string &message) override
Adds a comment to the stream.
Definition: FitsWriter.cpp:55
Represents a table.
Definition: Table.h:49
FitsWriter & operator=(FitsWriter &&)=default
void append(const Table &table) override
Definition: FitsWriter.cpp:118
Interface for classes writing tables.
Definition: TableWriter.h:49
virtual ~FitsWriter()=default
Destructor.