7 #ifndef PXR_USD_USD_TIME_CODE_H
8 #define PXR_USD_USD_TIME_CODE_H
25 #define USD_TIME_CODE_TOKENS \
79 : _value(sdfTimeCode.GetValue()) {}
103 return UsdTimeCode(std::numeric_limits<double>::lowest());
114 return UsdTimeCode(std::numeric_limits<double>::quiet_NaN());
126 static constexpr
double
127 SafeStep(
double maxValue=1e6,
double maxCompression=10.0) {
128 return std::numeric_limits<double>::epsilon() *
129 maxValue * maxCompression * 2.0;
140 return IsNumeric() && (_value == std::numeric_limits<double>::lowest());
146 return std::isnan(_value);
159 _IssueGetValueOnDefaultError();
168 return lhs._value == rhs._value &&
169 lhs._isPreTime == rhs._isPreTime;
174 return !(lhs == rhs);
188 return lhs._value < rhs._value ||
189 (lhs._value == rhs._value &&
190 lhs._isPreTime && !rhs._isPreTime);
207 return !(lhs <= rhs);
216 constexpr
UsdTimeCode(
double t,
bool isPreTime) noexcept
217 : _value(
t), _isPreTime(isPreTime) {}
220 void _IssueGetValueOnDefaultError()
const;
223 bool _isPreTime =
false;
236 #endif // PXR_USD_USD_TIME_CODE_H
#define USD_TIME_CODE_TOKENS
friend bool operator==(const UsdTimeCode &lhs, const UsdTimeCode &rhs)
Equality comparison.
static constexpr UsdTimeCode Default()
static constexpr UsdTimeCode EarliestTime()
GT_API const UT_StringHolder time
friend bool operator>=(const UsdTimeCode &lhs, const UsdTimeCode &rhs)
friend bool operator<=(const UsdTimeCode &lhs, const UsdTimeCode &rhs)
Less-equal.
bool IsEarliestTime() const
USD_API std::istream & operator>>(std::istream &is, UsdTimeCode &time)
constexpr UsdTimeCode(double t=0.0) noexcept
Construct with optional time value. Impilicitly convert from double.
bool IsPreTime() const
Return true if this timeCode represents a pre-value, false otherwise.
TF_DECLARE_PUBLIC_TOKENS(UsdTimeCodeTokens, USD_API, USD_TIME_CODE_TOKENS)
static constexpr UsdTimeCode PreTime(const SdfTimeCode &timeCode) noexcept
friend size_t hash_value(const UsdTimeCode &time)
Hash function.
static size_t Combine(Args &&...args)
Produce a hash code by combining the hash codes of several objects.
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
static constexpr UsdTimeCode PreTime(double t) noexcept
friend bool operator!=(const UsdTimeCode &lhs, const UsdTimeCode &rhs)
Inequality comparison.
#define PXR_NAMESPACE_CLOSE_SCOPE
SDF_API std::ostream & operator<<(std::ostream &out, const SdfTimeCode &ap)
Stream insertion operator for the string representation of this time code.
friend bool operator<(const UsdTimeCode &lhs, const UsdTimeCode &rhs)
friend bool operator>(const UsdTimeCode &lhs, const UsdTimeCode &rhs)
static constexpr double SafeStep(double maxValue=1e6, double maxCompression=10.0)
constexpr UsdTimeCode(const SdfTimeCode &sdfTimeCode) noexcept
Construct and implicitly cast from SdfTimeCode.