RTC Toolkit  1.0.0
fitsConverterIf.hpp
Go to the documentation of this file.
1 
12 #ifndef RTCTK_STANDALONETOOLS_RAWRECORDER_FITSCONVERTERIF_HPP
13 #define RTCTK_STANDALONETOOLS_RAWRECORDER_FITSCONVERTERIF_HPP
14 
15 #include <vector>
16 #include <cstdint>
17 #include <gsl/span>
18 #include "packetFormats.hpp"
19 #include "CCfits/CCfits.h"
20 #include "CCfits/FITS.h"
21 
22 struct PacketData {
26  gsl::span<const uint8_t> payload;
27 };
28 
30  public:
36  FitsConverterIf(const std::string& directory, bool split_files);
37  virtual ~FitsConverterIf();
42  virtual void WriteData(const PacketData& data) = 0;
47  void SetStoreSampleIds(bool store) {m_store_sampleids = store;}
52  void SetStoreTimestamps(bool store) {m_store_timestamps = store;}
57  bool GetStoreSampleIds() {return m_store_sampleids;}
62  bool GetStoreTimestamps() {return m_store_timestamps;}
67  bool GetSplitFiles() {return m_split_files;}
68 
73  const std::string& GetDirectory() {return m_directory;}
74 
75 
76  protected:
77  const bool IsOpen() {return m_fits_handle != nullptr;}
78  void Open(const std::string& file);
79  void Close();
80  void SetFitsHandle(std::unique_ptr<CCfits::FITS>&& handle);
81  CCfits::FITS& GetFitsHandle();
82 
83  private:
84  std::unique_ptr<CCfits::FITS> m_fits_handle;
85  std::string m_directory;
86  bool m_split_files;
87  bool m_store_timestamps;
88  bool m_store_sampleids;
89 };
90 
91 #endif //RTCTK_STANDALONETOOLS_RAWRECORDER_FITSCONVERTERIF_HPP
PacketData::rtms_header
RtmsHeader rtms_header
Definition: fitsConverterIf.hpp:24
PacketData::payload
gsl::span< const uint8_t > payload
Definition: fitsConverterIf.hpp:26
FitsConverterIf::SetFitsHandle
void SetFitsHandle(std::unique_ptr< CCfits::FITS > &&handle)
Definition: fitsConverterIf.cpp:38
PacketData::pcap_timestamp
double pcap_timestamp
Definition: fitsConverterIf.hpp:25
FitsConverterIf::IsOpen
const bool IsOpen()
Definition: fitsConverterIf.hpp:77
packetFormats.hpp
lowlevel packet formats
PacketData::mudpi_header
MudpiHeader mudpi_header
Definition: fitsConverterIf.hpp:23
FitsConverterIf::Close
void Close()
Definition: fitsConverterIf.cpp:31
FitsConverterIf::~FitsConverterIf
virtual ~FitsConverterIf()
Definition: fitsConverterIf.cpp:47
FitsConverterIf::GetFitsHandle
CCfits::FITS & GetFitsHandle()
Definition: fitsConverterIf.cpp:42
FitsConverterIf::FitsConverterIf
FitsConverterIf(const std::string &directory, bool split_files)
Construct a FITS converter.
Definition: fitsConverterIf.cpp:16
FitsConverterIf::GetStoreSampleIds
bool GetStoreSampleIds()
Get current setting for storing sample ids as keywords.
Definition: fitsConverterIf.hpp:57
FitsConverterIf::WriteData
virtual void WriteData(const PacketData &data)=0
Write data into the FITS file(s)
FitsConverterIf::GetDirectory
const std::string & GetDirectory()
Get the setting for splitting files.
Definition: fitsConverterIf.hpp:73
PacketData
Definition: fitsConverterIf.hpp:22
FitsConverterIf::Open
void Open(const std::string &file)
Definition: fitsConverterIf.cpp:27
RtmsHeader
RTMS header.
Definition: packetFormats.hpp:129
FitsConverterIf::GetStoreTimestamps
bool GetStoreTimestamps()
Get current setting for storing timestamps as keywords.
Definition: fitsConverterIf.hpp:62
FitsConverterIf
Definition: fitsConverterIf.hpp:29
FitsConverterIf::GetSplitFiles
bool GetSplitFiles()
Get the setting for splitting files.
Definition: fitsConverterIf.hpp:67
FitsConverterIf::SetStoreSampleIds
void SetStoreSampleIds(bool store)
Enable or disable storage of sample ids as keywords.
Definition: fitsConverterIf.hpp:47
FitsConverterIf::SetStoreTimestamps
void SetStoreTimestamps(bool store)
Enable or disable storage of timestamps as keywords.
Definition: fitsConverterIf.hpp:52
MudpiHeader
Definition: packetFormats.hpp:18