Loading...
Searching...
No Matches
VtArrayEdit< ELEM > Class Template Reference

An array edit represents a sequence of per-element modifications to a VtArray. More...

#include <arrayEdit.h>

Public Types

using Array = VtArray< ELEM >
 Shorthand for the corresponding VtArray type.
 
using ElementType = typename Array::ElementType
 

Public Member Functions

 VtArrayEdit ()=default
 Construct an identity array edit that performs no edits.
 
bool IsIdentity () const
 Return true if this edit is the identity edit.
 
TfSpan< const ElementType > GetLiterals () const
 Return a view of the literal elements that this edit makes use of.
 
TfSpan< ElementType > GetMutableLiterals ()
 Return a mutable view of the literal elements that this edit makes use of.
 
VtArrayEdit ComposeOver (VtArrayEdit const &weaker) &&
 Compose this edit over weaker and return a new result representing the function composition, where weaker is the "inner" function and *this is the "outer" function.
 
VtArrayEdit ComposeOver (VtArrayEdit &&weaker) &&
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
VtArrayEdit ComposeOver (VtArrayEdit const &weaker) const &
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
VtArrayEdit ComposeOver (VtArrayEdit &&weaker) const &
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
Array ComposeOver (Array const &weaker) const
 Apply the edits in *this to weaker and return the resulting array.
 
Array ComposeOver (Array &&weaker) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<class UnaryOp >
std::ostream & StreamCustom (std::ostream &out, UnaryOp &&unaryOp) const
 Insert self to the stream out, but call unaryOp on each contained value-type element and pass the result to VtStreamOut().
 

Friends

class VtArrayEditBuilder< ELEM >
 
bool operator== (VtArrayEdit const &x, VtArrayEdit const &y)
 Equality comparison.
 
bool operator!= (VtArrayEdit const &x, VtArrayEdit const &y)
 Inequality comparison.
 
std::ostream & operator<< (std::ostream &out, const VtArrayEdit self)
 Insert self to the stream out using the following format:
 

Detailed Description

template<class ELEM>
class VtArrayEdit< ELEM >

An array edit represents a sequence of per-element modifications to a VtArray.

The member function ComposeOver(strong, weak) applies strong's edits to weak and returns the resulting VtArray or VtArrayEdit, depending on whether weak is a VtArray or VtArrayEdit.

VtArrayEdit under ComposeOver() forms an algebraic "monoid". That is, ComposeOver() is associative, where the default-constructed VtArrayEdit (which represents no edits) is the identity element.

See the associated VtArrayEditBuilder class to understand the available edit operations, and to build a VtArrayEdit from them.

Definition at line 51 of file arrayEdit.h.

Member Typedef Documentation

◆ Array

using Array = VtArray<ELEM>

Shorthand for the corresponding VtArray type.

Definition at line 55 of file arrayEdit.h.

◆ ElementType

using ElementType = typename Array::ElementType

Definition at line 57 of file arrayEdit.h.

Constructor & Destructor Documentation

◆ VtArrayEdit()

VtArrayEdit ( )
default

Construct an identity array edit that performs no edits.

ComposeOver() with an identity returns the other argument.

Member Function Documentation

◆ ComposeOver() [1/6]

Array ComposeOver ( Array &&  weaker) const
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 136 of file arrayEdit.h.

◆ ComposeOver() [2/6]

Array ComposeOver ( Array const &  weaker) const
inline

Apply the edits in *this to weaker and return the resulting array.

Definition at line 128 of file arrayEdit.h.

◆ ComposeOver() [3/6]

VtArrayEdit ComposeOver ( VtArrayEdit< ELEM > &&  weaker) &&
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 104 of file arrayEdit.h.

◆ ComposeOver() [4/6]

VtArrayEdit ComposeOver ( VtArrayEdit< ELEM > &&  weaker) const &
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 120 of file arrayEdit.h.

◆ ComposeOver() [5/6]

VtArrayEdit ComposeOver ( VtArrayEdit< ELEM > const &  weaker) &&
inline

Compose this edit over weaker and return a new result representing the function composition, where weaker is the "inner" function and *this is the "outer" function.

In other words, return an edit that represents the action of the edits in weaker followed by those in *this.

Definition at line 96 of file arrayEdit.h.

◆ ComposeOver() [6/6]

VtArrayEdit ComposeOver ( VtArrayEdit< ELEM > const &  weaker) const &
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 112 of file arrayEdit.h.

◆ GetLiterals()

TfSpan< const ElementType > GetLiterals ( ) const
inline

Return a view of the literal elements that this edit makes use of.

Definition at line 80 of file arrayEdit.h.

◆ GetMutableLiterals()

TfSpan< ElementType > GetMutableLiterals ( )
inline

Return a mutable view of the literal elements that this edit makes use of.

This can be useful in case elements need to be transformed or translated.

Definition at line 87 of file arrayEdit.h.

◆ IsIdentity()

bool IsIdentity ( ) const
inline

Return true if this edit is the identity edit.

The identity edit performs no edits. Composing the identity with another edit returns that edit unmodified.

Definition at line 75 of file arrayEdit.h.

◆ StreamCustom()

std::ostream & StreamCustom ( std::ostream &  out,
UnaryOp &&  unaryOp 
) const
inline

Insert self to the stream out, but call unaryOp on each contained value-type element and pass the result to VtStreamOut().

An example where this is useful is when the element-type is string and the destination format requires quoting. For more details on the overall output format, see the regular stream insertion operator.

Definition at line 185 of file arrayEdit.h.

Friends And Related Function Documentation

◆ operator!=

bool operator!= ( VtArrayEdit< ELEM > const &  x,
VtArrayEdit< ELEM > const &  y 
)
friend

Inequality comparison.

Definition at line 68 of file arrayEdit.h.

◆ operator<<

std::ostream & operator<< ( std::ostream &  out,
const VtArrayEdit< ELEM >  self 
)
friend

Insert self to the stream out using the following format:

edit [<op_1>; <op_2>; ... <op_N>]

Where each op is one of:

write <literal> to <index>
write <index> to <index>
insert <literal> at <index>
insert <index> at <index>
prepend <literal>
prepend <index>
append <literal>
append <index>
erase <index>
minsize N [fill <literal>]
resize N [fill <literal>]
maxsize N

An <index> is an integer enclosed in square brackets, and a <literal> is an element value serialized by VtStreamOut().

Definition at line 169 of file arrayEdit.h.

◆ operator==

bool operator== ( VtArrayEdit< ELEM > const &  x,
VtArrayEdit< ELEM > const &  y 
)
friend

Equality comparison.

Definition at line 64 of file arrayEdit.h.

◆ VtArrayEditBuilder< ELEM >

friend class VtArrayEditBuilder< ELEM >
friend

Definition at line 185 of file arrayEdit.h.


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