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