![]() |
|
A builder type that produces instances of VtArrayEdit representing sequences of array edit operations. More...
#include <arrayEditBuilder.h>
Public Types | |
| using | Ops = Vt_ArrayEditOps |
| using | Edit = VtArrayEdit< ELEM > |
| using | Array = typename Edit::Array |
| using | ElementType = typename Edit::ElementType |
| using | Self = VtArrayEditBuilder |
Public Member Functions | |
| VtArrayEditBuilder ()=default | |
| Default construct a builder with no instructions. | |
| Self & | Write (ElementType const &elem, int64_t index) |
Add an instruction that writes elem to index. | |
| Self & | WriteRef (int64_t srcIndex, int64_t dstIndex) |
Add an instruction that writes the element at srcIndex to dstIndex. | |
| Self & | Insert (ElementType const &elem, int64_t index) |
Add an instruction that inserts elem at index. | |
| Self & | InsertRef (int64_t srcIndex, int64_t dstIndex) |
Add an instruction that inserts a copy of the element at srcIndex at dstIndex. | |
| Self & | Prepend (ElementType const &elem) |
| Equivalent to Insert(elem, 0) | |
| Self & | PrependRef (int64_t srcIndex) |
| Equivalent to InsertRef(srcIndex, 0) | |
| Self & | Append (ElementType const &elem) |
| Equivalent to Insert(elem, EndIndex) | |
| Self & | AppendRef (int64_t srcIndex) |
| Equivalent to InsertRef(srcIndex, EndIndex) | |
| Self & | EraseRef (int64_t index) |
Add an instruction that erases the element at index. | |
| Self & | MinSize (int64_t size) |
Add an instruction that, if the array's size is less than size, appends value-initialized elements to the array until it has size. | |
| Self & | MinSize (int64_t size, ElementType const &fill) |
Add an instruction that, if the array's size is less than size, appends copies of fill to the array until it has size. | |
| Self & | MaxSize (int64_t size) |
Add an instruction that, if the array's size is greater than size erases trailing elements until it has size. | |
| Self & | SetSize (int64_t size) |
Add an instruction that, if the array's size is not equal to size, then items are either appended or erased as in MinSize() and MaxSize() until the array has size size. | |
| Self & | SetSize (int64_t size, ElementType const &fill) |
Add an instruction that, if the array's size is not equal to size, then items are either appended or erased as in MinSize() and MaxSize() until the array has size size. | |
| VtArrayEdit< ELEM > | FinalizeAndReset () |
| Return a VtArrayEdit that performs the edits as specified by prior calls to this class's other member functions, then clear this builder's state, leaving it as if it was default constructed. | |
Static Public Member Functions | |
| static VtArrayEdit< ELEM > | Optimize (VtArrayEdit< ELEM > &&in) |
| Given a VtArrayEdit that may have been composed from several, attempt to produce a smaller, optimized edit that acts identically. | |
| static void | GetSerializationData (VtArrayEdit< ELEM > const &edit, VtArray< ELEM > *valuesOut, std::vector< int64_t > *indexesOut) |
| static VtArrayEdit< ELEM > | CreateFromSerializationData (VtArray< ELEM > const &values, TfSpan< int64_t > indexes) |
Static Public Attributes | |
| static constexpr auto | EndIndex = Vt_ArrayEditOps::EndIndex |
| A special index value meaning one-past-the-end of the array, for use in Insert() instructions. | |
A builder type that produces instances of VtArrayEdit representing sequences of array edit operations.
Callers will typically construct a builder and invoke its member functions, like Write(), Insert(), Erase() repeatedly, then call FinalizeAndReset() to produce a VtArrayEdit representing the sequence of operations.
Definition at line 65 of file arrayEditBuilder.h.
| using Array = typename Edit::Array |
Definition at line 70 of file arrayEditBuilder.h.
| using Edit = VtArrayEdit<ELEM> |
Definition at line 69 of file arrayEditBuilder.h.
| using ElementType = typename Edit::ElementType |
Definition at line 71 of file arrayEditBuilder.h.
| using Ops = Vt_ArrayEditOps |
Definition at line 68 of file arrayEditBuilder.h.
| using Self = VtArrayEditBuilder |
Definition at line 72 of file arrayEditBuilder.h.
|
default |
Default construct a builder with no instructions.
|
inline |
Equivalent to Insert(elem, EndIndex)
Definition at line 133 of file arrayEditBuilder.h.
|
inline |
Equivalent to InsertRef(srcIndex, EndIndex)
Definition at line 140 of file arrayEditBuilder.h.
|
inlinestatic |
Definition at line 229 of file arrayEditBuilder.h.
|
inline |
Add an instruction that erases the element at index.
The index may be negative in which case the array index is computed by adding to the array size to produce a final index. When applied, if index is out-of-bounds, this instruction is ignored.
Definition at line 149 of file arrayEditBuilder.h.
|
inline |
Return a VtArrayEdit that performs the edits as specified by prior calls to this class's other member functions, then clear this builder's state, leaving it as if it was default constructed.
Definition at line 195 of file arrayEditBuilder.h.
|
inlinestatic |
Definition at line 214 of file arrayEditBuilder.h.
|
inline |
Add an instruction that inserts elem at index.
The index may be negative in which case the array index is computed by adding to the array size to produce a final index. The index may also be EndIndex, which indicates insertion at the end. When applied, if index is out-of-bounds and not EndIndex, this instruction is ignored.
Definition at line 104 of file arrayEditBuilder.h.
|
inline |
Add an instruction that inserts a copy of the element at srcIndex at dstIndex.
The indexes may be negative in which case the array indexes are computed by adding to the array size to produce the final indexes. The dstIndex may also be EndIndex, which indicates insertion at the end. When applied, if srcIndex is out-of-bounds or dstIndex is out of bounds and not EndIndex, this instruction is ignored.
Definition at line 115 of file arrayEditBuilder.h.
|
inline |
Add an instruction that, if the array's size is greater than size erases trailing elements until it has size.
Definition at line 170 of file arrayEditBuilder.h.
|
inline |
Add an instruction that, if the array's size is less than size, appends value-initialized elements to the array until it has size.
Definition at line 156 of file arrayEditBuilder.h.
|
inline |
Add an instruction that, if the array's size is less than size, appends copies of fill to the array until it has size.
Definition at line 163 of file arrayEditBuilder.h.
|
static |
Given a VtArrayEdit that may have been composed from several, attempt to produce a smaller, optimized edit that acts identically.
If in is the identity, return it unmodified.
Definition at line 254 of file arrayEditBuilder.h.
|
inline |
Equivalent to Insert(elem, 0)
Definition at line 121 of file arrayEditBuilder.h.
|
inline |
Equivalent to InsertRef(srcIndex, 0)
Definition at line 127 of file arrayEditBuilder.h.
|
inline |
Add an instruction that, if the array's size is not equal to size, then items are either appended or erased as in MinSize() and MaxSize() until the array has size size.
Definition at line 178 of file arrayEditBuilder.h.
|
inline |
Add an instruction that, if the array's size is not equal to size, then items are either appended or erased as in MinSize() and MaxSize() until the array has size size.
If items are appended they are copies of fill.
Definition at line 187 of file arrayEditBuilder.h.
|
inline |
Add an instruction that writes elem to index.
The index may be negative in which case the array index is computed by adding to the array size to produce a final index. When applied, if index is out-of-bounds, this instruction is ignored.
Definition at line 85 of file arrayEditBuilder.h.
|
inline |
Add an instruction that writes the element at srcIndex to dstIndex.
These indexes may be negative in which case the array indexes are computed by adding to the array size to produce final indexes. When applied, if index is out-of-bounds, this instruction is ignored.
Definition at line 94 of file arrayEditBuilder.h.
|
staticconstexpr |
A special index value meaning one-past-the-end of the array, for use in Insert() instructions.
Definition at line 76 of file arrayEditBuilder.h.