This document is for a version of USD that is under development. See this page for the current release.
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
layerOffset.h
Go to the documentation of this file.
1//
2// Copyright 2016 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7#ifndef PXR_USD_SDF_LAYER_OFFSET_H
8#define PXR_USD_SDF_LAYER_OFFSET_H
9
11
12#include "pxr/pxr.h"
13#include "pxr/usd/sdf/api.h"
14
15#include <iosfwd>
16#include <vector>
17
18PXR_NAMESPACE_OPEN_SCOPE
19
20class SdfTimeCode;
21
44{
45public:
48
50 SDF_API
51 explicit SdfLayerOffset(double offset = 0.0, double scale = 1.0);
52
54
57
59 double GetOffset() const { return _offset; }
60
62 double GetScale() const { return _scale; }
63
65 void SetOffset(double newOffset) { _offset = newOffset; }
66
68 void SetScale(double newScale) { _scale = newScale; }
69
72 SDF_API
73 bool IsIdentity() const;
74
78 SDF_API
79 bool IsValid() const;
80
82 SDF_API
84
87
89 SDF_API
90 size_t GetHash() const;
91
93 struct Hash {
94 size_t operator()(const SdfLayerOffset &offset) const {
95 return offset.GetHash();
96 }
97 };
98
99 friend inline size_t hash_value(const SdfLayerOffset &offset) {
100 return offset.GetHash();
101 }
102
104
107
109 SDF_API
110 bool operator==(const SdfLayerOffset &rhs) const;
111
113 bool operator!=(const SdfLayerOffset &rhs) const {
114 return !(*this == rhs);
115 }
116
119 SDF_API
120 bool operator<(const SdfLayerOffset &rhs) const;
121
123 bool operator>(const SdfLayerOffset& rhs) const {
124 return rhs < *this;
125 }
126
128 bool operator>=(const SdfLayerOffset& rhs) const {
129 return !(*this < rhs);
130 }
131
133 bool operator<=(const SdfLayerOffset& rhs) const {
134 return !(*this > rhs);
135 }
136
139 SDF_API
141
143 SDF_API
144 double operator*(double rhs) const;
145
147 SDF_API
149
151
152private:
153 double _offset;
154 double _scale;
155};
156
157typedef std::vector<SdfLayerOffset> SdfLayerOffsetVector;
158
161SDF_API
162std::ostream & operator<<( std::ostream &out,
163 const SdfLayerOffset &layerOffset );
164
165PXR_NAMESPACE_CLOSE_SCOPE
166
167#endif // PXR_USD_SDF_LAYER_OFFSET_H
Represents a time offset and scale between layers.
Definition: layerOffset.h:44
bool operator>(const SdfLayerOffset &rhs) const
Definition: layerOffset.h:123
double GetScale() const
Returns the time scale factor.
Definition: layerOffset.h:62
SDF_API SdfLayerOffset GetInverse() const
Gets the inverse offset, which performs the opposite transformation.
SDF_API bool IsValid() const
Returns true if this offset is valid, i.e.
bool operator>=(const SdfLayerOffset &rhs) const
Definition: layerOffset.h:128
bool operator!=(const SdfLayerOffset &rhs) const
Definition: layerOffset.h:113
SDF_API SdfLayerOffset operator*(const SdfLayerOffset &rhs) const
Composes this with the offset rhs, such that the resulting offset is equivalent to first applying rhs...
SDF_API bool operator==(const SdfLayerOffset &rhs) const
Returns whether the offsets are equal.
SDF_API bool operator<(const SdfLayerOffset &rhs) const
Returns whether this offset is less than another.
bool operator<=(const SdfLayerOffset &rhs) const
Definition: layerOffset.h:133
SDF_API SdfTimeCode operator*(const SdfTimeCode &rhs) const
Applies the offset to the given value.
SDF_API bool IsIdentity() const
Returns true if this is an identity transformation, with an offset of 0.0 and a scale of 1....
SDF_API SdfLayerOffset(double offset=0.0, double scale=1.0)
Constructs a new SdfLayerOffset instance.
void SetOffset(double newOffset)
Sets the time offset.
Definition: layerOffset.h:65
double GetOffset() const
Returns the time offset.
Definition: layerOffset.h:59
SDF_API double operator*(double rhs) const
Applies the offset to the given value.
void SetScale(double newScale)
Sets the time scale factor.
Definition: layerOffset.h:68
SDF_API size_t GetHash() const
Returns hash for this offset.
Value type that represents a time code.
Definition: timeCode.h:28
GF_API std::ostream & operator<<(std::ostream &, const GfBBox3d &)
Output a GfBBox3d using the format [(range) matrix zeroArea].
Hash functor for hash maps and sets.
Definition: layerOffset.h:93