Loading...
Searching...
No Matches
PcpMapExpression Class Reference

An expression that yields a PcpMapFunction value. More...

#include <mapExpression.h>

Classes

class  Variable
 A Variable is a mutable memory cell that holds a value. More...
 

Public Types

typedef PcpMapFunction Value
 The value type of PcpMapExpression is a PcpMapFunction.
 

Public Member Functions

PCP_API const ValueEvaluate () const
 Evaluate this expression, yielding a PcpMapFunction value.
 
 PcpMapExpression () noexcept=default
 Default-construct a NULL expression.
 
void Swap (PcpMapExpression &other) noexcept
 Swap this expression with the other.
 
bool IsNull () const noexcept
 Return true if this is a null expression.
 
Convenience API

The following API just forwards through to the underlying evaluated mapfunction value.

bool IsIdentity () const
 Return true if the evaluated map function is the identity function.
 
SdfPath MapSourceToTarget (const SdfPath &path) const
 Map a path in the source namespace to the target.
 
SdfPath MapTargetToSource (const SdfPath &path) const
 Map a path in the target namespace to the source.
 
const SdfLayerOffsetGetTimeOffset () const
 The time offset of the mapping.
 
std::string GetString () const
 Returns a string representation of this mapping for debugging purposes.
 

Friends

PCP_API void intrusive_ptr_add_ref (_Node *)
 
PCP_API void intrusive_ptr_release (_Node *)
 

Creating expressions

typedef std::unique_ptr< VariableVariableUniquePtr
 Variables are held by reference.
 
PCP_API PcpMapExpression Compose (const PcpMapExpression &f) const
 Create a new PcpMapExpression representing the application of f's value, followed by the application of this expression's value.
 
PCP_API PcpMapExpression Inverse () const
 Create a new PcpMapExpression representing the inverse of f.
 
PCP_API PcpMapExpression AddRootIdentity () const
 Return a new expression representing this expression with an added (if necessary) mapping from </> to </>.
 
bool IsConstantIdentity () const
 Return true if the map function is the constant identity function.
 
static PCP_API PcpMapExpression Identity ()
 Return an expression representing PcpMapFunction::Identity().
 
static PCP_API PcpMapExpression Constant (const Value &constValue)
 Create a new constant.
 
static PCP_API VariableUniquePtr NewVariable (Value &&initialValue)
 Create a new variable.
 

Detailed Description

An expression that yields a PcpMapFunction value.

Expressions comprise constant values, variables, and operators applied to sub-expressions. Expressions cache their computed values internally. Assigning a new value to a variable automatically invalidates the cached values of dependent expressions. Common (sub-)expressions are automatically detected and shared.

PcpMapExpression exists solely to support efficient incremental handling of relocates edits. It represents a tree of the namespace mapping operations and their inputs, so we can narrowly redo the computation when one of the inputs changes.

Definition at line 56 of file mapExpression.h.

Member Typedef Documentation

◆ Value

The value type of PcpMapExpression is a PcpMapFunction.

Definition at line 60 of file mapExpression.h.

◆ VariableUniquePtr

typedef std::unique_ptr<Variable> VariableUniquePtr

Variables are held by reference.

Definition at line 113 of file mapExpression.h.

Constructor & Destructor Documentation

◆ PcpMapExpression()

PcpMapExpression ( )
defaultnoexcept

Default-construct a NULL expression.

Member Function Documentation

◆ AddRootIdentity()

PCP_API PcpMapExpression AddRootIdentity ( ) const

Return a new expression representing this expression with an added (if necessary) mapping from </> to </>.

◆ Compose()

PCP_API PcpMapExpression Compose ( const PcpMapExpression f) const

Create a new PcpMapExpression representing the application of f's value, followed by the application of this expression's value.

◆ Constant()

static PCP_API PcpMapExpression Constant ( const Value constValue)
static

Create a new constant.

◆ Evaluate()

PCP_API const Value & Evaluate ( ) const

Evaluate this expression, yielding a PcpMapFunction value.

The computed result is cached. The return value is a reference to the internal cached value. The cache is automatically invalidated as needed.

◆ GetString()

std::string GetString ( ) const
inline

Returns a string representation of this mapping for debugging purposes.

Definition at line 176 of file mapExpression.h.

◆ GetTimeOffset()

const SdfLayerOffset & GetTimeOffset ( ) const
inline

The time offset of the mapping.

Definition at line 170 of file mapExpression.h.

◆ Identity()

static PCP_API PcpMapExpression Identity ( )
static

Return an expression representing PcpMapFunction::Identity().

◆ Inverse()

PCP_API PcpMapExpression Inverse ( ) const

Create a new PcpMapExpression representing the inverse of f.

◆ IsConstantIdentity()

bool IsConstantIdentity ( ) const
inline

Return true if the map function is the constant identity function.

Definition at line 139 of file mapExpression.h.

◆ IsIdentity()

bool IsIdentity ( ) const
inline

Return true if the evaluated map function is the identity function.

For identity, MapSourceToTarget() always returns the path unchanged.

Definition at line 153 of file mapExpression.h.

◆ IsNull()

bool IsNull ( ) const
inlinenoexcept

Return true if this is a null expression.

Definition at line 78 of file mapExpression.h.

◆ MapSourceToTarget()

SdfPath MapSourceToTarget ( const SdfPath path) const
inline

Map a path in the source namespace to the target.

If the path is not in the domain, returns an empty path.

Definition at line 159 of file mapExpression.h.

◆ MapTargetToSource()

SdfPath MapTargetToSource ( const SdfPath path) const
inline

Map a path in the target namespace to the source.

If the path is not in the co-domain, returns an empty path.

Definition at line 165 of file mapExpression.h.

◆ NewVariable()

static PCP_API VariableUniquePtr NewVariable ( Value &&  initialValue)
static

Create a new variable.

The client is expected to retain the reference for as long as it wishes to continue being able to set the value of the variable. After the reference is dropped, expressions using the variable will continue to be valid, but there will be no way to further change the value of the variable.

◆ Swap()

void Swap ( PcpMapExpression other)
inlinenoexcept

Swap this expression with the other.

Definition at line 73 of file mapExpression.h.


The documentation for this class was generated from the following file: