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:
@@ -865,6 +865,10 @@ class SimObject(object):
|
||||
if isinstance(child, ptype) and not isproxy(child) and \
|
||||
not isNullPointer(child):
|
||||
all[child] = True
|
||||
if isSimObject(child):
|
||||
# also add results from the child itself
|
||||
child_all, done = child.find_all(ptype)
|
||||
all.update(dict(zip(child_all, [done] * len(child_all))))
|
||||
# search param space
|
||||
for pname,pdesc in self._params.iteritems():
|
||||
if issubclass(pdesc.ptype, ptype):
|
||||
|
||||
Reference in New Issue
Block a user