Python: Make the All proxy traverse SimObject children as well

This patch changes the behaviour of the All proxy parameter to not
only consider the direct children, but also do a pre-order depth-first
traversal of the object tree and append all results from the
children.

This is used in a later patch to find all the memories in the system,
independent of where they are located in the hierarchy.
This commit is contained in:
Andreas Hansson
2012-04-05 10:44:35 -04:00
parent a8e6adb0b1
commit aab2001ab7
2 changed files with 6 additions and 0 deletions

View File

@@ -184,6 +184,8 @@ class AnyProxy(BaseProxy):
def path(self):
return 'any'
# The AllProxy traverses the entire sub-tree (not only the children)
# and adds all objects of a specific type
class AllProxy(BaseProxy):
def find(self, obj):
return obj.find_all(self._pdesc.ptype)