7#ifndef PXR_USD_USD_TIME_CODE_H
8#define PXR_USD_USD_TIME_CODE_H
11#include "pxr/usd/usd/api.h"
22PXR_NAMESPACE_OPEN_SCOPE
25#define USD_TIME_CODE_TOKENS \
74 : _value(timeCode.GetValue()) {}
85 return UsdTimeCode(std::numeric_limits<double>::lowest());
96 return UsdTimeCode(std::numeric_limits<double>::quiet_NaN());
108 static constexpr double
109 SafeStep(
double maxValue=1e6,
double maxCompression=10.0) {
110 return std::numeric_limits<double>::epsilon() *
111 maxValue * maxCompression * 2.0;
117 return IsNumeric() && (_value == std::numeric_limits<double>::lowest());
123 return std::isnan(_value);
136 _IssueGetValueOnDefaultError();
148 return !(lhs == rhs);
175 return !(lhs <= rhs);
180 return TfHash()(time._value);
185 void _IssueGetValueOnDefaultError()
const;
195std::istream& operator>>(std::istream& is,
UsdTimeCode& time);
198PXR_NAMESPACE_CLOSE_SCOPE
Value type that represents a time code.
A user-extensible hashing mechanism for use with runtime hash tables.
Represent a time value, which may be either numeric, holding a double value, or a sentinel value UsdT...
friend size_t hash_value(const UsdTimeCode &time)
Hash function.
constexpr UsdTimeCode(const SdfTimeCode &timeCode) noexcept
Construct and implicitly cast from SdfTimeCode.
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],...
friend bool operator<=(const UsdTimeCode &lhs, const UsdTimeCode &rhs)
Less-equal.
static constexpr UsdTimeCode EarliestTime()
Produce a UsdTimeCode representing the lowest/earliest possible timeCode.
friend bool operator==(const UsdTimeCode &lhs, const UsdTimeCode &rhs)
Equality comparison.
friend bool operator>=(const UsdTimeCode &lhs, const UsdTimeCode &rhs)
Greater-equal.
static constexpr UsdTimeCode Default()
Produce a UsdTimeCode representing the sentinel value for 'default'.
friend bool operator<(const UsdTimeCode &lhs, const UsdTimeCode &rhs)
Less-than.
friend bool operator>(const UsdTimeCode &lhs, const UsdTimeCode &rhs)
Greater-than.
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.
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.
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.
GF_API std::ostream & operator<<(std::ostream &, const GfBBox3d &)
Output a GfBBox3d using the format [(range) matrix zeroArea].
This file defines some macros that are useful for declaring and using static TfTokens.
#define TF_DECLARE_PUBLIC_TOKENS(...)
Macro to define public tokens.