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

A function that maps values from one namespace (and time domain) to another. More...

Public Types

typedef std::map< SdfPath,
SdfPath, SdfPath::FastLessThan > 
PathMap
 A mapping from path to path. More...
 
typedef std::pair< SdfPath,
SdfPath
PathPair
 
typedef std::vector< PathPair > PathPairVector
 

Public Member Functions

 PcpMapFunction ()=default
 Construct a null function. More...
 
PCP_API void Swap (PcpMapFunction &map)
 Swap the contents of this map function with map. More...
 
void swap (PcpMapFunction &map)
 
PCP_API bool operator== (const PcpMapFunction &map) const
 Equality. More...
 
PCP_API bool operator!= (const PcpMapFunction &map) const
 Inequality. More...
 
PCP_API bool IsNull () const
 Return true if this map function is the null function. More...
 
PCP_API bool IsIdentity () const
 Return true if the map function is the identity function. More...
 
bool HasRootIdentity () const
 Return true if the map function maps the absolute root path to the absolute root path, false otherwise. More...
 
PCP_API SdfPath MapSourceToTarget (const SdfPath &path) const
 Map a path in the source namespace to the target. More...
 
PCP_API SdfPath MapTargetToSource (const SdfPath &path) const
 Map a path in the target namespace to the source. More...
 
PCP_API PcpMapFunction Compose (const PcpMapFunction &f) const
 Compose this map over the given map function. More...
 
PCP_API PcpMapFunction ComposeOffset (const SdfLayerOffset &newOffset) const
 Compose this map function over a hypothetical map function that has an identity path mapping and offset. More...
 
PCP_API PcpMapFunction GetInverse () const
 Return the inverse of this map function. More...
 
PCP_API PathMap GetSourceToTargetMap () const
 The set of path mappings, from source to target. More...
 
const SdfLayerOffsetGetTimeOffset () const
 The time offset of the mapping. More...
 
PCP_API std::string GetString () const
 Returns a string representation of this mapping for debugging purposes. More...
 
PCP_API size_t Hash () const
 Return a size_t hash for this map function. More...
 

Static Public Member Functions

static PCP_API PcpMapFunction Create (const PathMap &sourceToTargetMap, const SdfLayerOffset &offset)
 Constructs a map function with the given arguments. More...
 
static PCP_API const
PcpMapFunction
Identity ()
 Construct an identity map function. More...
 
static PCP_API const PathMapIdentityPathMap ()
 Returns an identity path mapping. More...
 

Detailed Description

A function that maps values from one namespace (and time domain) to another.

It represents the transformation that an arc such as a reference arc applies as it incorporates values across the arc.

Take the example of a reference arc, where a source path </Model> is referenced as a target path, </Model_1>. The source path </Model> is the source of the opinions; the target path </Model_1> is where they are incorporated in the scene. Values in the model that refer to paths relative to </Model> must be transformed to be relative to </Model_1> instead. The PcpMapFunction for the arc provides this service.

Map functions have a specific domain, or set of values they can operate on. Any values outside the domain cannot be mapped. The domain precisely tracks what areas of namespace can be referred to across various forms of arcs.

Map functions can be chained to represent a series of map operations applied in sequence. The map function represent the cumulative effect as efficiently as possible. For example, in the case of a chained reference from </Model> to </Model> to </Model> to </Model_1>, this is effectively the same as a mapping directly from </Model> to </Model_1>. Representing the cumulative effect of arcs in this way is important for handling larger scenes efficiently.

Map functions can be inverted. Formally, map functions are bijections (one-to-one and onto), which ensures that they can be inverted. Put differently, no information is lost by applying a map function to set of values within its domain; they retain their distinct identities and can always be mapped back.

One analogy that may or may not be helpful: In the same way a geometric transform maps a model's points in its rest space into the world coordinates for a particular instance, a PcpMapFunction maps values about a referenced model into the composed scene for a particular instance of that model. But rather than translating and rotating points, the map function shifts the values in namespace (and time).

Definition at line 80 of file mapFunction.h.

Member Typedef Documentation

typedef std::map<SdfPath, SdfPath, SdfPath::FastLessThan> PathMap

A mapping from path to path.

Definition at line 84 of file mapFunction.h.

Constructor & Destructor Documentation

PcpMapFunction ( )
default

Construct a null function.

Member Function Documentation

PCP_API PcpMapFunction Compose ( const PcpMapFunction f) const

Compose this map over the given map function.

The result will represent the application of f followed by the application of this function.

PCP_API PcpMapFunction ComposeOffset ( const SdfLayerOffset newOffset) const

Compose this map function over a hypothetical map function that has an identity path mapping and offset.

This is equivalent to building such a map function and invoking Compose(), but is faster.

static PCP_API PcpMapFunction Create ( const PathMap sourceToTargetMap,
const SdfLayerOffset offset 
)
static

Constructs a map function with the given arguments.

Returns a null map function on error (see IsNull()).

Parameters
sourceToTargetMapThe map from source paths to target paths.
offsetThe time offset to apply from source to target.
PCP_API PcpMapFunction GetInverse ( ) const

Return the inverse of this map function.

This returns a true inverse inv: for any path p in this function's domain that it maps to p', inv(p') -> p.

PCP_API PathMap GetSourceToTargetMap ( ) const

The set of path mappings, from source to target.

PCP_API std::string GetString ( ) const

Returns a string representation of this mapping for debugging purposes.

const SdfLayerOffset& GetTimeOffset ( ) const
inline

The time offset of the mapping.

Definition at line 170 of file mapFunction.h.

PCP_API size_t Hash ( ) const

Return a size_t hash for this map function.

bool HasRootIdentity ( ) const
inline

Return true if the map function maps the absolute root path to the absolute root path, false otherwise.

Definition at line 135 of file mapFunction.h.

static PCP_API const PcpMapFunction& Identity ( )
static

Construct an identity map function.

static PCP_API const PathMap& IdentityPathMap ( )
static

Returns an identity path mapping.

PCP_API bool IsIdentity ( ) const

Return true if the map function is the identity function.

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

PCP_API bool IsNull ( ) const

Return true if this map function is the null function.

For a null function, MapSourceToTarget() always returns an empty path.

PCP_API SdfPath MapSourceToTarget ( const SdfPath path) const

Map a path in the source namespace to the target.

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

PCP_API SdfPath MapTargetToSource ( const SdfPath path) const

Map a path in the target namespace to the source.

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

PCP_API bool operator!= ( const PcpMapFunction map) const

Inequality.

PCP_API bool operator== ( const PcpMapFunction map) const

Equality.

PCP_API void Swap ( PcpMapFunction map)

Swap the contents of this map function with map.


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