tempoch-cpp 0.5.3
Header-only C++ wrapper for tempoch
Loading...
Searching...
No Matches
tempoch::EncodedTime< S, F > Class Template Reference

A typed external encoding of a time instant on scale S. More...

#include <tempoch/time_base.hpp>

Public Types

using scale_type = S
 
using format_type = F
 
using quantity_type = typename FormatTraits< F >::quantity_type
 

Public Member Functions

 EncodedTime ()
 
 EncodedTime (quantity_type raw)
 
 EncodedTime (double value)
 
quantity_type raw () const noexcept
 
quantity_type quantity () const noexcept
 
double value () const noexcept
 
template<typename TargetScale , std::enable_if_t< is_scale_v< TargetScale >, int > = 0>
auto to () const
 
template<typename TargetScale , typename TargetFormat , std::enable_if_t< is_scale_v< TargetScale > &&is_format_v< TargetFormat >, int > = 0>
EncodedTime< TargetScale, TargetFormatto () const
 
template<typename TargetScale , std::enable_if_t< is_scale_v< TargetScale >, int > = 0>
Time< TargetScaleto_with (const TimeContext &ctx) const
 
template<typename TargetScale , typename TargetFormat , std::enable_if_t< is_scale_v< TargetScale > &&is_format_v< TargetFormat >, int > = 0>
EncodedTime< TargetScale, TargetFormatto_with (const TimeContext &ctx) const
 
template<typename TargetFormat , std::enable_if_t< is_format_v< TargetFormat >, int > = 0>
EncodedTime< S, TargetFormatto () const
 
template<typename TargetFormat , std::enable_if_t< is_format_v< TargetFormat >, int > = 0>
EncodedTime< S, TargetFormatto_with (const TimeContext &ctx) const
 
template<typename TargetScale , std::enable_if_t< is_scale_v< TargetScale >, int > = 0>
std::optional< Time< TargetScale > > try_to () const
 
template<typename TargetFormat , std::enable_if_t< is_format_v< TargetFormat >, int > = 0>
std::optional< EncodedTime< S, TargetFormat > > try_to () const
 
template<typename Q >
EncodedTime operator+ (const Q &delta) const
 
template<typename Q >
EncodedTime operator- (const Q &delta) const
 
template<typename Q >
EncodedTimeoperator+= (const Q &delta)
 
template<typename Q >
EncodedTimeoperator-= (const Q &delta)
 
quantity_type operator- (const EncodedTime &other) const
 
bool operator== (const EncodedTime &other) const noexcept
 
bool operator!= (const EncodedTime &other) const noexcept
 
bool operator< (const EncodedTime &other) const noexcept
 
bool operator<= (const EncodedTime &other) const noexcept
 
bool operator> (const EncodedTime &other) const noexcept
 
bool operator>= (const EncodedTime &other) const noexcept
 
EncodedTime min (const EncodedTime &other) const noexcept
 
EncodedTime max (const EncodedTime &other) const noexcept
 
EncodedTime mean (const EncodedTime &other) const
 
template<typename U = F, std::enable_if_t< std::is_same_v< U, format::JD >, int > = 0>
double jd_value () const noexcept
 
template<typename U = F, std::enable_if_t< std::is_same_v< U, format::MJD >, int > = 0>
double mjd_value () const noexcept
 
template<typename U = F, std::enable_if_t< std::is_same_v< U, format::JD >, int > = 0>
qtty::JulianCentury julian_centuries_qty () const noexcept
 
template<typename U = F, std::enable_if_t< std::is_same_v< U, format::JD >, int > = 0>
double julian_centuries () const noexcept
 
template<typename U = F, std::enable_if_t< std::is_same_v< U, format::JD >, int > = 0>
EncodedTime< S, format::MJDto_mjd () const
 
template<typename U = F, std::enable_if_t< std::is_same_v< U, format::MJD >, int > = 0>
EncodedTime< S, format::JDto_jd () const
 
template<typename U = S, std::enable_if_t< std::is_same_v< U, scale::TT >, int > = 0>
CivilTime to_utc () const
 
template<typename U = S, std::enable_if_t< std::is_same_v< U, scale::TT >, int > = 0>
CivilTime to_utc (const TimeContext &ctx) const
 

Static Public Member Functions

static std::optional< EncodedTimetry_new (quantity_type raw)
 
static EncodedTime from_raw (quantity_type raw)
 
template<typename U = F, std::enable_if_t< std::is_same_v< U, format::JD >, int > = 0>
static EncodedTime J2000 ()
 
template<typename U = F, std::enable_if_t< std::is_same_v< U, format::JD >, int > = 0>
static EncodedTime from_mjd (const EncodedTime< S, format::MJD > &mjd)
 
template<typename U = F, std::enable_if_t< std::is_same_v< U, format::MJD >, int > = 0>
static EncodedTime from_jd (const EncodedTime< S, format::JD > &jd)
 
template<typename U = S, std::enable_if_t< std::is_same_v< U, scale::TT >, int > = 0>
static EncodedTime from_utc (const CivilTime &civil)
 
template<typename U = S, std::enable_if_t< std::is_same_v< U, scale::TT >, int > = 0>
static EncodedTime from_utc (const CivilTime &civil, const TimeContext &ctx)
 

Detailed Description

template<typename S, typename F>
class tempoch::EncodedTime< S, F >

A typed external encoding of a time instant on scale S.

Definition at line 312 of file time_base.hpp.

Member Typedef Documentation

◆ format_type

template<typename S , typename F >
using tempoch::EncodedTime< S, F >::format_type = F

Definition at line 318 of file time_base.hpp.

◆ quantity_type

template<typename S , typename F >
using tempoch::EncodedTime< S, F >::quantity_type = typename FormatTraits<F>::quantity_type

Definition at line 319 of file time_base.hpp.

◆ scale_type

template<typename S , typename F >
using tempoch::EncodedTime< S, F >::scale_type = S

Definition at line 317 of file time_base.hpp.

Constructor & Destructor Documentation

◆ EncodedTime() [1/3]

◆ EncodedTime() [2/3]

template<typename S , typename F >
tempoch::EncodedTime< S, F >::EncodedTime ( quantity_type  raw)
inlineexplicit

Definition at line 327 of file time_base.hpp.

◆ EncodedTime() [3/3]

template<typename S , typename F >
tempoch::EncodedTime< S, F >::EncodedTime ( double  value)
inlineexplicit

Definition at line 331 of file time_base.hpp.

Member Function Documentation

◆ from_jd()

template<typename S , typename F >
template<typename U = F, std::enable_if_t< std::is_same_v< U, format::MJD >, int > = 0>
static EncodedTime tempoch::EncodedTime< S, F >::from_jd ( const EncodedTime< S, format::JD > &  jd)
inlinestatic

Definition at line 480 of file time_base.hpp.

References tempoch::scale_tag_v.

◆ from_mjd()

template<typename S , typename F >
template<typename U = F, std::enable_if_t< std::is_same_v< U, format::JD >, int > = 0>
static EncodedTime tempoch::EncodedTime< S, F >::from_mjd ( const EncodedTime< S, format::MJD > &  mjd)
inlinestatic

Definition at line 475 of file time_base.hpp.

References tempoch::scale_tag_v.

◆ from_raw()

template<typename S , typename F >
static EncodedTime tempoch::EncodedTime< S, F >::from_raw ( quantity_type  raw)
inlinestatic

Construct directly from a quantity, validating that the value is finite.

Unlike try_new, this throws TempochException on non-finite input.

Definition at line 342 of file time_base.hpp.

References tempoch::EncodedTime< S, F >::EncodedTime(), and tempoch::EncodedTime< S, F >::raw().

◆ from_utc() [1/2]

template<typename S , typename F >
template<typename U = S, std::enable_if_t< std::is_same_v< U, scale::TT >, int > = 0>
static EncodedTime tempoch::EncodedTime< S, F >::from_utc ( const CivilTime civil)
inlinestatic

Definition at line 485 of file time_base.hpp.

References tempoch::Time< S >::from_civil(), and tempoch::scale_tag_v.

◆ from_utc() [2/2]

template<typename S , typename F >
template<typename U = S, std::enable_if_t< std::is_same_v< U, scale::TT >, int > = 0>
static EncodedTime tempoch::EncodedTime< S, F >::from_utc ( const CivilTime civil,
const TimeContext ctx 
)
inlinestatic

Definition at line 490 of file time_base.hpp.

References tempoch::Time< S >::from_civil(), and tempoch::scale_tag_v.

◆ J2000()

template<typename S , typename F >
template<typename U = F, std::enable_if_t< std::is_same_v< U, format::JD >, int > = 0>
static EncodedTime tempoch::EncodedTime< S, F >::J2000 ( )
inlinestatic

◆ jd_value()

template<typename S , typename F >
template<typename U = F, std::enable_if_t< std::is_same_v< U, format::JD >, int > = 0>
double tempoch::EncodedTime< S, F >::jd_value ( ) const
inlinenoexcept

Definition at line 445 of file time_base.hpp.

◆ julian_centuries()

template<typename S , typename F >
template<typename U = F, std::enable_if_t< std::is_same_v< U, format::JD >, int > = 0>
double tempoch::EncodedTime< S, F >::julian_centuries ( ) const
inlinenoexcept

◆ julian_centuries_qty()

template<typename S , typename F >
template<typename U = F, std::enable_if_t< std::is_same_v< U, format::JD >, int > = 0>
qtty::JulianCentury tempoch::EncodedTime< S, F >::julian_centuries_qty ( ) const
inlinenoexcept

Definition at line 455 of file time_base.hpp.

Referenced by tempoch::EncodedTime< S, F >::julian_centuries().

◆ max()

template<typename S , typename F >
EncodedTime tempoch::EncodedTime< S, F >::max ( const EncodedTime< S, F > &  other) const
inlinenoexcept

Definition at line 436 of file time_base.hpp.

References tempoch::scale_tag_v.

◆ mean()

template<typename S , typename F >
EncodedTime tempoch::EncodedTime< S, F >::mean ( const EncodedTime< S, F > &  other) const
inline

◆ min()

template<typename S , typename F >
EncodedTime tempoch::EncodedTime< S, F >::min ( const EncodedTime< S, F > &  other) const
inlinenoexcept

Definition at line 433 of file time_base.hpp.

References tempoch::scale_tag_v.

◆ mjd_value()

template<typename S , typename F >
template<typename U = F, std::enable_if_t< std::is_same_v< U, format::MJD >, int > = 0>
double tempoch::EncodedTime< S, F >::mjd_value ( ) const
inlinenoexcept

Definition at line 450 of file time_base.hpp.

◆ operator!=()

template<typename S , typename F >
bool tempoch::EncodedTime< S, F >::operator!= ( const EncodedTime< S, F > &  other) const
inlinenoexcept

Definition at line 427 of file time_base.hpp.

References tempoch::scale_tag_v.

◆ operator+()

template<typename S , typename F >
template<typename Q >
EncodedTime tempoch::EncodedTime< S, F >::operator+ ( const Q delta) const
inline

Definition at line 403 of file time_base.hpp.

References tempoch::scale_tag_v.

◆ operator+=()

template<typename S , typename F >
template<typename Q >
EncodedTime & tempoch::EncodedTime< S, F >::operator+= ( const Q delta)
inline

Definition at line 411 of file time_base.hpp.

References tempoch::scale_tag_v.

◆ operator-() [1/2]

template<typename S , typename F >
quantity_type tempoch::EncodedTime< S, F >::operator- ( const EncodedTime< S, F > &  other) const
inline

Definition at line 421 of file time_base.hpp.

References tempoch::scale_tag_v.

◆ operator-() [2/2]

template<typename S , typename F >
template<typename Q >
EncodedTime tempoch::EncodedTime< S, F >::operator- ( const Q delta) const
inline

Definition at line 407 of file time_base.hpp.

References tempoch::scale_tag_v.

◆ operator-=()

template<typename S , typename F >
template<typename Q >
EncodedTime & tempoch::EncodedTime< S, F >::operator-= ( const Q delta)
inline

Definition at line 416 of file time_base.hpp.

References tempoch::scale_tag_v.

◆ operator<()

template<typename S , typename F >
bool tempoch::EncodedTime< S, F >::operator< ( const EncodedTime< S, F > &  other) const
inlinenoexcept

Definition at line 428 of file time_base.hpp.

References tempoch::scale_tag_v.

◆ operator<=()

template<typename S , typename F >
bool tempoch::EncodedTime< S, F >::operator<= ( const EncodedTime< S, F > &  other) const
inlinenoexcept

Definition at line 429 of file time_base.hpp.

References tempoch::scale_tag_v.

◆ operator==()

template<typename S , typename F >
bool tempoch::EncodedTime< S, F >::operator== ( const EncodedTime< S, F > &  other) const
inlinenoexcept

Definition at line 426 of file time_base.hpp.

References tempoch::scale_tag_v.

◆ operator>()

template<typename S , typename F >
bool tempoch::EncodedTime< S, F >::operator> ( const EncodedTime< S, F > &  other) const
inlinenoexcept

Definition at line 430 of file time_base.hpp.

References tempoch::scale_tag_v.

◆ operator>=()

template<typename S , typename F >
bool tempoch::EncodedTime< S, F >::operator>= ( const EncodedTime< S, F > &  other) const
inlinenoexcept

Definition at line 431 of file time_base.hpp.

References tempoch::scale_tag_v.

◆ quantity()

template<typename S , typename F >
quantity_type tempoch::EncodedTime< S, F >::quantity ( ) const
inlinenoexcept

Definition at line 345 of file time_base.hpp.

◆ raw()

template<typename S , typename F >
quantity_type tempoch::EncodedTime< S, F >::raw ( ) const
inlinenoexcept

◆ to() [1/3]

template<typename S , typename F >
template<typename TargetScale , std::enable_if_t< is_scale_v< TargetScale >, int > = 0>
auto tempoch::EncodedTime< S, F >::to ( ) const
inline

Definition at line 354 of file time_base.hpp.

References tempoch::Time< S >::from_encoded(), and tempoch::scale_tag_v.

◆ to() [2/3]

template<typename S , typename F >
EncodedTime< TargetScale, TargetFormat > tempoch::EncodedTime< S, F >::to ( ) const
inline

Definition at line 360 of file time_base.hpp.

References tempoch::Time< S >::from_encoded(), and tempoch::scale_tag_v.

◆ to() [3/3]

template<typename S , typename F >
template<typename TargetFormat , std::enable_if_t< is_format_v< TargetFormat >, int > = 0>
EncodedTime< S, TargetFormat > tempoch::EncodedTime< S, F >::to ( ) const
inline

Definition at line 376 of file time_base.hpp.

References tempoch::Time< S >::from_encoded(), and tempoch::scale_tag_v.

◆ to_jd()

template<typename S , typename F >
template<typename U = F, std::enable_if_t< std::is_same_v< U, format::MJD >, int > = 0>
EncodedTime< S, format::JD > tempoch::EncodedTime< S, F >::to_jd ( ) const
inline

Definition at line 470 of file time_base.hpp.

References tempoch::scale_tag_v.

◆ to_mjd()

template<typename S , typename F >
template<typename U = F, std::enable_if_t< std::is_same_v< U, format::JD >, int > = 0>
EncodedTime< S, format::MJD > tempoch::EncodedTime< S, F >::to_mjd ( ) const
inline

Definition at line 465 of file time_base.hpp.

References tempoch::scale_tag_v.

◆ to_utc() [1/2]

template<typename S , typename F >
template<typename U = S, std::enable_if_t< std::is_same_v< U, scale::TT >, int > = 0>
CivilTime tempoch::EncodedTime< S, F >::to_utc ( ) const
inline

◆ to_utc() [2/2]

template<typename S , typename F >
template<typename U = S, std::enable_if_t< std::is_same_v< U, scale::TT >, int > = 0>
CivilTime tempoch::EncodedTime< S, F >::to_utc ( const TimeContext ctx) const
inline

◆ to_with() [1/3]

template<typename S , typename F >
template<typename TargetScale , std::enable_if_t< is_scale_v< TargetScale >, int > = 0>
Time< TargetScale > tempoch::EncodedTime< S, F >::to_with ( const TimeContext ctx) const
inline

Definition at line 365 of file time_base.hpp.

References tempoch::Time< S >::from_encoded_with(), and tempoch::scale_tag_v.

◆ to_with() [2/3]

template<typename S , typename F >
EncodedTime< TargetScale, TargetFormat > tempoch::EncodedTime< S, F >::to_with ( const TimeContext ctx) const
inline

Definition at line 371 of file time_base.hpp.

References tempoch::Time< S >::from_encoded_with(), and tempoch::scale_tag_v.

◆ to_with() [3/3]

template<typename S , typename F >
template<typename TargetFormat , std::enable_if_t< is_format_v< TargetFormat >, int > = 0>
EncodedTime< S, TargetFormat > tempoch::EncodedTime< S, F >::to_with ( const TimeContext ctx) const
inline

Definition at line 381 of file time_base.hpp.

References tempoch::Time< S >::from_encoded_with(), and tempoch::scale_tag_v.

◆ try_new()

template<typename S , typename F >
static std::optional< EncodedTime > tempoch::EncodedTime< S, F >::try_new ( quantity_type  raw)
inlinestatic

◆ try_to() [1/2]

template<typename S , typename F >
template<typename TargetScale , std::enable_if_t< is_scale_v< TargetScale >, int > = 0>
std::optional< Time< TargetScale > > tempoch::EncodedTime< S, F >::try_to ( ) const
inline

Definition at line 386 of file time_base.hpp.

References tempoch::scale_tag_v.

◆ try_to() [2/2]

template<typename S , typename F >
template<typename TargetFormat , std::enable_if_t< is_format_v< TargetFormat >, int > = 0>
std::optional< EncodedTime< S, TargetFormat > > tempoch::EncodedTime< S, F >::try_to ( ) const
inline

Definition at line 395 of file time_base.hpp.

References tempoch::scale_tag_v.

◆ value()

template<typename S , typename F >
double tempoch::EncodedTime< S, F >::value ( ) const
inlinenoexcept

Definition at line 346 of file time_base.hpp.


The documentation for this class was generated from the following file: