7#ifndef PXR_BASE_GF_TIME_CODE_H
8#define PXR_BASE_GF_TIME_CODE_H
13#include "pxr/base/gf/api.h"
20PXR_NAMESPACE_OPEN_SCOPE
55 constexpr bool operator==(
const GfTimeCode &rhs)
const noexcept
56 {
return _time == rhs._time; }
57 constexpr bool operator!=(
const GfTimeCode &rhs)
const noexcept
58 {
return _time != rhs._time; }
59 constexpr bool operator<(
const GfTimeCode &rhs)
const noexcept
60 {
return _time < rhs._time; }
61 constexpr bool operator>(
const GfTimeCode &rhs)
const noexcept
62 {
return _time > rhs._time; }
63 constexpr bool operator<=(
const GfTimeCode &rhs)
const noexcept
64 {
return _time <= rhs._time; }
65 constexpr bool operator>=(
const GfTimeCode &rhs)
const noexcept
66 {
return _time >= rhs._time; }
72 const double amount)
noexcept
80 const double amount)
noexcept
87 {
return _time / rhs._time; }
106 {
return GfTimeCode(lhs._time + rhs.GetValue()); }
111 {
return GfTimeCode(lhs.GetValue() + rhs._time); }
115 const double rhs)
noexcept
127 {
return GfTimeCode(lhs._time - rhs.GetValue()); }
132 {
return GfTimeCode(lhs.GetValue() - rhs._time); }
136 const double rhs)
noexcept
149 explicit constexpr operator double() const noexcept {
return _time;}
161 return std::hash<double>()(_time);
167 size_t operator()(
const GfTimeCode &ap)
const {
175 template <
class HashState>
196 std::swap(lhs._time, rhs._time);
207bool operator==(
double time,
const GfTimeCode &timeCode)
noexcept
211bool operator!=(
double time,
const GfTimeCode &timeCode)
noexcept
215bool operator<(
double time,
const GfTimeCode &timeCode)
noexcept
219bool operator>(
double time,
const GfTimeCode &timeCode)
noexcept
223bool operator<=(
double time,
const GfTimeCode &timeCode)
noexcept
227bool operator>=(
double time,
const GfTimeCode &timeCode)
noexcept
236PXR_NAMESPACE_CLOSE_SCOPE
GF_API std::ostream & operator<<(std::ostream &out, const GfTimeCode &ap)
Stream insertion operator for the string representation of this time code.
Value type that represents a duration measured in time codes.
Value type that represents a time code.
friend constexpr GfTimeCode operator-(const GfTimeCode &lhs, const GfDuration &rhs) noexcept
Offset a time code value.
constexpr double GetValue() const noexcept
Return the time value.
constexpr double operator/(const GfTimeCode &rhs) const noexcept
Ratio of two time codes is a unitless double scale factor.
friend constexpr GfTimeCode operator-(const GfTimeCode &lhs, const double rhs) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
friend void TfHashAppend(HashState &h, const GfTimeCode &t)
Enable TfHash for GfTimeCode.
friend constexpr GfTimeCode operator-(const GfDuration &lhs, const GfTimeCode &rhs) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
friend constexpr GfTimeCode operator*(const GfTimeCode &t, const double amount) noexcept
Scale time code values by doubles.
constexpr GfTimeCode(GfDuration duration) noexcept
Explicitly construct a time code from a duration.
friend constexpr GfTimeCode operator+(const GfTimeCode &lhs, const double rhs) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
constexpr GfTimeCode operator-() const noexcept
Negate a time code. Equivalent to scaling by -1.
friend constexpr GfTimeCode operator+(const GfTimeCode &lhs, const GfDuration &rhs) noexcept
Offset a time code value.
size_t GetHash() const
Hash function.
friend constexpr GfTimeCode operator+(const GfTimeCode &lhs, const GfTimeCode &rhs) noexcept
Sum time codes.
friend constexpr GfTimeCode operator+(const double lhs, const GfTimeCode &rhs) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
constexpr GfDuration operator-(const GfTimeCode &rhs) const noexcept
Compute a GfDuration offset between two time codes.
friend constexpr GfTimeCode operator+(const GfDuration &lhs, const GfTimeCode &rhs) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
friend constexpr GfTimeCode operator-(const double lhs, const GfTimeCode &rhs) noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
constexpr GfTimeCode(double time=0.0) noexcept
Construct a time code with the given time.