7#ifndef PXR_EXEC_VDF_CONNECTOR_MAP_H
8#define PXR_EXEC_VDF_CONNECTOR_MAP_H
20PXR_NAMESPACE_OPEN_SCOPE
33template <
typename Connector>
37 using _Pair = std::pair<TfToken, Connector*>;
42 using mapped_type = Connector*;
43 using value_type = _Pair;
44 using pointer = _Pair*;
45 using reference = _Pair&;
46 using const_reference =
const _Pair&;
47 using size_type =
typename _Vector::size_type;
48 using difference_type =
typename _Vector::difference_type;
49 using iterator =
typename _Vector::const_iterator;
50 using reverse_iterator =
typename _Vector::const_reverse_iterator;
51 using const_iterator =
typename _Vector::const_iterator;
52 using const_reverse_iterator =
typename _Vector::const_reverse_iterator;
76 const_iterator
end()
const {
81 const_reverse_iterator
rbegin()
const {
86 const_reverse_iterator
rend()
const {
121 return _vec == x._vec;
125 return _vec != x._vec;
137 template <
typename... Args>
138 std::pair<const_iterator, bool>
147template <
typename Connector>
148typename VdfConnectorMap<Connector>::const_iterator
151 const const_iterator endIter = end();
152 for (const_iterator i = begin(); i != endIter; ++i) {
161template <
typename Connector>
162template <
typename... Args>
163std::pair<typename VdfConnectorMap<Connector>::const_iterator,
bool>
166 if (
const const_iterator i = find(k); i != end()) {
170 _vec.emplace_back(k,
new Connector(std::forward<Args>(args)...));
171 return {std::prev(end()),
true};
174template <
typename Connector>
178 for (
const auto &[_, connector] : _vec) {
184PXR_NAMESPACE_CLOSE_SCOPE
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.
Token for efficient comparison, assignment, and hashing of known strings.
Maps names to inputs or outputs (a.k.a.
const_reverse_iterator rend() const
Returns a const_reverse_iterator pointing to the end of the map.
friend void swap(VdfConnectorMap &lhs, VdfConnectorMap &rhs)
Swaps the contents of lhs and rhs.
const_iterator begin() const
Returns a const_iterator pointing to the beginning of the map.
VdfConnectorMap()=default
Creates an empty vector.
size_type size() const
Returns the size of the map.
bool empty() const
Returns true if the map's size is 0.
~VdfConnectorMap()
Destroys all connector instances owned by this map.
void swap(VdfConnectorMap &x)
Swaps the contents of this map with x.
VdfConnectorMap(size_t n)
Creates a map that can hold at least n elements without reallocation.
const_iterator find(const key_type &k) const
Finds the element with key k.
std::pair< const_iterator, bool > try_emplace(const key_type &k, Args &&... args)
Inserts an element with key k if one does not already exist.
bool operator==(const VdfConnectorMap &x) const
Test two maps for equality.
void clear()
Erases all of the elements.
const_iterator end() const
Returns a const_iterator pointing to the end of the map.
const_reverse_iterator rbegin() const
Returns a const_reverse_iterator pointing to the beginning of the map.
TfToken class for efficient string referencing and hashing, plus conversions to and from stl string c...