6 #ifndef MATERIALX_TRAVERSAL_H
7 #define MATERIALX_TRAVERSAL_H
34 _elemConnect(elemConnect),
42 return _elemDown == rhs._elemDown &&
43 _elemConnect == rhs._elemConnect &&
44 _elemUp == rhs._elemUp;
48 return !(*
this == rhs);
52 return std::tie(_elemDown, _elemConnect, _elemUp) < std::tie(rhs._elemDown, rhs._elemConnect, rhs._elemUp);
55 operator bool()
const;
100 using StackFrame = std::pair<ElementPtr, size_t>;
105 return _elem == rhs._elem &&
106 _stack == rhs._stack &&
107 _prune == rhs._prune;
111 return !(*
this == rhs);
141 return _stack.size();
171 _holdCount = holdCount;
182 vector<StackFrame> _stack;
199 _pathElems.insert(elem);
204 using ElementSet = std::set<ElementPtr>;
205 using StackFrame = std::pair<ElementPtr, size_t>;
210 return _upstreamElem == rhs._upstreamElem &&
211 _stack == rhs._stack &&
212 _prune == rhs._prune;
216 return !(*
this == rhs);
222 return Edge(getDownstreamElement(),
223 getConnectingElement(),
224 getUpstreamElement());
237 return !_stack.empty() ? _stack.back().first :
ElementPtr();
243 return _connectingElem;
249 return _upstreamElem;
256 return !_stack.empty() ? _stack.back().second : 0;
267 return _stack.size();
272 size_t getNodeDepth()
const;
307 _holdCount = holdCount;
318 void returnPathDownstream(
ElementPtr upstreamElem);
323 ElementSet _pathElems;
324 vector<StackFrame> _stack;
340 _pathElems.insert(elem);
345 using ConstElementSet = std::set<ConstElementPtr>;
350 return _elem == rhs._elem;
354 return !(*
this == rhs);
372 _holdCount = holdCount;
381 ConstElementSet _pathElems;
shared_ptr< const Element > ConstElementPtr
A shared pointer to a const Element.
ElementPtr getElement() const
Return the current element in the traversal.
bool getPruneSubtree() const
bool operator!=(const InheritanceIterator &rhs) const
#define MATERIALX_NAMESPACE_BEGIN
bool operator!=(const Edge &rhs) const
GraphIterator & begin(size_t holdCount=0)
TreeIterator(ElementPtr elem)
Edge(ElementPtr elemDown, ElementPtr elemConnect, ElementPtr elemUp)
Edge operator*() const
Dereference this iterator, returning the current edge in the traversal.
bool operator==(const TreeIterator &rhs) const
ElementPtr getConnectingElement() const
Return the connecting element of the edge, if any.
void setPruneSubgraph(bool prune)
bool operator!=(const TreeIterator &rhs) const
ElementPtr getUpstreamElement() const
Return the upstream element of the edge.
ElementPtr getUpstreamElement() const
Return the upstream element of the current edge.
MX_CORE_API const TreeIterator NULL_TREE_ITERATOR
PXL_API const char * getName(const ColorSpace *space)
Return the name of the color space.
bool operator!=(const GraphIterator &rhs) const
bool operator==(const Edge &rhs) const
TreeIterator & begin(size_t holdCount=0)
ElementPtr getConnectingElement() const
Return the connecting element, if any, of the current edge.
MX_CORE_API const InheritanceIterator NULL_INHERITANCE_ITERATOR
size_t getUpstreamIndex() const
MX_CORE_API const Edge NULL_EDGE
GraphIterator(ElementPtr elem)
Exception(const string &msg)
shared_ptr< Element > ElementPtr
ElementPtr getDownstreamElement() const
Return the downstream element of the current edge.
size_t getElementDepth() const
InheritanceIterator(ConstElementPtr elem)
ConstElementPtr operator*() const
bool getPruneSubgraph() const
MX_CORE_API const GraphIterator NULL_GRAPH_ITERATOR
bool operator==(const InheritanceIterator &rhs) const
shared_ptr< Element > ElementPtr
A shared pointer to an Element.
InheritanceIterator & begin(size_t holdCount=0)
#define MATERIALX_NAMESPACE_END
size_t getElementDepth() const
void setPruneSubtree(bool prune)
bool operator==(const GraphIterator &rhs) const
bool operator<(const Edge &rhs) const
ElementPtr getDownstreamElement() const
Return the downstream element of the edge.
ElementPtr operator*() const