7#ifndef PXR_EXEC_VDF_BOXED_CONTAINER_H
8#define PXR_EXEC_VDF_BOXED_CONTAINER_H
12#include "pxr/exec/vdf/boxedContainerTraits.h"
16PXR_NAMESPACE_OPEN_SCOPE
40 : _ranges(1,
Range{0, n})
46 return _ranges.size();
59 _ranges.push_back(
Range{begin, end});
64 lhs._ranges.swap(rhs._ranges);
87 !Vdf_IsBoxedContainer<T>,
"Recursive boxing is not allowed");
95 static const TfSmallVectorBase::size_type N =
96 TfSmallVectorBase::ComputeSerendipitousLocalCapacity<T>();
116 return _data == rhs._data;
128 return _data.
empty();
176 template<
typename Iterator>
181 lhs._data.
swap(rhs._data);
182 swap(lhs._ranges, rhs._ranges);
199template<
typename Iterator>
202 const unsigned int previousSize = _data.size();
203 _data.insert(_data.end(), begin, end);
204 _ranges.AppendRange(previousSize, _data.size());
207PXR_NAMESPACE_CLOSE_SCOPE
This is a small-vector class with local storage optimization, the local storage can be specified via ...
void reserve(size_type newCapacity)
Reserve storage for newCapacity entries.
size_type size() const
Returns the current size of the vector.
bool empty() const
Returns true if this vector is empty.
void swap(TfSmallVector &rhs)
Swap two vector instances.
value_type * data()
Direct access to the underlying array.
This simple container stores multiple values that flow through the network as a single data flow elem...
size_t size() const
Returns the number of elements stored in this container.
const T * data() const
Returns a pointer to the immutable data elements.
bool operator!=(const Vdf_BoxedContainer &rhs) const
Returns true if rhs does not compare equal with this container.
bool empty() const
Returns true if the container does not hold any elements.
bool operator==(const Vdf_BoxedContainer &rhs) const
Returns true if rhs compares equal with this container.
T & operator[](unsigned int i)
Returns the mutable value stored at index i.
void AppendRange(Iterator begin, Iterator end)
Appends the data elements [ begin, end ) to the end of the container, and adds a new group containing...
const Vdf_BoxedRanges & GetRanges() const
Returns the subranges of boxed data.
Vdf_BoxedContainer()=default
Constructs an empty container with no elements and no ranges.
const T & operator[](unsigned int i) const
Returns the immutable value stored at index i.
Vdf_BoxedContainer(unsigned int n)
Constructs a container with n elements and one range containing all elements.
T * data()
Returns a pointer to the mutable data elements.
void reserve(unsigned int n)
Reserves storage for n elements in this container.
Each range represents a logical group of elements stored in a Vdf_BoxedContainer.
void AppendRange(unsigned int begin, unsigned int end)
Appends a new group.
Range GetRange(unsigned int i) const
Returns the range at index i.
Vdf_BoxedRanges()=default
Constructs an empty set of boxed ranges.
Vdf_BoxedRanges(unsigned int n)
Constructs a set with one range containing all n elements.
unsigned int GetNumRanges() const
Returns the number of individual ranges stored in this container.
A range of data elements as denoted by [ begin, end ) indices.