24 #ifndef PXR_USD_PCP_MAP_EXPRESSION_H
25 #define PXR_USD_PCP_MAP_EXPRESSION_H
31 #include <hboost/intrusive_ptr.hpp>
33 #include <tbb/atomic.h>
34 #include <tbb/spin_mutex.h>
74 _node.swap(other._node);
140 return _node && _node->key.op == _OpConstant &&
141 _node->key.valueForConstant.IsIdentity();
188 typedef hboost::intrusive_ptr<_Node> _NodeRefPtr;
202 _Node(
const _Node&) =
delete;
213 const _NodeRefPtr & arg1_,
214 const _NodeRefPtr & arg2_,
215 const Value & valueForConstant_ )
230 const bool expressionTreeAlwaysHasIdentity;
235 const _NodeRefPtr & arg1 = _NodeRefPtr(),
236 const _NodeRefPtr & arg2 = _NodeRefPtr(),
241 const Value & EvaluateAndCache()
const;
244 void SetValueForVariable(
Value &&newValue);
247 const Value & GetValueForVariable()
const {
248 return _valueForVariable;
252 explicit _Node(
const Key &key_ );
254 Value _EvaluateUncached()
const;
258 static bool _ExpressionTreeAlwaysHasIdentity(
const Key& key);
270 mutable tbb::atomic<int> _refCount;
271 mutable Value _cachedValue;
272 mutable std::set<_Node*> _dependentExpressions;
273 Value _valueForVariable;
274 mutable tbb::spin_mutex _mutex;
275 mutable std::atomic<bool> _hasCachedValue;
287 #endif // PXR_USD_PCP_MAP_EXPRESSION_H
Key(_Op op_, const _NodeRefPtr &arg1_, const _NodeRefPtr &arg2_, const Value &valueForConstant_)
PcpMapFunction Value
The value type of PcpMapExpression is a PcpMapFunction.
friend struct Pcp_VariableImpl
static PCP_API VariableUniquePtr NewVariable(Value &&initialValue)
bool IsConstantIdentity() const
Return true if the map function is the constant identity function.
PCP_API bool IsIdentity() const
static PCP_API PcpMapExpression Identity()
Return an expression representing PcpMapFunction::Identity().
PCP_API PcpMapExpression Compose(const PcpMapExpression &f) const
GLsizei const GLchar *const * string
GLsizei const GLchar *const * path
PCP_API SdfPath MapSourceToTarget(const SdfPath &path) const
PCP_API PcpMapExpression AddRootIdentity() const
virtual const Value & GetValue() const =0
Return the current value.
friend PCP_API void intrusive_ptr_add_ref(_Node *)
const SdfLayerOffset & GetTimeOffset() const
The time offset of the mapping.
virtual PcpMapExpression GetExpression() const =0
SdfPath MapTargetToSource(const SdfPath &path) const
std::string GetString() const
const SdfLayerOffset & GetTimeOffset() const
The time offset of the mapping.
A generic, discriminated value, whose type may be queried dynamically.
SdfPath MapSourceToTarget(const SdfPath &path) const
virtual void SetValue(Value &&value)=0
std::unique_ptr< Variable > VariableUniquePtr
Variables are held by reference.
PCP_API const Value & Evaluate() const
bool operator==(const Key &key) const
PCP_API PcpMapExpression Inverse() const
Create a new PcpMapExpression representing the inverse of f.
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
LeafData & operator=(const LeafData &)=delete
#define PXR_NAMESPACE_CLOSE_SCOPE
friend PCP_API void intrusive_ptr_release(_Node *)
bool IsNull() const noexcept
Return true if this is a null expression.
PcpMapExpression() noexcept=default
Default-construct a NULL expression.
PCP_API std::string GetString() const
PCP_API SdfPath MapTargetToSource(const SdfPath &path) const
const Value valueForConstant
static PCP_API PcpMapExpression Constant(const Value &constValue)
Create a new constant.
friend class Pcp_Statistics
void Swap(PcpMapExpression &other) noexcept
Swap this expression with the other.