ifw-daq  3.0.0-pre2
IFW Data Acquisition modules
json.hpp
Go to the documentation of this file.
1 /**
2  * @file
3  * @ingroup daq_common_libdaq
4  * @copyright (c) Copyright ESO 2022
5  * All Rights Reserved
6  * ESO (eso.org) is an Intergovernmental Organisation, and therefore special legal conditions apply.
7  *
8  * @brief Declares JSON support for serialization
9  */
10 #ifndef DAQ_JSON_HPP
11 #define DAQ_JSON_HPP
12 
13 #include <nlohmann/json.hpp>
14 
15 #include <daq/state.hpp>
16 #include <daq/daqContext.hpp>
17 
18 namespace daq {
19 
20 struct Status;
21 struct Alert;
22 
23 // NOLINTNEXTLINE
24 NLOHMANN_JSON_SERIALIZE_ENUM(State,
25  {
26  {State::NotStarted, "NotStarted"},
27  {State::Starting, "Starting"},
28  {State::Acquiring, "Acquiring"},
29  {State::Stopping, "Stopping"},
30  {State::Stopped, "Stopped"},
31 
32  {State::NotScheduled, "NotScheduled"},
33  {State::Scheduled, "Scheduled"},
34  {State::Transferring, "Transferring"},
35  {State::Merging, "Merging"},
36  {State::Releasing, "Releasing"},
37 
38  {State::AbortingAcquiring, "AbortingAcquiring"},
39  {State::AbortingMerging, "AbortingMerging"},
40  {State::Aborted, "Aborted"},
41 
42  {State::Completed, "Completed"},
43  })
44 
45 // NOLINTNEXTLINE
46 void to_json(nlohmann::json& j, Status const& p);
47 // NOLINTNEXTLINE
48 void to_json(nlohmann::json& j, Alert const& p);
49 // NOLINTNEXTLINE
50 void to_json(nlohmann::json& j, DaqContext const& p);
51 // NOLINTNEXTLINE
52 void to_json(nlohmann::json& j, DaqContext::Source const& p);
53 // NOLINTNEXTLINE
54 void to_json(nlohmann::json& j, DpPart const& p);
55 
56 // NOLINTNEXTLINE
57 void from_json(nlohmann::json const& j, Status& p);
58 // NOLINTNEXTLINE
59 void from_json(nlohmann::json const& j, Alert& p);
60 // NOLINTNEXTLINE
61 void from_json(nlohmann::json const& j, DaqContext& p);
62 // NOLINTNEXTLINE
63 void from_json(nlohmann::json const& j, DaqContext::Source& p);
64 // NOLINTNEXTLINE
65 void from_json(nlohmann::json const& j, DpPart& p);
66 
67 } // namespace daq
68 #endif // #ifndef DAQ_JSON_HPP
Contains declaration of daq::Context.
Declares daq::State and related functions.
void from_json(nlohmann::json const &j, Status &p)
Definition: json.cpp:96
State
Observable states of the data acquisition process.
Definition: state.hpp:39
@ Completed
Completed DAQ.
@ NotScheduled
Before daq is acknowledged by dpm it remains in NotScheduled.
@ Scheduled
daq is acknowledged by dpm and is scheduled for merging (i.e.
@ Releasing
Releasing Data Product to receivers.
@ Aborted
Data acquisition has been aborted by user.
@ Merging
DAQ is being merged.
@ Stopping
Transitional state between Acquiring and Stopped.
@ AbortingMerging
Transitional state for aborting during merging.
@ Transferring
Input files are being transferred.
@ Acquiring
All data sources have reported data acquisition is in progress.
@ Stopped
All data sources have reported they have stopped acquiring data.
@ Starting
Transitional state between NotStarted and Acquiring when sources have not begun acquiring data yet.
@ AbortingAcquiring
Transitional state for aborting during acquisition.
@ NotStarted
Initial state of data acquisition.
NLOHMANN_JSON_SERIALIZE_ENUM(State, { {State::NotStarted, "NotStarted"}, {State::Starting, "Starting"}, {State::Acquiring, "Acquiring"}, {State::Stopping, "Stopping"}, {State::Stopped, "Stopped"}, {State::NotScheduled, "NotScheduled"}, {State::Scheduled, "Scheduled"}, {State::Transferring, "Transferring"}, {State::Merging, "Merging"}, {State::Releasing, "Releasing"}, {State::AbortingAcquiring, "AbortingAcquiring"}, {State::AbortingMerging, "AbortingMerging"}, {State::Aborted, "Aborted"}, {State::Completed, "Completed"}, }) void to_json(nlohmann void to_json(nlohmann::json &j, Alert const &p)
Definition: json.cpp:48