ifw-daq  2.1.0-pre1
IFW Data Acquisition modules
conversion.hpp
Go to the documentation of this file.
1 /**
2  * @file
3  * @ingroup daq_libdaq
4  * @copyright 2022 ESO - European Southern Observatory
5  *
6  * @brief Contains support functions for daqif
7  */
8 #ifndef DAQ_CONVERSION_HPP_
9 #define DAQ_CONVERSION_HPP_
10 #include "config.hpp"
11 
12 #include <daqif/state.hpp>
13 #include <string_view>
14 #include <filesystem>
15 
16 namespace daq {
17 struct Status;
18 enum class State;
19 
20 /**
21  * Convert daq::Status -> daqif::DaqStatus by populating from @a rhs.
22  */
23 daqif::DaqStatus& operator<<(daqif::DaqStatus& status, Status const& rhs);
24 
25 /**
26  * Convert daqif::DaqStatus -> daq::Status by populating from @a rhs.
27  */
28 Status& operator<<(Status& status, daqif::DaqStatus const& rhs);
29 
30 /**
31  * Populate @a space from @a rhs.
32  */
33 std::filesystem::space_info&
34 operator<<(std::filesystem::space_info& space, daqif::StorageStatus const& rhs);
35 
36 /**
37  * Populate @a storage from @a rhs.
38  */
39 daqif::StorageStatus&
40 operator<<(daqif::StorageStatus& storage, std::filesystem::space_info& rhs);
41 
42 /**
43  * Converts daq::State to DaqSubstate.
44  */
45 daqif::FullState MakeState(State state) noexcept;
46 
47 /**
48  * Converts DaqSubstate to daq::State. This assumes daqif::DaqState is Acquiring.
49  *
50  * @throw std::invalid_argument if state is not convertible.
51  */
53 
54 /**
55  * @return string representation of enumeration.
56  */
57 std::string_view ToString(daqif::DaqState state) noexcept;
58 
59 /**
60  * @return string representation of enumeration.
61  */
62 std::string_view ToString(daqif::DaqSubState state) noexcept;
63 } // namespace daq
64 #endif // #ifndef DAQ_CONVERSION_HPP_
daq::State
State
Observable states of the data acquisition process.
Definition: state.hpp:39
daqif::FullState
Describes the full state and substate.
Definition: state.hpp:17
daq
Definition: asyncProcess.cpp:15
config.hpp
Config class header file.
daq::operator<<
daqif::DaqStatus & operator<<(daqif::DaqStatus &status, daq::Status const &rhs)
Convert daq::Status -> daqif::DaqStatus by populating from rhs.
Definition: conversion.cpp:18
daq::ToString
std::string_view ToString(daqif::DaqState state) noexcept
Definition: conversion.cpp:142
daq::MakeState
daqif::FullState MakeState(State state) noexcept
Converts daq::State to DaqSubstate.
Definition: conversion.cpp:63
state.hpp
Contains State support functions for daqif.