15 #ifndef PXR_BASE_TF_HASHMAP_H
16 #define PXR_BASE_TF_HASHMAP_H
21 #if defined(ARCH_HAS_GNU_STL_EXTENSIONS)
22 #include <ext/hash_map>
24 #include <unordered_map>
25 #endif // ARCH_HAS_GNU_STL_EXTENSIONS
29 #if defined(ARCH_HAS_GNU_STL_EXTENSIONS)
31 template<
class Key,
class Mapped,
class HashFn = __gnu_cxx::hash<Key>,
32 class EqualKey = __gnu_cxx::equal_to<Key>,
33 class Alloc = __gnu_cxx::allocator<Mapped> >
35 private __gnu_cxx::hash_map<Key, Mapped, HashFn, EqualKey, Alloc> {
36 typedef __gnu_cxx::hash_map<Key, Mapped, HashFn, EqualKey, Alloc> _Base;
38 typedef typename _Base::key_type
key_type;
41 typedef typename _Base::hasher
hasher;
42 typedef typename _Base::key_equal
key_equal;
43 typedef typename _Base::size_type
size_type;
49 typedef typename _Base::iterator
iterator;
59 _Base(n, hf, eql, alloc) { }
63 template<
class InputIterator>
68 _Base(first, last, n, hf, eql, alloc) { }
79 using _Base::bucket_count;
88 std::pair<iterator,iterator> equal_range(
const key_type& key) {
89 return _Base::equal_range(key);
91 std::pair<const_iterator,const_iterator> equal_range(
const key_type& key)
const {
92 return _Base::equal_range(key);
96 _Base::erase(_MakeIterator(position));
99 _Base::erase(_MakeIterator(first), _MakeIterator(last));
106 hasher hash_function()
const {
return _Base::hash_funct(); }
112 float load_factor()
const {
113 return static_cast<float>(
static_cast<double>(
size()) / bucket_count());
115 using _Base::max_bucket_count;
116 float max_load_factor()
const {
return 1.0; }
118 using _Base::max_size;
125 template<
class Key2,
class Mapped2,
class HashFn2,
class EqualKey2,
class Alloc2>
134 return reinterpret_cast<const iterator&
>(i);
138 template<
class Key,
class Mapped,
class HashFn = __gnu_cxx::hash<Key>,
139 class EqualKey = __gnu_cxx::equal_to<Key>,
140 class Alloc = __gnu_cxx::allocator<Mapped> >
142 private __gnu_cxx::hash_multimap<Key, Mapped, HashFn, EqualKey, Alloc> {
143 typedef __gnu_cxx::hash_multimap<Key, Mapped, HashFn, EqualKey, Alloc> _Base;
145 typedef typename _Base::key_type
key_type;
148 typedef typename _Base::hasher
hasher;
149 typedef typename _Base::key_equal
key_equal;
150 typedef typename _Base::size_type
size_type;
156 typedef typename _Base::iterator
iterator;
166 _Base(n, hf, eql, alloc) { }
170 template<
class InputIterator>
175 _Base(first, last, n, hf, eql, alloc) { }
186 using _Base::bucket_count;
195 std::pair<iterator,iterator> equal_range(
const key_type& key) {
196 return _Base::equal_range(key);
198 std::pair<const_iterator,const_iterator> equal_range(
const key_type& key)
const {
199 return _Base::equal_range(key);
203 _Base::erase(_MakeIterator(position));
206 _Base::erase(_MakeIterator(first), _MakeIterator(last));
213 hasher hash_function()
const {
return _Base::hash_funct(); }
219 float load_factor()
const {
220 return static_cast<float>(
static_cast<double>(
size()) / bucket_count());
222 using _Base::max_bucket_count;
223 float max_load_factor()
const {
return 1.0; }
225 using _Base::max_size;
232 template<
class Key2,
class Mapped2,
class HashFn2,
class EqualKey2,
class Alloc2>
241 return reinterpret_cast<const iterator&
>(i);
247 template<
class Key,
class Mapped,
class HashFn = std::hash<Key>,
248 class EqualKey = std::equal_to<Key>,
249 class Alloc = std::allocator<std::pair<const Key, Mapped> > >
251 private std::unordered_map<Key, Mapped, HashFn, EqualKey, Alloc> {
252 typedef std::unordered_map<Key, Mapped, HashFn, EqualKey, Alloc> _Base;
275 _Base(n, hf, eql, alloc) { }
278 template<
class InputIterator>
283 _Base(first, last, n, hf, eql, alloc) { }
294 using _Base::bucket_count;
295 using _Base::bucket_size;
303 using _Base::equal_range;
307 _Base::erase(first, last);
311 using _Base::hash_function;
318 template<
class InputIterator>
319 void insert(InputIterator first, InputIterator last) {
323 using _Base::load_factor;
324 using _Base::max_bucket_count;
325 using _Base::max_load_factor;
327 using _Base::max_size;
334 template<
class Key2,
class Mapped2,
class HashFn2,
class EqualKey2,
class Alloc2>
340 template<
class Key,
class Mapped,
class HashFn = std::hash<Key>,
341 class EqualKey = std::equal_to<Key>,
342 class Alloc = std::allocator<std::pair<const Key, Mapped> > >
344 private std::unordered_multimap<Key, Mapped, HashFn, EqualKey, Alloc> {
345 typedef std::unordered_multimap<Key, Mapped, HashFn, EqualKey, Alloc> _Base;
368 _Base(n, hf, eql, alloc) { }
371 template<
class InputIterator>
376 _Base(first, last, n, hf, eql, alloc) { }
387 using _Base::bucket_count;
388 using _Base::bucket_size;
396 using _Base::equal_range;
400 _Base::erase(first, last);
404 using _Base::hash_function;
411 template<
class InputIterator>
412 void insert(InputIterator first, InputIterator last) {
416 using _Base::load_factor;
417 using _Base::max_bucket_count;
418 using _Base::max_load_factor;
420 using _Base::max_size;
427 template<
class Key2,
class Mapped2,
class HashFn2,
class EqualKey2,
class Alloc2>
433 #endif // ARCH_HAS_GNU_STL_EXTENSIONS
435 template<
class Key,
class Mapped,
class HashFn,
class EqualKey,
class Alloc>
443 template<
class Key,
class Mapped,
class HashFn,
class EqualKey,
class Alloc>
448 typedef typename TfHashMap<Key, Mapped, HashFn, EqualKey, Alloc>::_Base _Base;
449 return static_cast<const _Base&
>(lhs) == static_cast<const _Base&>(rhs);
452 template<
class Key,
class Mapped,
class HashFn,
class EqualKey,
class Alloc>
457 return !(lhs == rhs);
460 template<
class Key,
class Mapped,
class HashFn,
class EqualKey,
class Alloc>
468 template<
class Key,
class Mapped,
class HashFn,
class EqualKey,
class Alloc>
473 typedef typename TfHashMultiMap<Key, Mapped, HashFn, EqualKey, Alloc>::_Base _Base;
474 return static_cast<const _Base&
>(lhs) == static_cast<const _Base&>(rhs);
477 template<
class Key,
class Mapped,
class HashFn,
class EqualKey,
class Alloc>
482 return !(lhs == rhs);
487 #endif // PXR_BASE_TF_HASHMAP_H
void swap(ArAssetInfo &lhs, ArAssetInfo &rhs)
const_iterator cend() const
size_type erase(const key_type &key)
_Base::const_iterator const_iterator
void insert(InputIterator first, InputIterator last)
_Base::reference reference
TfHashMultiMap(size_type n, const hasher &hf=hasher(), const key_equal &eql=key_equal(), const allocator_type &alloc=allocator_type())
TfHashMultiMap & operator=(const TfHashMultiMap &rhs)
const_iterator begin() const
void swap(TfHashMap &other)
_Base::key_equal key_equal
_Base::const_reference const_reference
_Base::reference reference
iterator insert(const_iterator hint, const value_type &v)
size_type erase(const key_type &key)
FMT_CONSTEXPR auto find(Ptr first, Ptr last, T value, Ptr &out) -> bool
OIIO_FORCEINLINE vbool4 insert(const vbool4 &a, bool val)
Helper: substitute val for a[i].
const_iterator begin() const
const_iterator end() const
TfHashMap(const TfHashMap &other)
void erase(const_iterator first, const_iterator last)
_Base::difference_type difference_type
std::pair< iterator, bool > insert(const value_type &v)
TfHashMap & operator=(const TfHashMap &rhs)
_Base::mapped_type mapped_type
friend bool operator==(const TfHashMap< Key2, Mapped2, HashFn2, EqualKey2, Alloc2 > &, const TfHashMap< Key2, Mapped2, HashFn2, EqualKey2, Alloc2 > &)
TfHashMultiMap(InputIterator first, InputIterator last, size_type n=0, const hasher &hf=hasher(), const key_equal &eql=key_equal(), const allocator_type &alloc=allocator_type())
iterator insert(const_iterator hint, const value_type &v)
void erase(const_iterator first, const_iterator last)
mapped_type & operator[](const key_type &k)
const_iterator end() const
TfHashMap(size_type n, const hasher &hf=hasher(), const key_equal &eql=key_equal(), const allocator_type &alloc=allocator_type())
bool operator!=(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Inequality operator, does exact floating point comparisons.
const_iterator cbegin() const
friend bool operator==(const TfHashMap< Key2, Mapped2, HashFn2, EqualKey2, Alloc2 > &, const TfHashMap< Key2, Mapped2, HashFn2, EqualKey2, Alloc2 > &)
void erase(const_iterator position)
_Base::allocator_type allocator_type
mapped_type & operator[](const key_type &k)
_Base::value_type value_type
_Base::mapped_type mapped_type
_Base::const_pointer const_pointer
_Base::allocator_type allocator_type
auto reserve(std::back_insert_iterator< Container > it, size_t n) -> checked_ptr< typename Container::value_type >
__hostdev__ uint64_t last(uint32_t i) const
TfHashMap(const allocator_type &alloc)
TfHashMultiMap(const allocator_type &alloc)
void erase(const_iterator position)
ImageBuf OIIO_API resize(const ImageBuf &src, string_view filtername="", float filterwidth=0.0f, ROI roi={}, int nthreads=0)
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
LeafData & operator=(const LeafData &)=delete
SIM_API const UT_StringHolder position
const_iterator cbegin() const
#define PXR_NAMESPACE_CLOSE_SCOPE
TfHashMultiMap(const TfHashMultiMap &other)
const_iterator cend() const
_Base::size_type size_type
_Base::key_equal key_equal
_Base::const_reference const_reference
_Base::value_type value_type
TfHashMap(InputIterator first, InputIterator last, size_type n=0, const hasher &hf=hasher(), const key_equal &eql=key_equal(), const allocator_type &alloc=allocator_type())
_Base::difference_type difference_type
_Base::const_pointer const_pointer
_Base::const_iterator const_iterator
that also have some descendant prim *whose name begins with which in turn has a child named baz where *the predicate and *a name There is also one special expression reference
xml_allocator & get_allocator(const Object *object)
void insert(InputIterator first, InputIterator last)
bool operator==(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Equality operator, does exact floating point comparisons.
iterator insert(const value_type &v)
void swap(TfHashMap< Key, Mapped, HashFn, EqualKey, Alloc > &lhs, TfHashMap< Key, Mapped, HashFn, EqualKey, Alloc > &rhs)
void swap(TfHashMultiMap &other)
_Base::size_type size_type
PcpNodeRef_ChildrenIterator begin(const PcpNodeRef::child_const_range &r)
Support for range-based for loops for PcpNodeRef children ranges.