HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
dictionary.h
Go to the documentation of this file.
1 //
2 // Copyright 2016 Pixar
3 //
4 // Licensed under the Apache License, Version 2.0 (the "Apache License")
5 // with the following modification; you may not use this file except in
6 // compliance with the Apache License and the following modification to it:
7 // Section 6. Trademarks. is deleted and replaced with:
8 //
9 // 6. Trademarks. This License does not grant permission to use the trade
10 // names, trademarks, service marks, or product names of the Licensor
11 // and its affiliates, except as required to comply with Section 4(c) of
12 // the License and to reproduce the content of the NOTICE file.
13 //
14 // You may obtain a copy of the Apache License at
15 //
16 // http://www.apache.org/licenses/LICENSE-2.0
17 //
18 // Unless required by applicable law or agreed to in writing, software
19 // distributed under the Apache License with the above modification is
20 // distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21 // KIND, either express or implied. See the Apache License for the specific
22 // language governing permissions and limitations under the Apache License.
23 //
24 #ifndef PXR_BASE_VT_DICTIONARY_H
25 #define PXR_BASE_VT_DICTIONARY_H
26 
27 /// \file vt/dictionary.h
28 
29 #include "pxr/pxr.h"
30 #include "pxr/base/vt/api.h"
31 #include "pxr/base/vt/value.h"
32 
33 #include "pxr/base/tf/diagnostic.h"
34 #include "pxr/base/tf/hash.h"
35 #include "pxr/base/tf/mallocTag.h"
36 
37 #include <hboost/iterator/iterator_adaptor.hpp>
38 
39 #include <initializer_list>
40 #include <iosfwd>
41 #include <map>
42 #include <memory>
43 
45 
46 /// \defgroup group_vtdict_functions VtDictionary Functions
47 /// Functions for manipulating VtDictionary objects.
48 
49 /// \class VtDictionary
50 ///
51 /// A map with string keys and VtValue values.
52 ///
53 /// VtDictionary converts to and from a python dictionary as long
54 /// as each element contains either
55 /// - another VtDictionary (converts to a nested dictionary)
56 /// - std::vector<VtValue> (converts to a nested list)
57 /// - VtValue with one of the supported Vt Types.
58 ///
59 /// For a list of functions that can manipulate VtDictionary objects, see the
60 /// \link group_vtdict_functions VtDictionary Functions \endlink group page .
61 ///
62 class VtDictionary {
63  typedef std::map<std::string, VtValue, std::less<>> _Map;
64  std::unique_ptr<_Map> _dictMap;
65 
66 public:
67  // The iterator class, used to make both const and non-const iterators.
68  // Currently only forward traversal is supported. In order to support lazy
69  // allocation, VtDictionary's Map pointer (_dictMap) must be nullable,
70  // but that would break the VtDictionary iterators. So instead, VtDictionary
71  // uses this Iterator class, which considers an iterator to an empty
72  // VtDictionary to be the same as an iterator at the end of a VtDictionary
73  // (i.e. if Iterator's _dictMap pointer is null, that either means that the
74  // VtDictionary is empty, or the Iterator is at the end of a VtDictionary
75  // that contains values).
76  template<class UnderlyingMapPtr, class UnderlyingIterator>
77  class Iterator : public hboost::iterator_adaptor<Iterator<UnderlyingMapPtr,
78  UnderlyingIterator>, UnderlyingIterator> {
79  public:
80  // Default constructor creates an Iterator equivalent to end() (i.e.
81  // UnderlyingMapPtr is null)
83  : Iterator::iterator_adaptor_(UnderlyingIterator())
84  , _underlyingMap(0) {}
85 
86  // Copy constructor (also allows for converting non-const to const).
87  template <class OtherUnderlyingMapPtr, class OtherUnderlyingIterator>
88  Iterator(Iterator<OtherUnderlyingMapPtr,
89  OtherUnderlyingIterator> const &other)
90  : Iterator::iterator_adaptor_(other.base())
91  , _underlyingMap(other._underlyingMap) {}
92 
93  private:
94  // Private constructor allowing the find, begin and insert methods
95  // to create and return the proper Iterator.
96  Iterator(UnderlyingMapPtr m, UnderlyingIterator i)
97  : Iterator::iterator_adaptor_(i)
98  , _underlyingMap(m) {
99  if (m && i == m->end())
100  _underlyingMap = 0;
101  }
102 
104  friend class VtDictionary;
105 
106  UnderlyingIterator GetUnderlyingIterator(UnderlyingMapPtr map)
107  const {
108  TF_AXIOM(!_underlyingMap || _underlyingMap == map);
109  return (!_underlyingMap) ? map->end() : this->base();
110  }
111 
112  // Fundamental functionality to implement the iterator.
113  // hboost::iterator_adaptor will invoke these as necessary to implement
114  // the full iterator public interface.
115 
116  // Increments the underlying iterator, and sets the underlying map to
117  // null when the iterator reaches the end of the map.
118  void increment() {
119  if (!_underlyingMap) {
120  TF_FATAL_ERROR("Attempted invalid increment operation on a "
121  "VtDictionary iterator");
122  return;
123  }
124  if (++this->base_reference() == _underlyingMap->end()) {
125  _underlyingMap = 0;
126  }
127  }
128 
129  // Equality comparison. Iterators are considered equal if:
130  // 1) They both point to empty VtDictionaries
131  // 2) They both point to the end() of a VtDictionary
132  // - or-
133  // 3) They both point to the same VtDictionary and their
134  // hboost::iterator_adaptors' base() iterators are the same
135  // In cases 1 and 2 above, _underlyingMap will be null
136  template <class OtherUnderlyingMapPtr, class OtherUnderlyingIterator>
137  bool equal(Iterator<OtherUnderlyingMapPtr,
138  OtherUnderlyingIterator> const& i) const {
139  if (_underlyingMap == i._underlyingMap)
140  if (!_underlyingMap || this->base() == i.base())
141  return true;
142  return false;
143  }
144 
145  UnderlyingMapPtr _underlyingMap;
146  };
147 
148  TF_MALLOC_TAG_NEW("Vt", "VtDictionary");
149 
150  typedef _Map::key_type key_type;
151  typedef _Map::mapped_type mapped_type;
153  typedef _Map::allocator_type allocator_type;
154  typedef _Map::size_type size_type;
155 
158 
159  /// Creates an empty \p VtDictionary.
161 
162  /// Creates an empty \p VtDictionary with at least \p size buckets.
163  explicit VtDictionary(int size) {}
164 
165  /// Creates a \p VtDictionary with a copy of a range.
166  template<class _InputIterator>
167  VtDictionary(_InputIterator f, _InputIterator l){
168  TfAutoMallocTag2 tag("Vt", "VtDictionary::VtDictionary (range)");
169  insert(f, l);
170  }
171 
172  /// Creates a copy of the supplied \p VtDictionary
173  VT_API
174  VtDictionary(VtDictionary const& other);
175 
176  /// Creates a new VtDictionary by moving the supplied \p VtDictionary.
177  VT_API
178  VtDictionary(VtDictionary && other) = default;
179 
180  /// Creates a new VtDictionary from a braced initializer list.
181  VT_API
182  VtDictionary(std::initializer_list<value_type> init);
183 
184  /// Copy assignment operator
185  VT_API
186  VtDictionary& operator=(VtDictionary const& other);
187 
188  /// Move assignment operator
189  VT_API
190  VtDictionary& operator=(VtDictionary && other) = default;
191 
192  /// Returns a reference to the \p VtValue that is associated with a
193  /// particular key.
194  VT_API
195  VtValue& operator[](const std::string& key);
196 
197  /// Counts the number of elements whose key is \p key.
198  VT_API
199  size_type count(const std::string& key) const;
200 
201  /// Counts the number of elements whose key is \p key.
202  VT_API
203  size_type count(const char* key) const;
204 
205  /// Erases the element whose key is \p key.
206  VT_API
207  size_type erase(const std::string& key);
208 
209  /// Erases the element pointed to by \p it.
210  VT_API
211  void erase(iterator it);
212 
213  /// Erases all elements in a range.
214  VT_API
215  void erase(iterator f, iterator l);
216 
217  /// Erases all of the elements.
218  VT_API
219  void clear();
220 
221  /// Finds an element whose key is \p key.
222  VT_API
223  iterator find(const std::string& key);
224 
225  /// Finds an element whose key is \p key.
226  VT_API
227  iterator find(const char* key);
228 
229  /// Finds an element whose key is \p key.
230  VT_API
231  const_iterator find(const std::string& key) const;
232 
233  /// Finds an element whose key is \p key.
234  VT_API
235  const_iterator find(const char* key) const;
236 
237  /// Returns an \p iterator pointing to the beginning of the \p VtDictionary.
238  VT_API
239  iterator begin();
240 
241  /// Returns an \p iterator pointing to the beginning of the \p VtDictionary.
242  VT_API
243  const_iterator begin() const;
244 
245  /// Returns an \p iterator pointing to the end of the \p VtDictionary.
246  VT_API
247  iterator end();
248 
249  /// Returns an \p iterator pointing to the end of the \p VtDictionary.
250  VT_API
251  const_iterator end() const;
252 
253  /// Returns the size of the VtDictionary.
254  VT_API
255  size_type size() const;
256 
257  /// \c true if the \p VtDictionary's size is 0.
258  VT_API
259  bool empty() const;
260 
261  /// Swaps the contents of two \p VtDictionaries.
262  VT_API
263  void swap(VtDictionary& dict);
264 
265  // Global overload for swap for unqualified calls in generic code.
266  friend void swap(VtDictionary &lhs, VtDictionary &rhs) {
267  lhs.swap(rhs);
268  }
269 
270  friend size_t hash_value(VtDictionary const &dict) {
271  // Hash empty dict as zero.
272  if (dict.empty())
273  return 0;
274  // Otherwise hash the map.
275  return TfHash()(*dict._dictMap);
276  }
277 
278  /// Inserts a range into the \p VtDictionary.
279  template<class _InputIterator>
280  void insert(_InputIterator f, _InputIterator l) {
281  TfAutoMallocTag2 tag("Vt", "VtDictionary::insert (range)");
282  if (f != l) {
283  _CreateDictIfNeeded();
284  _dictMap->insert(f, l);
285  }
286  }
287 
288  /// Inserts \p obj into the \p VtDictionary.
289  VT_API
290  std::pair<iterator, bool> insert(const value_type& obj);
291 
292  /// Return a pointer to the value at \p keyPath if one exists. \p keyPath
293  /// is a delimited string of sub-dictionary names. Key path elements are
294  /// produced by calling TfStringTokenize() with \p keyPath and
295  /// \p delimiters. \p keyPath may identify a leaf element or an entire
296  /// sub-dictionary. Return null if no such element at \p keyPath exists.
297  VT_API
298  VtValue const *
299  GetValueAtPath(std::string const &keyPath,
300  char const *delimiters = ":") const;
301 
302  /// Return a pointer to the value at \p keyPath if one exists. \p keyPath
303  /// may identify a leaf element or an entire sub-dictionary. Return null if
304  /// no such element at \p keyPath exists.
305  VT_API
306  VtValue const *
307  GetValueAtPath(std::vector<std::string> const &keyPath) const;
308 
309  /// Set the value at \p keyPath to \p value. \p keyPath is a delimited
310  /// string of sub-dictionary names. Key path elements are produced by
311  /// calling TfStringTokenize() with \p keyPath and \p delimiters. Create
312  /// sub-dictionaries as necessary according to the path elements in
313  /// \p keyPath. If \p keyPath identifies a full sub-dictionary, replace the
314  /// entire sub-dictionary with \p value.
315  VT_API
316  void SetValueAtPath(std::string const &keyPath,
317  VtValue const &value, char const *delimiters = ":");
318 
319  /// Set the value at \p keyPath to \p value. Create sub-dictionaries as
320  /// necessary according to the path elements in \p keyPath. If \p keyPath
321  /// identifies a full sub-dictionary, replace the entire sub-dictionary with
322  /// \p value.
323  VT_API
324  void SetValueAtPath(std::vector<std::string> const &keyPath,
325  VtValue const &value);
326 
327  /// Erase the value at \a keyPath. \p keyPath is a delimited string of
328  /// sub-dictionary names. Key path elements are produced by calling
329  /// TfStringTokenize() with \p keyPath and \p delimiters. If no such
330  /// element exists at \p keyPath, do nothing. If \p keyPath identifies a
331  /// sub-dictionary, erase the entire sub-dictionary.
332  VT_API
333  void EraseValueAtPath(std::string const &keyPath,
334  char const *delimiters = ":");
335 
336  /// Erase the value at \a keyPath. If no such element exists at \p keyPath,
337  /// do nothing. If \p keyPath identifies a sub-dictionary, erase the entire
338  /// sub-dictionary.
339  VT_API
340  void EraseValueAtPath(std::vector<std::string> const &keyPath);
341 
342 private:
343  void
344  _SetValueAtPathImpl(std::vector<std::string>::const_iterator curKeyElem,
345  std::vector<std::string>::const_iterator keyElemEnd,
346  VtValue const &value);
347 
348  void _EraseValueAtPathImpl(
349  std::vector<std::string>::const_iterator curKeyElem,
350  std::vector<std::string>::const_iterator keyElemEnd);
351 
352  void _CreateDictIfNeeded();
353 
354 };
355 
356 /// Equality comparison.
357 VT_API bool operator==(VtDictionary const &, VtDictionary const &);
358 VT_API bool operator!=(VtDictionary const &, VtDictionary const &);
359 
360 /// Write the contents of a VtDictionary to a stream, formatted like "{ 'key1':
361 /// value1, 'key2': value2 }".
362 VT_API std::ostream &operator<<(std::ostream &, VtDictionary const &);
363 
364 //
365 // Return a const reference to an empty VtDictionary.
366 //
368 
369 /// Returns true if \p dictionary contains \p key and the corresponding value
370 /// is of type \p T.
371 /// \ingroup group_vtdict_functions
372 ///
373 template <typename T>
374 bool
376  const std::string &key )
377 {
378  VtDictionary::const_iterator i = dictionary.find(key);
379  if ( i == dictionary.end() ) {
380  return false;
381  }
382 
383  return i->second.IsHolding<T>();
384 }
385 
386 /// \overload
387 template <typename T>
388 bool
390  const char *key )
391 {
392  VtDictionary::const_iterator i = dictionary.find(key);
393  if ( i == dictionary.end() ) {
394  return false;
395  }
396 
397  return i->second.IsHolding<T>();
398 }
399 
400 
401 /// Return a value held in a VtDictionary by reference.
402 ///
403 /// If \p key is in \p dictionary and the corresponding value is of type
404 /// \p T, returns a reference to the value.
405 ///
406 /// \remark If \p key is not in \p dictionary, or the value for \p key is of
407 /// the wrong type, a fatal error occurs, so clients should always call
408 /// VtDictionaryIsHolding first.
409 ///
410 /// \ingroup group_vtdict_functions
411 template <typename T>
412 const T &
413 VtDictionaryGet( const VtDictionary &dictionary,
414  const std::string &key )
415 {
416  VtDictionary::const_iterator i = dictionary.find(key);
417  if (ARCH_UNLIKELY(i == dictionary.end())) {
418  TF_FATAL_ERROR("Attempted to get value for key '" + key +
419  "', which is not in the dictionary.");
420  }
421 
422  return i->second.Get<T>();
423 }
424 
425 /// \overload
426 template <typename T>
427 const T &
428 VtDictionaryGet( const VtDictionary &dictionary,
429  const char *key )
430 {
431  VtDictionary::const_iterator i = dictionary.find(key);
432  if (ARCH_UNLIKELY(i == dictionary.end())) {
433  TF_FATAL_ERROR("Attempted to get value for key '%s', "
434  "which is not in the dictionary.", key);
435  }
436 
437  return i->second.Get<T>();
438 }
439 
440 
441 // This is an internal holder class that is used in the version of
442 // VtDictionaryGet that takes a default.
443 template <class T>
445  explicit Vt_DefaultHolder(T const &t) : val(t) {}
446  T const &val;
447 };
448 
449 // This internal class has a very unusual assignment operator that returns an
450 // instance of Vt_DefaultHolder, holding any type T. This is used to get the
451 // "VtDefault = X" syntax for VtDictionaryGet.
453  template <class T>
455  return Vt_DefaultHolder<T>(t);
456  }
457 };
458 
459 // This is a global stateless variable used to get the VtDefault = X syntax in
460 // VtDictionaryGet.
462 
463 /// Return a value held in a VtDictionary, or a default value either if the
464 /// supplied key is missing or if the types do not match.
465 ///
466 /// For example, this code will get a bool value under key "key" if "key" has a
467 /// boolean value in the dictionary. If there is no such key, or the value
468 /// under the key is not a bool, the specified default (false) is returned.
469 ///
470 /// \code
471 /// bool val = VtDictionaryGet<bool>(dict, "key", VtDefault = false);
472 /// \endcode
473 ///
474 /// \ingroup group_vtdict_functions
475 template <class T, class U>
476 T VtDictionaryGet( const VtDictionary &dictionary,
477  const std::string &key,
478  Vt_DefaultHolder<U> const &def )
479 {
480  VtDictionary::const_iterator i = dictionary.find(key);
481  if (i == dictionary.end() || !i->second.IsHolding<T>())
482  return def.val;
483  return i->second.UncheckedGet<T>();
484 }
485 
486 /// \overload
487 template <class T, class U>
488 T VtDictionaryGet( const VtDictionary &dictionary,
489  const char *key,
490  Vt_DefaultHolder<U> const &def )
491 {
492  VtDictionary::const_iterator i = dictionary.find(key);
493  if (i == dictionary.end() || !i->second.IsHolding<T>())
494  return def.val;
495  return i->second.UncheckedGet<T>();
496 }
497 
498 
499 
500 /// Creates a dictionary containing \p strong composed over \p weak.
501 ///
502 /// The new dictionary will contain all key-value pairs from \p strong
503 /// together with the key-value pairs from \p weak whose keys are not in \p
504 /// strong.
505 ///
506 /// If \p coerceToWeakerOpinionType is \c true then coerce a strong value to
507 /// the weaker value's type, if there is a weaker value. This is mainly
508 /// intended to promote to enum types.
509 ///
510 /// \ingroup group_vtdict_functions
512 VtDictionaryOver(const VtDictionary &strong, const VtDictionary &weak,
513  bool coerceToWeakerOpinionType = false);
514 
515 /// Updates \p strong to become \p strong composed over \p weak.
516 ///
517 /// The updated contents of \p strong will be all key-value pairs from \p
518 /// strong together with the key-value pairs from \p weak whose keys are not in
519 /// \p strong.
520 ///
521 /// If \p coerceToWeakerOpinionType is \c true then coerce a strong value to
522 /// the weaker value's type, if there is a weaker value. This is mainly
523 /// intended to promote to enum types.
524 ///
525 /// \ingroup group_vtdict_functions
526 VT_API void
527 VtDictionaryOver(VtDictionary *strong, const VtDictionary &weak,
528  bool coerceToWeakerOpinionType = false);
529 
530 /// Updates \p weak to become \p strong composed over \p weak.
531 ///
532 /// The updated contents of \p weak will be all key-value pairs from \p strong
533 /// together with the key-value pairs from \p weak whose keys are not in \p
534 /// strong.
535 ///
536 /// If \p coerceToWeakerOpinionType is \c true then coerce a strong value to
537 /// the weaker value's type, if there is a weaker value. This is mainly
538 /// intended to promote to enum types.
539 ///
540 /// \ingroup group_vtdict_functions
541 VT_API void
542 VtDictionaryOver(const VtDictionary &strong, VtDictionary *weak,
543  bool coerceToWeakerOpinionType = false);
544 
545 /// Returns a dictionary containing \p strong recursively composed over \p
546 /// weak.
547 ///
548 /// The new dictionary will be all key-value pairs from \p strong together
549 /// with the key-value pairs from \p weak whose keys are not in \p strong.
550 ///
551 /// If a value for a key is in turn a dictionary, and both \a strong and \a
552 /// weak have values for that key, then the result may not contain strong's
553 /// exact value for the subdict. Rather, the result will contain a subdict
554 /// that is the result of a recursive call to this method. Hence, the
555 /// subdict, too, will contain values from \a weak that are not found in \a
556 /// strong.
557 ///
558 /// If \p coerceToWeakerOpinionType is \c true then coerce a strong value to
559 /// the weaker value's type, if there is a weaker value. This is mainly
560 /// intended to promote to enum types.
561 ///
562 /// \ingroup group_vtdict_functions
564 VtDictionaryOverRecursive(const VtDictionary &strong, const VtDictionary &weak,
565  bool coerceToWeakerOpinionType = false);
566 
567 /// Updates \p strong to become \p strong composed recursively over \p weak.
568 ///
569 /// The updated contents of \p strong will be all key-value pairs from \p
570 /// strong together with the key-value pairs from \p weak whose keys are not
571 /// in \p strong.
572 ///
573 /// If a value for a key is in turn a dictionary, and both \a strong and \a
574 /// weak have values for that key, then \a strong's subdict may not be left
575 /// untouched. Rather, the dictionary will be replaced by the result of a
576 /// recursive call to this method in which \a strong's subdictionary will have
577 /// entries added if they are contained in \a weak but not in \a strong
578 ///
579 /// If \p coerceToWeakerOpinionType is \c true then coerce a strong value to
580 /// the weaker value's type, if there is a weaker value. This is mainly
581 /// intended to promote to enum types.
582 ///
583 /// \ingroup group_vtdict_functions
584 VT_API void
586  bool coerceToWeakerOpinionType = false);
587 
588 /// Updates \p weak to become \p strong composed recursively over \p weak.
589 ///
590 /// The updated contents of \p weak will be all key-value pairs from \p strong
591 /// together with the key-value pairs from \p weak whose keys are not in \p
592 /// strong.
593 ///
594 /// If a value is in turn a dictionary, the dictionary in \a weak may not be
595 /// replaced wholesale by that of \a strong. Rather, the dictionary will be
596 /// replaced by the result of a recursive call to this method in which \a
597 /// weak's subdictionary is recursively overlayed by \a strong's
598 /// subdictionary.
599 ///
600 /// The result is that no key/value pairs of \a will be lost in nested
601 /// dictionaries. Rather, only non-dictionary values will be overwritten
602 ///
603 /// If \p coerceToWeakerOpinionType is \c true then coerce a strong value to
604 /// the weaker value's type, if there is a weaker value. This is mainly
605 /// intended to promote to enum types.
606 ///
607 /// \ingroup group_vtdict_functions
608 VT_API void
610  bool coerceToWeakerOpinionType = false);
611 
612 
614  inline size_t operator()(VtDictionary const &dict) const {
615  return hash_value(dict);
616  }
617 };
618 
620 
621 #endif /* PXR_BASE_VT_DICTIONARY_H */
VT_API size_type erase(const std::string &key)
Erases the element whose key is key.
VT_API VtDictionary const & VtGetEmptyDictionary()
VtDictionary(_InputIterator f, _InputIterator l)
Creates a VtDictionary with a copy of a range.
Definition: dictionary.h:167
Iterator(Iterator< OtherUnderlyingMapPtr, OtherUnderlyingIterator > const &other)
Definition: dictionary.h:88
VT_API VtDictionary VtDictionaryOverRecursive(const VtDictionary &strong, const VtDictionary &weak, bool coerceToWeakerOpinionType=false)
GLsizei const GLchar *const * string
Definition: glcorearb.h:814
#define VT_API
Definition: api.h:40
VT_API VtValue & operator[](const std::string &key)
IMATH_HOSTDEVICE constexpr bool equal(T1 a, T2 b, T3 t) IMATH_NOEXCEPT
Definition: ImathFun.h:105
friend size_t hash_value(VtDictionary const &dict)
Definition: dictionary.h:270
VtDictionary()
Creates an empty VtDictionary.
Definition: dictionary.h:160
uint64 value_type
Definition: GA_PrimCompat.h:29
_Map::allocator_type allocator_type
Definition: dictionary.h:153
const T & VtDictionaryGet(const VtDictionary &dictionary, const std::string &key)
Definition: dictionary.h:413
T const & val
Definition: dictionary.h:446
Vt_DefaultHolder(T const &t)
Definition: dictionary.h:445
Definition: hash.h:504
TF_MALLOC_TAG_NEW("Vt","VtDictionary")
Iterator< _Map *, _Map::iterator > iterator
Definition: dictionary.h:156
#define ARCH_UNLIKELY(x)
Definition: hints.h:47
GLfloat f
Definition: glcorearb.h:1926
VT_API iterator find(const std::string &key)
Finds an element whose key is key.
#define TF_FATAL_ERROR
bool operator!=(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Inequality operator, does exact floating point comparisons.
Definition: Mat3.h:556
VT_API std::ostream & operator<<(std::ostream &, VtDictionary const &)
VT_API bool empty() const
true if the VtDictionary's size is 0.
void insert(_InputIterator f, _InputIterator l)
Inserts a range into the VtDictionary.
Definition: dictionary.h:280
friend class hboost::iterator_core_access
Definition: dictionary.h:103
VT_API VtDictionary VtDictionaryOver(const VtDictionary &strong, const VtDictionary &weak, bool coerceToWeakerOpinionType=false)
GLdouble t
Definition: glad.h:2397
_Map::key_type key_type
Definition: dictionary.h:150
size_t operator()(VtDictionary const &dict) const
Definition: dictionary.h:614
Vt_DefaultHolder< T > operator=(T const &t)
Definition: dictionary.h:454
GLsizeiptr size
Definition: glcorearb.h:664
VT_API void clear()
Erases all of the elements.
#define TF_AXIOM(cond)
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1441
VT_API iterator begin()
Returns an iterator pointing to the beginning of the VtDictionary.
Iterator< _Map const *, _Map::const_iterator > const_iterator
Definition: dictionary.h:157
VT_API VtDictionary & operator=(VtDictionary const &other)
Copy assignment operator.
friend void swap(VtDictionary &lhs, VtDictionary &rhs)
Definition: dictionary.h:266
GLuint GLfloat * val
Definition: glcorearb.h:1608
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
VT_API void EraseValueAtPath(std::string const &keyPath, char const *delimiters=":")
VT_API size_type count(const std::string &key) const
Counts the number of elements whose key is key.
VT_API iterator end()
Returns an iterator pointing to the end of the VtDictionary.
_Map::mapped_type mapped_type
Definition: dictionary.h:151
Definition: core.h:1131
VT_API void SetValueAtPath(std::string const &keyPath, VtValue const &value, char const *delimiters=":")
VT_API void swap(VtDictionary &dict)
Swaps the contents of two VtDictionaries.
VT_API size_type size() const
Returns the size of the VtDictionary.
size_t hash_value(const CH_ChannelRef &ref)
_Map::value_type value_type
Definition: dictionary.h:152
VT_API Vt_DefaultGenerator VtDefault
Definition: value.h:167
bool operator==(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Equality operator, does exact floating point comparisons.
Definition: Mat3.h:542
_Map::size_type size_type
Definition: dictionary.h:154
VT_API VtValue const * GetValueAtPath(std::string const &keyPath, char const *delimiters=":") const
VtDictionary(int size)
Creates an empty VtDictionary with at least size buckets.
Definition: dictionary.h:163
bool VtDictionaryIsHolding(const VtDictionary &dictionary, const std::string &key)
Definition: dictionary.h:375