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