HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
childrenView.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_USD_SDF_CHILDREN_VIEW_H
25 #define PXR_USD_SDF_CHILDREN_VIEW_H
26 
27 /// \file sdf/childrenView.h
28 
29 #include "pxr/pxr.h"
30 #include "pxr/usd/sdf/api.h"
31 #include "pxr/usd/sdf/children.h"
32 #include "pxr/base/tf/iterator.h"
33 
34 #include <algorithm>
35 #include <vector>
36 
38 
39 /// \class SdfChildrenViewTrivialPredicate
40 ///
41 /// Special case predicate that always passes.
42 ///
43 /// \c T is the type exposed by the value traits.
44 ///
45 /// This predicate is compiled out.
46 ///
47 template <class T>
49 public:
50  bool operator()(const T& x) const { return true; }
51 };
52 
53 /// \class SdfChildrenViewTrivialAdapter
54 ///
55 /// Special case adapter that does no conversions.
56 ///
57 template <class T>
59 public:
60  typedef T PrivateType;
61  typedef T PublicType;
62  static const PublicType& Convert(const PrivateType& t) { return t; }
63 };
64 
65 /// \class Sdf_ChildrenViewTraits
66 /// This traits class defines the iterator for a particular ChildrenView
67 /// along with conversions to and from the view's internal un-filtered iterator.
68 ///
69 /// A specialization of the traits for trivial predicates allows the
70 /// internal iterator to be used directly.
71 ///
72 template <typename _Owner, typename _InnerIterator, typename _DummyPredicate>
74 private:
75 
76  // Owner's predicate object will be used by the filter iterator.
77  // In C++20, consider using the ranges library to simplify this
78  class _FilterIterator {
79  public:
80  using iterator_category = std::forward_iterator_tag;
81  using value_type = typename _InnerIterator::value_type;
82  using reference = typename _InnerIterator::reference;
83  using pointer = typename _InnerIterator::pointer;
84  using difference_type = typename _InnerIterator::difference_type;
85 
86  _FilterIterator() = default;
87  _FilterIterator(const _Owner* owner,
88  const _InnerIterator& underlyingIterator,
89  const _InnerIterator& end) :
90  _owner(owner),
91  _underlyingIterator(underlyingIterator),
92  _end(end) {
93  _Filter();
94  }
95 
96  reference operator*() const {
97  return *_underlyingIterator;
98  }
99 
100  pointer operator->() const {
101  return _underlyingIterator.operator->();
102  }
103 
104  _FilterIterator& operator++() {
105  TF_DEV_AXIOM(_underlyingIterator != _end);
106  ++_underlyingIterator;
107  _Filter();
108  return *this;
109  }
110 
111  _FilterIterator operator++(int) {
112  TF_DEV_AXIOM(_underlyingIterator != _end);
113  _FilterIterator result(*this);
114  ++_underlyingIterator;
115  _Filter();
116  return result;
117  }
118 
119  bool operator==(const _FilterIterator& other) const {
120  return _underlyingIterator == other._underlyingIterator;
121  }
122 
123  bool operator!=(const _FilterIterator& other) const {
124  return _underlyingIterator != other._underlyingIterator;
125  }
126 
127  const _InnerIterator& GetBase() const { return _underlyingIterator; }
128 
129  private:
130  // Skip any iterators that don't satisfy the predicate
131  bool _ShouldFilter(const value_type& x) const
132  {
133  return !_owner->GetPredicate()(
134  _Owner::Adapter::Convert(x));
135  }
136 
137  void _Filter()
138  {
139  while (_underlyingIterator != _end &&
140  _ShouldFilter(*_underlyingIterator)) {
141  ++_underlyingIterator;
142  }
143  }
144 
145  const _Owner* _owner = nullptr;
146  _InnerIterator _underlyingIterator;
147  _InnerIterator _end;
148  };
149 
150 public:
151  using const_iterator = _FilterIterator;
152 
153  // Convert from a private _InnerIterator to a public const_iterator.
154  // filter_iterator requires an end iterator, which is constructed using
155  // size.
156  static const_iterator GetIterator(const _Owner* owner,
157  const _InnerIterator& i,
158  size_t size)
159  {
160  _InnerIterator end(owner,size);
161  return const_iterator(owner, i, end);
162  }
163 
164  // Convert from a public const_iterator to a private _InnerIterator.
165  static const _InnerIterator& GetBase(const const_iterator& i)
166  {
167  return i.GetBase();
168  }
169 };
170 
171 // Children view traits specialization for trivial predicates. This
172 // eliminates the predicate altogether and defines the public iterator type
173 // to be the same as the inner iterator type.
174 template <typename _Owner, typename _InnerIterator>
175 class Sdf_ChildrenViewTraits<_Owner, _InnerIterator,
177 private:
178 
179 public:
180  typedef _InnerIterator const_iterator;
181 
182  static const const_iterator& GetIterator(const _Owner*,
183  const _InnerIterator& i, size_t size)
184  {
185  return i;
186  }
187 
188  static const _InnerIterator& GetBase(const const_iterator& i)
189  {
190  return i;
191  }
192 };
193 
194 /// \class SdfChildrenView
195 ///
196 /// Provides a view onto an object's children.
197 ///
198 /// The \c _ChildPolicy dictates the type of children being viewed by this
199 /// object. This policy defines the key type by which children are referenced
200 /// (e.g. a TfToken, or an SdfPath) and the value type of the children objects.
201 ///
202 /// The \c _Predicate takes a value type argument and returns \c true if the
203 /// object should be included in the view and \c false otherwise.
204 ///
205 /// The \c _Adapter allows the view to present the children objects as a
206 /// different type. The _Adapter class must provide functions to convert the
207 /// children object type defined by \c _ChildPolicy to the desired public
208 /// type and vice-versa. See SdfChildrenViewTrivialAdapter for an example.
209 /// By default, the view presents children objects as the value type defined
210 /// in \c _ChildPolicy.
211 ///
212 /// Note that all methods are const, i.e. the children cannot be changed
213 /// through a view.
214 ///
215 template <typename _ChildPolicy,
216  typename _Predicate =
218  typename _ChildPolicy::ValueType>,
219  typename _Adapter =
221  typename _ChildPolicy::ValueType> >
223 public:
225 
226  typedef _Adapter Adapter;
227  typedef _Predicate Predicate;
228  typedef _ChildPolicy ChildPolicy;
229  typedef typename ChildPolicy::KeyPolicy KeyPolicy;
231 
232  typedef typename ChildPolicy::KeyType key_type;
233  typedef typename Adapter::PublicType value_type;
234 
235 private:
236 
237  // An iterator type for the internal unfiltered data storage. This
238  // iterator holds a pointer to its owning object and an index into
239  // the owner's storage. That allows the iterator to operate without
240  // knowing anything about the specific data storage that's used,
241  // which is important for providing both Gd and Lsd backed storage.
242  class _InnerIterator {
243  class _PtrProxy {
244  public:
245  SdfChildrenView::value_type* operator->() { return &_value; }
246  private:
247  friend class SdfChildrenView;
248  explicit _PtrProxy(const SdfChildrenView::value_type& value)
249  : _value(value) {}
251  };
252  public:
253  using iterator_category = std::random_access_iterator_tag;
255  using reference = value_type;
256  using pointer = _PtrProxy;
257  using difference_type = std::ptrdiff_t;
258 
259  _InnerIterator() = default;
260  _InnerIterator(const This* owner, const size_t& pos) :
261  _owner(owner), _pos(pos) { }
262 
263  reference operator*() const { return dereference(); }
264  pointer operator->() const { return pointer(dereference()); }
266  _InnerIterator advanced(*this);
267  advanced.advance(index);
268  return advanced.dereference();
269  }
270 
271  difference_type operator-(const _InnerIterator& other) const {
272  return -distance_to(other);
273  }
274 
275  _InnerIterator& operator++() {
276  increment();
277  return *this;
278  }
279 
280  _InnerIterator& operator--() {
281  decrement();
282  return *this;
283  }
284 
285  _InnerIterator operator++(int) {
286  _InnerIterator result(*this);
287  increment();
288  return result;
289  }
290 
291  _InnerIterator operator--(int) {
292  _InnerIterator result(*this);
293  decrement();
294  return result;
295  }
296 
297  _InnerIterator operator+(const difference_type increment) const {
298  _InnerIterator result(*this);
299  result.advance(increment);
300  return result;
301  }
302 
303  _InnerIterator operator-(const difference_type decrement) const {
304  _InnerIterator result(*this);
305  result.advance(-decrement);
306  return result;
307  }
308 
309  _InnerIterator& operator+=(const difference_type increment) {
310  advance(increment);
311  return *this;
312  }
313 
314  _InnerIterator& operator-=(const difference_type decrement) {
315  advance(-decrement);
316  return *this;
317  }
318 
319  bool operator==(const _InnerIterator& other) const {
320  return equal(other);
321  }
322 
323  bool operator!=(const _InnerIterator& other) const {
324  return !equal(other);
325  }
326 
327  bool operator<(const _InnerIterator& other) const {
328  TF_DEV_AXIOM(_owner == other._owner);
329  return _pos < other._pos;
330  }
331 
332  bool operator<=(const _InnerIterator& other) const {
333  TF_DEV_AXIOM(_owner == other._owner);
334  return _pos <= other._pos;
335  }
336 
337  bool operator>(const _InnerIterator& other) const {
338  TF_DEV_AXIOM(_owner == other._owner);
339  return _pos > other._pos;
340  }
341 
342  bool operator>=(const _InnerIterator& other) const {
343  TF_DEV_AXIOM(_owner == other._owner);
344  return _pos >= other._pos;
345  }
346 
347  private:
348 
349  reference dereference() const
350  {
351  return _owner->_Get(_pos);
352  }
353 
354  bool equal(const _InnerIterator& other) const
355  {
356  return _pos == other._pos;
357  }
358 
359  void increment() {
360  ++_pos;
361  }
362 
363  void decrement() {
364  --_pos;
365  }
366 
367  void advance(difference_type n) {
368  _pos += n;
369  }
370 
371  difference_type distance_to(const _InnerIterator& other) const {
372  return other._pos-_pos;
373  }
374 
375  private:
376  const This* _owner = nullptr;
377  size_t _pos = 0;
378  };
379 
380 public:
384  typedef size_t size_type;
385  typedef ptrdiff_t difference_type;
386 
388  {
389  }
390 
391  SdfChildrenView(const SdfLayerHandle &layer, const SdfPath &path,
392  const TfToken &childrenKey,
393  const KeyPolicy& keyPolicy = KeyPolicy()) :
394  _children(layer, path, childrenKey, keyPolicy)
395  {
396  }
397 
398  SdfChildrenView(const SdfLayerHandle &layer, const SdfPath &path,
399  const TfToken &childrenKey,
400  const Predicate& predicate,
401  const KeyPolicy& keyPolicy = KeyPolicy()) :
402  _children(layer, path, childrenKey, keyPolicy),
403  _predicate(predicate)
404  {
405  }
406 
408  _children(other._children),
409  _predicate(other._predicate)
410  {
411  }
412 
413  template <class OtherAdapter>
415  OtherAdapter> &other) :
416  _children(other._children),
417  _predicate(other._predicate)
418  {
419  }
420 
422  {
423  }
424 
426  {
427  _children= other._children;
428  _predicate = other._predicate;
429  return *this;
430  }
431 
432  /// Returns an const_iterator pointing to the beginning of the vector.
434  _InnerIterator i(this,0);
435  return _Traits::GetIterator(this, i, _GetSize());
436  }
437 
438  /// Returns an const_iterator pointing to the end of the vector.
439  const_iterator end() const {
440  _InnerIterator i(this,_GetSize());
441  return _Traits::GetIterator(this, i, _GetSize());
442  }
443 
444  /// Returns an const_reverse_iterator pointing to the beginning of the
445  /// reversed vector.
447  return const_reverse_iterator(end());
448  }
449 
450  /// Returns an const_reverse_iterator pointing to the end of the
451  /// reversed vector.
453  return const_reverse_iterator(begin());
454  }
455 
456  /// Returns the size of the vector.
457  size_type size() const {
458  return std::distance(begin(), end());
459  }
460 
461  /// Returns \c true if the vector is empty.
462  bool empty() const {
463  return begin() == end();
464  }
465 
466  /// Returns the \p n'th element.
468  const_iterator i = begin();
469  std::advance(i, n);
470  return *i;
471  }
472 
473  /// Returns the first element.
474  value_type front() const {
475  return *begin();
476  }
477 
478  /// Returns the last element.
479  value_type back() const {
480  return *rbegin();
481  }
482 
483  /// Finds the element with key \p x.
484  const_iterator find(const key_type& x) const {
485  _InnerIterator inner(this, _children.Find(x));
486  const_iterator iter = _Traits::GetIterator(this, inner, _GetSize());
487 
488  // _Traits::GetIterator may return a filtered iterator. We need to
489  // check that that iterator actually corresponds to the desired item.
490  // This ensures that we return end() in the case where the element being
491  // searched for is present in the children but filtered out by the
492  // view's predicate.
493  return _Traits::GetBase(iter) == inner ? iter : end();
494  }
495 
496  /// Finds element \p x, if present in this view.
497  const_iterator find(const value_type& x) const {
498  const_iterator i = find(key(x));
499  return (i != end() && *i == x) ? i : end();
500  }
501 
502  /// Returns the key for an element.
503  key_type key(const const_iterator& x) const {
504  return key(*x);
505  }
506 
507  /// Returns the key for a value.
508  key_type key(const value_type& x) const {
509  return _children.FindKey(Adapter::Convert(x));
510  }
511 
512  /// Returns the elements, in order.
513  std::vector<value_type> values() const {
514  return std::vector<value_type>(begin(), end());
515  }
516 
517  /// Returns the elements, in order.
518  template <typename V>
519  V values_as() const {
520  V x;
521  std::copy(begin(), end(), std::inserter(x, x.begin()));
522  return x;
523  }
524 
525  /// Returns the keys for all elements, in order.
526  std::vector<key_type> keys() const {
527  std::vector<key_type> result;
528  result.reserve(size());
529  for (const_iterator i = begin(), n = end(); i != n; ++i) {
530  result.push_back(key(i));
531  }
532  return result;
533  }
534 
535  /// Returns the keys for all elements, in order.
536  template <typename V>
537  V keys_as() const {
538  std::vector<key_type> k = keys();
539  return V(k.begin(), k.end());
540  }
541 
542  /// Returns the elements as a dictionary.
543  template <typename Dict>
544  Dict items_as() const {
545  Dict result;
546  for (const_iterator i = begin(), n = end(); i != n; ++i) {
547  result.insert(std::make_pair(key(i), *i));
548  }
549  return result;
550  }
551 
552  /// Returns true if an element with key \p x is in the container.
553  bool has(const key_type& x) const {
554  return (_children.Find(x) != _GetSize());
555  }
556 
557  /// Returns true if an element with the same key as \p x is in
558  /// the container.
559  bool has(const value_type& x) const {
560  return has(key(Adapter::Convert(x)));
561  }
562 
563  /// Returns the number of elements with key \p x in the container.
564  size_type count(const key_type& x) const {
565  return has(x);
566  }
567 
568  /// Returns the element with key \p x or a default constructed value
569  /// if no such element exists.
570  value_type get(const key_type& x) const {
571  size_t index = _children.Find(x);
572  if (index == _GetSize()) {
573  return value_type();
574  }
575  return _Get(index);
576  }
577 
578  /// Returns the element with key \p x or the fallback if no such
579  /// element exists.
580  value_type get(const key_type& x, const value_type& fallback) const {
581  size_t index = _children.Find(x);
582  if (index == _GetSize()) {
583  return fallback;
584  }
585  return _Get(index);
586  }
587 
588  /// Returns the element with key \p x or a default constructed value
589  /// if no such element exists.
590  value_type operator[](const key_type& x) const {
591  return get(x);
592  }
593 
594  /// Compares children for equality. Children are equal if the
595  /// list edits are identical and the keys contain the same elements.
596  bool operator==(const This& other) const {
597  return _children.IsEqualTo(other._children);
598  }
599 
600  /// Compares children for inequality. Children are not equal if
601  /// list edits are not identical or the keys don't contain the same
602  /// elements.
603  bool operator!=(const This& other) const {
604  return !_children.IsEqualTo(other._children);
605  }
606 
607  // Return true if this object is valid
608  bool IsValid() const {
609  return _children.IsValid();
610  }
611 
612  // Return the Sd_Children object that this view is holding.
614  return _children;
615  }
616 
617  // Return this view's predicate.
618  const Predicate& GetPredicate() const {
619  return _predicate;
620  }
621 
622 private:
623  // Return the value that corresponds to the provided index.
624  value_type _Get(size_type index) const {
625  return Adapter::Convert(_children.GetChild(index));
626  }
627 
628  // Return the number of elements
629  size_t _GetSize() const {
630  return _children.GetSize();
631  }
632 
633 private:
634  template <class V, class P, class A> friend class SdfChildrenView;
635  ChildrenType _children;
636  Predicate _predicate;
637 };
638 
639 /// Helper class to convert a given view of type \c _View to an
640 /// adapted view using \c _Adapter as the adapter class.
641 template <class _View, class _Adapter>
643 {
644  typedef _View OriginalView;
645  typedef SdfChildrenView<typename _View::ChildPolicy,
646  typename _View::Predicate,
647  _Adapter> AdaptedView;
648 
650  {
651  return AdaptedView(view);
652  }
653 };
654 
655 // Allow TfIteration over children views.
656 template <typename C, typename P, typename A>
657 struct Tf_ShouldIterateOverCopy<SdfChildrenView<C, P, A> > : std::true_type
658 {
659 };
660 template <typename C, typename P, typename A>
664  static IteratorType Begin(Type const &c) { return c.begin(); }
665  static IteratorType End(Type const &c) { return c.end(); }
666 };
667 template <typename C, typename P, typename A>
671  static IteratorType Begin(Type const &c) { return c.rbegin(); }
672  static IteratorType End(Type const &c) { return c.rend(); }
673 };
674 
676 
677 #endif // PXR_USD_SDF_CHILDREN_VIEW_H
SDF_API bool IsEqualTo(const This &other) const
Return true if this object and other are equivalent.
Dict items_as() const
Returns the elements as a dictionary.
Definition: childrenView.h:544
_Adapter Adapter
Definition: childrenView.h:226
SDF_API size_t GetSize() const
Return the number of children that this object contains.
Sdf_Children< ChildPolicy > ChildrenType
Definition: childrenView.h:230
SdfChildrenView(const SdfLayerHandle &layer, const SdfPath &path, const TfToken &childrenKey, const KeyPolicy &keyPolicy=KeyPolicy())
Definition: childrenView.h:391
value_type back() const
Returns the last element.
Definition: childrenView.h:479
SdfChildrenView< typename _View::ChildPolicy, typename _View::Predicate, _Adapter > AdaptedView
Definition: childrenView.h:647
OIIO_UTIL_API bool copy(string_view from, string_view to, std::string &err)
_FilterIterator const_iterator
Definition: childrenView.h:151
static const const_iterator & GetIterator(const _Owner *, const _InnerIterator &i, size_t size)
Definition: childrenView.h:182
static const _InnerIterator & GetBase(const const_iterator &i)
Definition: childrenView.h:165
ptrdiff_t difference_type
Definition: childrenView.h:385
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
_Traits::const_iterator const_iterator
Definition: childrenView.h:382
bool IsValid() const
Definition: childrenView.h:608
IMATH_HOSTDEVICE constexpr Plane3< T > operator-(const Plane3< T > &plane) IMATH_NOEXCEPT
Reflect the pla.
Definition: ImathPlane.h:253
ChildrenType & GetChildren()
Definition: childrenView.h:613
V values_as() const
Returns the elements, in order.
Definition: childrenView.h:519
IMATH_HOSTDEVICE constexpr bool equal(T1 a, T2 b, T3 t) IMATH_NOEXCEPT
Definition: ImathFun.h:105
**But if you need a result
Definition: thread.h:613
_ChildPolicy ChildPolicy
Definition: childrenView.h:228
bool empty() const
Returns true if the vector is empty.
Definition: childrenView.h:462
bool has(const value_type &x) const
Definition: childrenView.h:559
const_iterator begin() const
Returns an const_iterator pointing to the beginning of the vector.
Definition: childrenView.h:433
SDF_API KeyType FindKey(const ValueType &value) const
uint64 value_type
Definition: GA_PrimCompat.h:29
OIIO_FORCEINLINE vbool4 operator>=(const vint4 &a, const vint4 &b)
Definition: simd.h:4577
GLenum GLuint GLint GLint layer
Definition: glcorearb.h:1299
V keys_as() const
Returns the keys for all elements, in order.
Definition: childrenView.h:537
ChildPolicy::KeyType key_type
Definition: childrenView.h:232
std::vector< value_type > values() const
Returns the elements, in order.
Definition: childrenView.h:513
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
size_type size() const
Returns the size of the vector.
Definition: childrenView.h:457
OIIO_FORCEINLINE vbool4 operator>(const vint4 &a, const vint4 &b)
Definition: simd.h:4561
GLdouble n
Definition: glcorearb.h:2008
Tf_ProxyReferenceReverseIterator< const_iterator > const_reverse_iterator
Definition: childrenView.h:383
#define TF_DEV_AXIOM(cond)
OIIO_FORCEINLINE vbool4 operator<=(const vint4 &a, const vint4 &b)
Definition: simd.h:4581
SdfChildrenView(const SdfChildrenView< ChildPolicy, Predicate, OtherAdapter > &other)
Definition: childrenView.h:414
size_type count(const key_type &x) const
Returns the number of elements with key x in the container.
Definition: childrenView.h:564
SDF_API ValueType GetChild(size_t index) const
Return the child at the specified index.
Definition: token.h:87
value_type front() const
Returns the first element.
Definition: childrenView.h:474
const_iterator find(const value_type &x) const
Finds element x, if present in this view.
Definition: childrenView.h:497
Adapter::PublicType value_type
Definition: childrenView.h:233
SdfChildrenView & operator=(const SdfChildrenView &other)
Definition: childrenView.h:425
OIIO_FORCEINLINE const vint4 & operator+=(vint4 &a, const vint4 &b)
Definition: simd.h:4369
GLuint GLuint end
Definition: glcorearb.h:475
const_reverse_iterator rend() const
Definition: childrenView.h:452
SdfChildrenView< _ChildPolicy, _Predicate, _Adapter > This
Definition: childrenView.h:224
bool operator<(const GU_TetrahedronFacet &a, const GU_TetrahedronFacet &b)
IMATH_HOSTDEVICE constexpr Color4< T > operator*(S a, const Color4< T > &v) IMATH_NOEXCEPT
Reverse multiplication: S * Color4.
Definition: ImathColor.h:732
bool operator()(const T &x) const
Definition: childrenView.h:50
key_type key(const value_type &x) const
Returns the key for a value.
Definition: childrenView.h:508
Definition: path.h:290
GLint GLenum GLint x
Definition: glcorearb.h:409
IMATH_HOSTDEVICE constexpr Quat< T > operator+(const Quat< T > &q1, const Quat< T > &q2) IMATH_NOEXCEPT
Quaterion addition.
Definition: ImathQuat.h:905
GLdouble t
Definition: glad.h:2397
GLsizeiptr size
Definition: glcorearb.h:664
GLenum void ** pointer
Definition: glcorearb.h:810
value_type operator[](size_type n) const
Returns the n'th element.
Definition: childrenView.h:467
PXR_NAMESPACE_CLOSE_SCOPE PXR_NAMESPACE_OPEN_SCOPE
Definition: path.h:1432
bool has(const key_type &x) const
Returns true if an element with key x is in the container.
Definition: childrenView.h:553
SdfChildrenView(const SdfLayerHandle &layer, const SdfPath &path, const TfToken &childrenKey, const Predicate &predicate, const KeyPolicy &keyPolicy=KeyPolicy())
Definition: childrenView.h:398
key_type key(const const_iterator &x) const
Returns the key for an element.
Definition: childrenView.h:503
value_type operator[](const key_type &x) const
Definition: childrenView.h:590
GLuint index
Definition: glcorearb.h:786
static const PublicType & Convert(const PrivateType &t)
Definition: childrenView.h:62
const Predicate & GetPredicate() const
Definition: childrenView.h:618
#define PXR_NAMESPACE_CLOSE_SCOPE
Definition: pxr.h:91
OIIO_FORCEINLINE const vint4 & operator-=(vint4 &a, const vint4 &b)
Definition: simd.h:4392
Definition: core.h:982
static AdaptedView Create(const OriginalView &view)
Definition: childrenView.h:649
const_iterator end() const
Returns an const_iterator pointing to the end of the vector.
Definition: childrenView.h:439
Definition: core.h:1131
std::vector< key_type > keys() const
Returns the keys for all elements, in order.
Definition: childrenView.h:526
bool operator!=(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:165
static const_iterator GetIterator(const _Owner *owner, const _InnerIterator &i, size_t size)
Definition: childrenView.h:156
const_reverse_iterator rbegin() const
Definition: childrenView.h:446
SIM_API const UT_StringHolder distance
ChildPolicy::KeyPolicy KeyPolicy
Definition: childrenView.h:229
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
bool operator==(const This &other) const
Definition: childrenView.h:596
Sdf_ChildrenViewTraits< This, _InnerIterator, Predicate > _Traits
Definition: childrenView.h:381
const_iterator find(const key_type &x) const
Finds the element with key x.
Definition: childrenView.h:484
bool ValueType
Definition: NanoVDB.h:5729
_Predicate Predicate
Definition: childrenView.h:227
SDF_API bool IsValid() const
Return whether this object is valid.
bool operator!=(const This &other) const
Definition: childrenView.h:603
SdfChildrenView(const SdfChildrenView &other)
Definition: childrenView.h:407
SDF_API size_t Find(const KeyType &key) const
Find the index of the specified key, or return the size if it's not found.