ifw-daq  3.0.0-pre2
IFW Data Acquisition modules
dpPart.hpp
Go to the documentation of this file.
1 /**
2  * @file
3  * @ingroup daq_common_libdaq
4  * @copyright 2022 ESO - European Southern Observatory
5  *
6  * @brief Contains declaration for DpPart
7  */
8 #ifndef OCM_DAQ_DP_PART_HPP_
9 #define OCM_DAQ_DP_PART_HPP_
10 
11 #include <iosfwd>
12 #include <string>
13 #include <variant>
14 #include <vector>
15 
16 #include <daq/fits/keyword.hpp>
17 
18 namespace daq {
19 
20 /**
21  * Provides information of the location and source of a FITS file or keywords produced by a data
22  * acquisition.
23  *
24  * @ingroup daq_common_libdaq
25  */
26 class DpPart {
27 public:
28  DpPart(std::string source_name, std::string path) noexcept;
29  DpPart(std::string source_name, fits::KeywordVector keywords) noexcept;
30  DpPart() = default;
31  DpPart(DpPart const&) = default;
32  DpPart(DpPart&&) noexcept = default;
33  DpPart& operator=(DpPart const&) = default;
34  DpPart& operator=(DpPart&&) noexcept = default;
35 
36  bool operator==(DpPart const& rhs) const noexcept;
37  bool operator!=(DpPart const& rhs) const noexcept;
38 
39  using PartTypes = std::variant<std::string, fits::KeywordVector>;
40 
41  /**
42  * Source name of the part
43  */
44  auto SourceName() const noexcept -> std::string const& {
45  return m_source_name;
46  }
47  auto SourceName() noexcept -> std::string & {
48  return m_source_name;
49  }
50 
51  /**
52  * Holds a std::string path `[[user]@host:]path` or FITS keywords.
53  */
54  auto Part() const noexcept -> PartTypes const& {
55  return m_part;
56  }
57  auto Part() noexcept -> PartTypes& {
58  return m_part;
59  }
60 
61 private:
62  std::string m_source_name;
63  PartTypes m_part;
64 };
65 
66 using DpParts = std::vector<DpPart>;
67 
68 std::ostream& operator<<(std::ostream& os, DpPart const& part) noexcept;
69 
70 } // namespace daq
71 
72 #endif // #define OCM_DAQ_DP_PART_HPP_
Provides information of the location and source of a FITS file or keywords produced by a data acquisi...
Definition: dpPart.hpp:26
std::variant< std::string, fits::KeywordVector > PartTypes
Definition: dpPart.hpp:39
DpPart(DpPart &&) noexcept=default
DpPart()=default
DpPart(DpPart const &)=default
auto Part() const noexcept -> PartTypes const &
Holds a std::string path [[user]@host:]path or FITS keywords.
Definition: dpPart.hpp:54
auto SourceName() const noexcept -> std::string const &
Source name of the part.
Definition: dpPart.hpp:44
auto Part() noexcept -> PartTypes &
Definition: dpPart.hpp:57
auto SourceName() noexcept -> std::string &
Definition: dpPart.hpp:47
Contains data structure for FITS keywords.
std::vector< KeywordVariant > KeywordVector
Vector of keywords.
Definition: keyword.hpp:414
daqif::DaqStatus & operator<<(daqif::DaqStatus &status, daq::Status const &rhs)
Convert daq::Status -> daqif::DaqStatus by populating from rhs.
Definition: conversion.cpp:18
std::vector< DpPart > DpParts
Definition: dpPart.hpp:66