tempoch-cpp 0.5.3
Header-only C++ wrapper for tempoch
Loading...
Searching...
No Matches
data_status.hpp
Go to the documentation of this file.
1#pragma once
2
13#include "ffi_core.hpp"
14
15#include <cmath>
16#include <optional>
17
18namespace tempoch {
19
23enum class TimeDataSource : int {
25 Bundled = 0,
27 RuntimeCache = 1,
29 Override = 2,
30};
31
38 std::optional<double> eop_start_mjd;
40 std::optional<double> eop_observed_end_mjd;
42 std::optional<double> eop_end_mjd;
47};
48
59
64 TempochDataHorizons raw{};
65 check_status(tempoch_time_data_status(&raw), "tempoch::time_data_status");
66
67 auto opt = [](double v) -> std::optional<double> {
68 return std::isnan(v) ? std::nullopt : std::optional<double>(v);
69 };
70
71 TimeDataStatus status;
72 status.horizons.eop_start_mjd = opt(raw.eop_start_mjd);
73 status.horizons.eop_observed_end_mjd = opt(raw.eop_observed_end_mjd);
74 status.horizons.eop_end_mjd = opt(raw.eop_end_mjd);
75 status.horizons.modern_delta_t_observed_end_mjd = raw.modern_delta_t_observed_end_mjd;
76 status.horizons.delta_t_prediction_horizon_mjd = raw.delta_t_prediction_horizon_mjd;
77 status.source = static_cast<TimeDataSource>(raw.source);
78 return status;
79}
80
81} // namespace tempoch
Error handling for the tempoch C++ wrapper.
@ Bundled
Compiled archive snapshot bundled at build time.
@ Override
Test or caller-provided override is active.
@ RuntimeCache
Bundle loaded through the runtime fetch/cache path.
TimeDataStatus time_data_status()
void check_status(tempoch_status_t status, const char *operation)
Check a tempoch_status_t and throw the appropriate exception on error.
Definition ffi_core.hpp:139
std::optional< double > eop_observed_end_mjd
Last observed (non-predicted) EOP MJD, or std::nullopt when unloaded.
double delta_t_prediction_horizon_mjd
Last MJD covered by the ΔT prediction table.
double modern_delta_t_observed_end_mjd
Last MJD with observed ΔT in the archive-provided modern table.
std::optional< double > eop_end_mjd
Last EOP MJD including predictions, or std::nullopt when unloaded.
std::optional< double > eop_start_mjd
First MJD covered by the EOP series, or std::nullopt when unloaded.
TimeDataSource source
Source the active bundle was loaded from.
DataHorizons horizons
Validity horizons of the active bundle.