52 static Tle parse(std::string_view line1, std::string_view line2) {
53 const std::string l1{line1};
54 const std::string l2{line2};
55 SiderustTle *handle =
nullptr;
56 check_status(siderust_tle_parse(l1.c_str(), l2.c_str(), &handle),
"tle::Tle::parse");
60 Tle(
Tle &&other) noexcept : handle_(std::exchange(other.handle_,
nullptr)) {}
63 siderust_tle_free(handle_);
64 handle_ = std::exchange(other.handle_,
nullptr);
72 ~Tle() { siderust_tle_free(handle_); }
77 check_status(siderust_tle_norad_id(handle_, &
id),
"tle::Tle::norad_id");
82 const SiderustTle *
raw() const noexcept {
return handle_; }
85 explicit Tle(SiderustTle *h) : handle_(h) {}
111 os <<
"SGP4 TEME (pos_km=(" << s.
pos_km[0] <<
", " << s.
pos_km[1] <<
", " << s.
pos_km[2]
129 check_status(siderust_sgp4_new(
tle.raw(),
static_cast<int>(model), &handle_),
135 if (
this != &other) {
136 siderust_sgp4_free(handle_);
137 handle_ = std::exchange(other.handle_,
nullptr);
150 check_status(siderust_sgp4_epoch_jd_utc(handle_, &jd),
"sgp4::Propagator::epoch_jd_utc");
157 check_status(siderust_sgp4_gravity_model(handle_, &m),
"sgp4::Propagator::gravity_model");
168 "sgp4::Propagator::propagate_at");
173 SiderustSgp4 *handle_ =
nullptr;
Propagator(Propagator &&other) noexcept
Propagator(const tle::Tle &tle, GravityModel model=GravityModel::Wgs72)
Propagator(const Propagator &)=delete
int gravity_model() const
Return the gravity model used by this propagator (0/1/2).
Propagator & operator=(const Propagator &)=delete
double epoch_jd_utc() const
Return the UTC Julian date of the TLE epoch.
Propagator & operator=(Propagator &&other) noexcept
State propagate_at(double jd_utc) const
Move-only RAII wrapper around a parsed Two-Line Element set.
Tle & operator=(Tle &&other) noexcept
const SiderustTle * raw() const noexcept
Expose the raw opaque handle (for use by Propagator constructor).
Tle & operator=(const Tle &)=delete
std::uint32_t norad_id() const
Return the NORAD catalog number.
static Tle parse(std::string_view line1, std::string_view line2)
Tle(Tle &&other) noexcept
Error handling and utility base for the siderust C++ wrapper.
std::ostream & operator<<(std::ostream &os, const State &s)
GravityModel
Gravity model selector.
@ Wgs72
WGS-72 / AFSPC (default; matches TLE conventions).
@ Wgs84
WGS-84 / IAU sidereal time.
@ Wgs72Iau
WGS-72 / IAU sidereal time.
void check_status(siderust_status_t status, const char *operation)
Propagated TEME state vector.
double vel_kms[3]
Velocity [vx, vy, vz] in km/s (TEME frame).
double pos_km[3]
Position [x, y, z] in km (TEME frame).