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.
 
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 50 of file arrayEdit.h.

Member Typedef Documentation

◆ Array

using Array = VtArray<ELEM>

Shorthand for the corresponding VtArray type.

Definition at line 54 of file arrayEdit.h.

◆ ElementType

using ElementType = typename Array::ElementType

Definition at line 56 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 123 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 115 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 91 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 107 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 83 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 99 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 74 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 172 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 67 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 156 of file arrayEdit.h.

◆ operator==

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

Equality comparison.

Definition at line 63 of file arrayEdit.h.

◆ VtArrayEditBuilder< ELEM >

friend class VtArrayEditBuilder< ELEM >
friend

Definition at line 172 of file arrayEdit.h.


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