SimObject.py (9345:b557fcea030d) SimObject.py (9410:f329e7ec9786)
1# Copyright (c) 2012 ARM Limited
2# All rights reserved.
3#
4# The license below extends only to copyright in the software and shall
5# not be construed as granting a license to any other intellectual
6# property including but not limited to intellectual property relating
7# to a hardware implementation of the functionality of the software
8# licensed hereunder. You may use the software subject to the license

--- 858 unchanged lines hidden (view full) ---

867 'parent.any matched more than one: %s and %s' % (found_obj.path, match_obj.path)
868 found_obj = match_obj
869 return found_obj, found_obj != None
870
871 def find_all(self, ptype):
872 all = {}
873 # search children
874 for child in self._children.itervalues():
1# Copyright (c) 2012 ARM Limited
2# All rights reserved.
3#
4# The license below extends only to copyright in the software and shall
5# not be construed as granting a license to any other intellectual
6# property including but not limited to intellectual property relating
7# to a hardware implementation of the functionality of the software
8# licensed hereunder. You may use the software subject to the license

--- 858 unchanged lines hidden (view full) ---

867 'parent.any matched more than one: %s and %s' % (found_obj.path, match_obj.path)
868 found_obj = match_obj
869 return found_obj, found_obj != None
870
871 def find_all(self, ptype):
872 all = {}
873 # search children
874 for child in self._children.itervalues():
875 if isinstance(child, ptype) and not isproxy(child) and \
876 not isNullPointer(child):
877 all[child] = True
878 if isSimObject(child):
879 # also add results from the child itself
880 child_all, done = child.find_all(ptype)
881 all.update(dict(zip(child_all, [done] * len(child_all))))
875 # a child could be a list, so ensure we visit each item
876 if isinstance(child, list):
877 children = child
878 else:
879 children = [child]
880
881 for child in children:
882 if isinstance(child, ptype) and not isproxy(child) and \
883 not isNullPointer(child):
884 all[child] = True
885 if isSimObject(child):
886 # also add results from the child itself
887 child_all, done = child.find_all(ptype)
888 all.update(dict(zip(child_all, [done] * len(child_all))))
882 # search param space
883 for pname,pdesc in self._params.iteritems():
884 if issubclass(pdesc.ptype, ptype):
885 match_obj = self._values[pname]
886 if not isproxy(match_obj) and not isNullPointer(match_obj):
887 all[match_obj] = True
888 return all.keys(), True
889

--- 235 unchanged lines hidden ---
889 # search param space
890 for pname,pdesc in self._params.iteritems():
891 if issubclass(pdesc.ptype, ptype):
892 match_obj = self._values[pname]
893 if not isproxy(match_obj) and not isNullPointer(match_obj):
894 all[match_obj] = True
895 return all.keys(), True
896

--- 235 unchanged lines hidden ---