ifw-daq  1.0.0
IFW Data Acquisition modules
json.hpp
Go to the documentation of this file.
1 /**
2  * @file
3  * @ingroup daq_ocm_libfits
4  * @copyright 2021 ESO - European Southern Observatory
5  *
6  * @brief Contains data structure for FITS keywords
7  */
8 #ifndef DAQ_OCM_DAQ_FITS_JSON_HPP_
9 #define DAQ_OCM_DAQ_FITS_JSON_HPP_
10 #include <nlohmann/json.hpp>
11 #include <variant>
12 #include <vector>
13 
14 #include "keyword.hpp"
15 
16 namespace daq::fits {
17 
18 
19 /**
20  * Parse and return FITS keywords.
21  *
22  * Example string:
23  *
24  * @code
25  * auto keywords = R"([
26  * {
27  * "type":"valueKeyword",
28  * "name":"OBJECT",
29  * "value":"OBJECT,SKY"
30  * },
31  * ...
32  * ]");
33  * auto res = ParseJsonKeywords(keywords);
34  * @endcode
35  *
36  * @param keywords JSON encoded string of keywords
37  *
38  * @throws std::invalid_argument on schema validation error.
39  * @throws nlohmann::json::exception on JSON parsing error.
40  */
41 std::vector<KeywordVariant> ParseJsonKeywords(char const* keywords);
42 
43 /**
44  * Parse and return FITS keywords.
45  *
46  * @param keywords JSON object containing FITS keywords.
47  *
48  * @throws std::invalid_argument on schema validation error.
49  */
50 std::vector<KeywordVariant> ParseJsonKeywords(nlohmann::json const& keywords);
51 
52 } // namespace daq::fits
53 
54 #endif // #define DAQ_OCM_DAQ_FITS_JSON_HPP_
keyword.hpp
Contains data structure for FITS keywords.
daq::fits
Definition: cfitsio.cpp:14
daq::fits::ParseJsonKeywords
std::vector< KeywordVariant > ParseJsonKeywords(char const *keywords)
Parse and return FITS keywords.
Definition: json.cpp:73