24 #ifndef PXR_USD_PCP_ITERATOR_H 25 #define PXR_USD_PCP_ITERATOR_H 28 #include "pxr/usd/pcp/api.h" 29 #include "pxr/usd/pcp/node.h" 33 #include "pxr/usd/sdf/site.h" 37 #include <boost/iterator/iterator_facade.hpp> 38 #include <boost/iterator/reverse_iterator.hpp> 40 PXR_NAMESPACE_OPEN_SCOPE
43 class PcpPrimIndex_Graph;
52 :
public boost::iterator_facade<
55 boost::random_access_traversal_tag,
64 Pcp_CompressedSdSite GetCompressedSdSite(
size_t layerIndex)
const 66 return Pcp_CompressedSdSite(_nodeIdx, layerIndex);
72 _graph(graph), _nodeIdx(nodeIdx) {}
74 friend class boost::iterator_core_access;
76 void increment() { ++_nodeIdx; }
77 void decrement() { --_nodeIdx; }
78 void advance(difference_type n) { _nodeIdx += n; }
80 return (difference_type)(other._nodeIdx) - _nodeIdx;
83 return (_graph == other._graph) & (_nodeIdx == other._nodeIdx);
85 reference dereference()
const {
90 PcpPrimIndex_Graph* _graph;
100 :
public boost::reverse_iterator<PcpNodeIterator>
105 : boost::reverse_iterator<PcpNodeIterator>(iter) { }
114 :
public boost::iterator_facade<
117 boost::random_access_traversal_tag,
138 Pcp_SdSiteRef _GetSiteRef()
const;
141 friend class boost::iterator_core_access;
147 void advance(difference_type n);
153 reference dereference()
const;
166 :
public boost::reverse_iterator<PcpPrimIterator>
171 : boost::reverse_iterator<PcpPrimIterator>(iter) { }
176 return (--tmp).GetNode();
179 Pcp_SdSiteRef _GetSiteRef()
const 182 return (--tmp)._GetSiteRef();
192 :
public boost::iterator_facade<
194 const SdfPropertySpecHandle,
195 boost::random_access_traversal_tag
218 friend class boost::iterator_core_access;
224 void advance(difference_type n);
230 reference dereference()
const;
243 :
public boost::reverse_iterator<PcpPropertyIterator>
248 : boost::reverse_iterator<PcpPropertyIterator>(iter) { }
253 return (--tmp).GetNode();
259 return (--tmp).IsLocal();
266 #define PCP_DEFINE_RANGE(Range, Iterator, ReverseIterator) \ 267 typedef std::pair<Iterator, Iterator> Range; \ 269 inline Iterator begin(Range &range) { return range.first; } \ 270 inline Iterator begin(const Range &range) { return range.first; } \ 271 inline Iterator end(Range &range) { return range.second; } \ 272 inline Iterator end(const Range &range) { return range.second; } \ 275 struct Tf_IteratorInterface<Range, false> { \ 276 typedef Iterator IteratorType; \ 277 static IteratorType Begin(Range &c) { return c.first; } \ 278 static IteratorType End(Range &c) { return c.second; } \ 282 struct Tf_IteratorInterface<const Range, false> { \ 283 typedef Iterator IteratorType; \ 284 static IteratorType Begin(Range const &c) { return c.first; } \ 285 static IteratorType End(Range const &c) { return c.second; } \ 289 struct Tf_IteratorInterface<Range, true> { \ 290 typedef ReverseIterator IteratorType; \ 291 static IteratorType Begin(Range &c) \ 292 { return IteratorType(c.second); } \ 293 static IteratorType End(Range &c) \ 294 { return IteratorType(c.first); } \ 298 struct Tf_IteratorInterface<const Range, true> { \ 299 typedef ReverseIterator IteratorType; \ 300 static IteratorType Begin(Range const &c) \ 301 { return IteratorType(c.second); } \ 302 static IteratorType End(Range const &c) \ 303 { return IteratorType(c.first); } \ 307 struct Tf_ShouldIterateOverCopy<Range> : boost::true_type {}; \ 310 struct Tf_ShouldIterateOverCopy<const Range> : boost::true_type {} 327 typedef PcpNodeRange RangeType;
334 typedef PcpPrimRange RangeType;
341 typedef PcpPropertyRange RangeType;
345 PXR_NAMESPACE_CLOSE_SCOPE
347 #endif // PXR_USD_PCP_ITERATOR_H PCP_API bool IsLocal() const
Returns true if the current property is local to the owning property index's layer stack,...
Object used to iterate over nodes in the prim index graph in weak-to-strong order.
PcpPrimIndex is an index of the all sites of scene description that contribute opinions to a specific...
A simple iterator adapter for STL containers.
PcpNode represents a node in an expression tree for compositing scene description.
PCP_API PcpNodeRef GetNode() const
Returns the PcpNode from which the current prim originated.
PCP_API PcpPropertyIterator()
Constructs an invalid iterator.
Object used to iterate over nodes in the prim index graph in strong-to-weak order.
PCP_API PcpPrimIterator()
Constructs an invalid iterator.
constexpr size_t PCP_INVALID_INDEX
A value which indicates an invalid index.
Object used to iterate over prim specs in the prim index graph in weak-to-strong order.
Object used to iterate over prim specs in the prim index graph in strong-to-weak order.
Object used to iterate over property specs in a property index in strong-to-weak order.
Object used to iterate over property specs in a property index in weak-to-strong order.
PcpPropertyIndex is an index of all sites in scene description that contribute opinions to a specific...
PCP_API PcpNodeRef GetNode() const
Returns the PcpNode from which the current property originated.
PcpNodeIterator()
Constructs an invalid iterator.
Traits class for retrieving useful characteristics about one of the Pcp iterator types above.