32 #ifndef PXR_BASE_TF_HASHMAP_H
33 #define PXR_BASE_TF_HASHMAP_H
38 #if defined(ARCH_HAS_GNU_STL_EXTENSIONS)
39 #include <ext/hash_map>
41 #include <unordered_map>
42 #endif // ARCH_HAS_GNU_STL_EXTENSIONS
46 #if defined(ARCH_HAS_GNU_STL_EXTENSIONS)
48 template<
class Key,
class Mapped,
class HashFn = __gnu_cxx::hash<Key>,
49 class EqualKey = __gnu_cxx::equal_to<Key>,
50 class Alloc = __gnu_cxx::allocator<Mapped> >
52 private __gnu_cxx::hash_map<Key, Mapped, HashFn, EqualKey, Alloc> {
53 typedef __gnu_cxx::hash_map<Key, Mapped, HashFn, EqualKey, Alloc> _Base;
55 typedef typename _Base::key_type
key_type;
58 typedef typename _Base::hasher
hasher;
59 typedef typename _Base::key_equal
key_equal;
60 typedef typename _Base::size_type
size_type;
66 typedef typename _Base::iterator
iterator;
76 _Base(n, hf, eql, alloc) { }
80 template<
class InputIterator>
85 _Base(first, last, n, hf, eql, alloc) { }
96 using _Base::bucket_count;
105 std::pair<iterator,iterator> equal_range(
const key_type& key) {
106 return _Base::equal_range(key);
108 std::pair<const_iterator,const_iterator> equal_range(
const key_type& key)
const {
109 return _Base::equal_range(key);
113 _Base::erase(_MakeIterator(position));
116 _Base::erase(_MakeIterator(first), _MakeIterator(last));
123 hasher hash_function()
const {
return _Base::hash_funct(); }
129 float load_factor()
const {
130 return static_cast<float>(
static_cast<double>(
size()) / bucket_count());
132 using _Base::max_bucket_count;
133 float max_load_factor()
const {
return 1.0; }
135 using _Base::max_size;
142 template<
class Key2,
class Mapped2,
class HashFn2,
class EqualKey2,
class Alloc2>
151 return reinterpret_cast<const iterator&
>(i);
155 template<
class Key,
class Mapped,
class HashFn = __gnu_cxx::hash<Key>,
156 class EqualKey = __gnu_cxx::equal_to<Key>,
157 class Alloc = __gnu_cxx::allocator<Mapped> >
159 private __gnu_cxx::hash_multimap<Key, Mapped, HashFn, EqualKey, Alloc> {
160 typedef __gnu_cxx::hash_multimap<Key, Mapped, HashFn, EqualKey, Alloc> _Base;
162 typedef typename _Base::key_type
key_type;
165 typedef typename _Base::hasher
hasher;
166 typedef typename _Base::key_equal
key_equal;
167 typedef typename _Base::size_type
size_type;
173 typedef typename _Base::iterator
iterator;
183 _Base(n, hf, eql, alloc) { }
187 template<
class InputIterator>
192 _Base(first, last, n, hf, eql, alloc) { }
203 using _Base::bucket_count;
212 std::pair<iterator,iterator> equal_range(
const key_type& key) {
213 return _Base::equal_range(key);
215 std::pair<const_iterator,const_iterator> equal_range(
const key_type& key)
const {
216 return _Base::equal_range(key);
220 _Base::erase(_MakeIterator(position));
223 _Base::erase(_MakeIterator(first), _MakeIterator(last));
230 hasher hash_function()
const {
return _Base::hash_funct(); }
236 float load_factor()
const {
237 return static_cast<float>(
static_cast<double>(
size()) / bucket_count());
239 using _Base::max_bucket_count;
240 float max_load_factor()
const {
return 1.0; }
242 using _Base::max_size;
249 template<
class Key2,
class Mapped2,
class HashFn2,
class EqualKey2,
class Alloc2>
258 return reinterpret_cast<const iterator&
>(i);
264 template<
class Key,
class Mapped,
class HashFn = std::hash<Key>,
265 class EqualKey = std::equal_to<Key>,
266 class Alloc = std::allocator<std::pair<const Key, Mapped> > >
268 private std::unordered_map<Key, Mapped, HashFn, EqualKey, Alloc> {
269 typedef std::unordered_map<Key, Mapped, HashFn, EqualKey, Alloc> _Base;
292 _Base(n, hf, eql, alloc) { }
295 template<
class InputIterator>
300 _Base(first, last, n, hf, eql, alloc) { }
311 using _Base::bucket_count;
312 using _Base::bucket_size;
320 using _Base::equal_range;
324 _Base::erase(first, last);
328 using _Base::hash_function;
335 template<
class InputIterator>
336 void insert(InputIterator first, InputIterator last) {
340 using _Base::load_factor;
341 using _Base::max_bucket_count;
342 using _Base::max_load_factor;
344 using _Base::max_size;
351 template<
class Key2,
class Mapped2,
class HashFn2,
class EqualKey2,
class Alloc2>
357 template<
class Key,
class Mapped,
class HashFn = std::hash<Key>,
358 class EqualKey = std::equal_to<Key>,
359 class Alloc = std::allocator<std::pair<const Key, Mapped> > >
361 private std::unordered_multimap<Key, Mapped, HashFn, EqualKey, Alloc> {
362 typedef std::unordered_multimap<Key, Mapped, HashFn, EqualKey, Alloc> _Base;
385 _Base(n, hf, eql, alloc) { }
388 template<
class InputIterator>
393 _Base(first, last, n, hf, eql, alloc) { }
404 using _Base::bucket_count;
405 using _Base::bucket_size;
413 using _Base::equal_range;
417 _Base::erase(first, last);
421 using _Base::hash_function;
428 template<
class InputIterator>
429 void insert(InputIterator first, InputIterator last) {
433 using _Base::load_factor;
434 using _Base::max_bucket_count;
435 using _Base::max_load_factor;
437 using _Base::max_size;
444 template<
class Key2,
class Mapped2,
class HashFn2,
class EqualKey2,
class Alloc2>
450 #endif // ARCH_HAS_GNU_STL_EXTENSIONS
452 template<
class Key,
class Mapped,
class HashFn,
class EqualKey,
class Alloc>
460 template<
class Key,
class Mapped,
class HashFn,
class EqualKey,
class Alloc>
465 typedef typename TfHashMap<Key, Mapped, HashFn, EqualKey, Alloc>::_Base _Base;
466 return static_cast<const _Base&
>(lhs) == static_cast<const _Base&>(rhs);
469 template<
class Key,
class Mapped,
class HashFn,
class EqualKey,
class Alloc>
474 return !(lhs == rhs);
477 template<
class Key,
class Mapped,
class HashFn,
class EqualKey,
class Alloc>
485 template<
class Key,
class Mapped,
class HashFn,
class EqualKey,
class Alloc>
490 typedef typename TfHashMultiMap<Key, Mapped, HashFn, EqualKey, Alloc>::_Base _Base;
491 return static_cast<const _Base&
>(lhs) == static_cast<const _Base&>(rhs);
494 template<
class Key,
class Mapped,
class HashFn,
class EqualKey,
class Alloc>
499 return !(lhs == rhs);
504 #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)
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)
FMT_CONSTEXPR auto find(Ptr first, Ptr last, T value, Ptr &out) -> bool
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.