All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PcpMapExpression Class Reference

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

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. More...
 

Public Member Functions

PCP_API const ValueEvaluate () const
 Evaluate this expression, yielding a PcpMapFunction value. More...
 
PCP_API PcpMapExpression ()
 Default-construct a NULL expression. More...
 
PCP_API void Swap (PcpMapExpression &other)
 Swap this expression with the other. More...
 
PCP_API bool IsNull () const
 Return true if this is a null expression. More...
 
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. More...
 
SdfPath MapSourceToTarget (const SdfPath &path) const
 Map a path in the source namespace to the target. More...
 
SdfPath MapTargetToSource (const SdfPath &path) const
 Map a path in the target namespace to the source. More...
 
const SdfLayerOffsetGetTimeOffset () const
 The time offset of the mapping. More...
 
std::string GetString () const
 Returns a string representation of this mapping for debugging purposes. More...
 

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. More...
 
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. More...
 
PCP_API PcpMapExpression Inverse () const
 Create a new PcpMapExpression representing the inverse of f. More...
 
PCP_API PcpMapExpression AddRootIdentity () const
 Return a new expression representing this expression with an added (if necessary) mapping from </> to </>. More...
 
bool IsConstantIdentity () const
 Return true if the map function is the constant identity function. More...
 
static PCP_API PcpMapExpression Identity ()
 Return an expression representing PcpMapFunction::Identity(). More...
 
static PCP_API PcpMapExpression Constant (const Value &constValue)
 Create a new constant. More...
 
static PCP_API VariableUniquePtr NewVariable (Value &&initialValue)
 Create a new variable. More...
 

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

The value type of PcpMapExpression is a PcpMapFunction.

Definition at line 60 of file mapExpression.h.

typedef std::unique_ptr<Variable> VariableUniquePtr

Variables are held by reference.

Definition at line 112 of file mapExpression.h.

Constructor & Destructor Documentation

PCP_API PcpMapExpression ( )

Default-construct a NULL expression.

Member Function Documentation

PCP_API PcpMapExpression AddRootIdentity ( ) const

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

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.

static PCP_API PcpMapExpression Constant ( const Value constValue)
static

Create a new constant.

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.

std::string GetString ( ) const
inline

Returns a string representation of this mapping for debugging purposes.

Definition at line 175 of file mapExpression.h.

const SdfLayerOffset& GetTimeOffset ( ) const
inline

The time offset of the mapping.

Definition at line 169 of file mapExpression.h.

static PCP_API PcpMapExpression Identity ( )
static

Return an expression representing PcpMapFunction::Identity().

PCP_API PcpMapExpression Inverse ( ) const

Create a new PcpMapExpression representing the inverse of f.

bool IsConstantIdentity ( ) const
inline

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

Definition at line 138 of file mapExpression.h.

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 152 of file mapExpression.h.

PCP_API bool IsNull ( ) const

Return true if this is a null expression.

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 158 of file mapExpression.h.

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 164 of file mapExpression.h.

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.

PCP_API void Swap ( PcpMapExpression other)

Swap this expression with the other.


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