24 #ifndef PXR_USD_USD_TIME_CODE_H 25 #define PXR_USD_USD_TIME_CODE_H 28 #include "pxr/usd/usd/api.h" 33 #include <boost/functional/hash.hpp> 40 PXR_NAMESPACE_OPEN_SCOPE
43 #define USD_TIME_CODE_TOKENS \ 92 : _value(timeCode.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;
135 return IsNumeric() && (_value == std::numeric_limits<double>::lowest());
141 return std::isnan(_value);
154 _IssueGetValueOnDefaultError();
166 return !(lhs == rhs);
193 return !(lhs <= rhs);
198 return boost::hash_value(time._value);
203 void _IssueGetValueOnDefaultError()
const;
216 PXR_NAMESPACE_CLOSE_SCOPE
218 #endif // PXR_USD_USD_TIME_CODE_H friend bool operator==(const UsdTimeCode &lhs, const UsdTimeCode &rhs)
Equality comparison.
static constexpr UsdTimeCode EarliestTime()
Produce a UsdTimeCode representing the lowest/earliest possible timeCode.
friend bool operator>=(const UsdTimeCode &lhs, const UsdTimeCode &rhs)
Greater-equal.
friend bool operator<=(const UsdTimeCode &lhs, const UsdTimeCode &rhs)
Less-equal.
bool IsNumeric() const
Return true if this time represents a numeric value, false otherwise.
constexpr UsdTimeCode(double t=0.0) noexcept
Construct with optional time value. Impilicitly convert from double.
Value type that represents a time code.
Represent a time value, which may be either numeric, holding a double value, or a sentinel value UsdT...
#define TF_DECLARE_PUBLIC_TOKENS(...)
Macro to define public tokens.
friend size_t hash_value(const UsdTimeCode &time)
Hash function.
USDUTILS_API std::istream & operator>>(std::istream &is, UsdUtilsTimeCodeRange &timeCodeRange)
Stream extraction operator.
constexpr UsdTimeCode(const SdfTimeCode &timeCode) noexcept
Construct and implicitly cast from SdfTimeCode.
This file defines some macros that are useful for declaring and using static TfTokens.
static constexpr UsdTimeCode Default()
Produce a UsdTimeCode representing the sentinel value for 'default'.
bool IsEarliestTime() const
Return true if this time represents the lowest/earliest possible timeCode, false otherwise.
friend bool operator!=(const UsdTimeCode &lhs, const UsdTimeCode &rhs)
Inequality comparison.
static constexpr double SafeStep(double maxValue=1e6, double maxCompression=10.0)
Produce a safe step value such that for any numeric UsdTimeCode t in [-maxValue, maxValue],...
double GetValue() const
Return the numeric value for this time.
bool IsDefault() const
Return true if this time represents the 'default' sentinel value, false otherwise.
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)
Less-than.
friend bool operator>(const UsdTimeCode &lhs, const UsdTimeCode &rhs)
Greater-than.