projects
/
gem5.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
config: Fix handling of parents for simobject vectors
[gem5.git]
/
src
/
python
/
m5
/
proxy.py
diff --git
a/src/python/m5/proxy.py
b/src/python/m5/proxy.py
index e539f14eec64ea6f45515d8bbe74bac9b14f2c59..4582b8f091c6e48a523edf34e48a8136c374604a 100644
(file)
--- a/
src/python/m5/proxy.py
+++ b/
src/python/m5/proxy.py
@@
-151,6
+151,10
@@
class AttrProxy(BaseProxy):
def find(self, obj):
try:
val = getattr(obj, self._attr)
def find(self, obj):
try:
val = getattr(obj, self._attr)
+ # for any additional unproxying to be done, pass the
+ # current, rather than the original object so that proxy
+ # has the right context
+ obj = val
except:
return None, False
while isproxy(val):
except:
return None, False
while isproxy(val):
@@
-184,6
+188,15
@@
class AnyProxy(BaseProxy):
def path(self):
return 'any'
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)
+
+ def path(self):
+ return 'all'
+
def isproxy(obj):
if isinstance(obj, (BaseProxy, params.EthernetAddr)):
return True
def isproxy(obj):
if isinstance(obj, (BaseProxy, params.EthernetAddr)):
return True
@@
-201,6
+214,10
@@
class ProxyFactory(object):
def __getattr__(self, attr):
if attr == 'any':
return AnyProxy(self.search_self, self.search_up)
def __getattr__(self, attr):
if attr == 'any':
return AnyProxy(self.search_self, self.search_up)
+ elif attr == 'all':
+ if self.search_up:
+ assert("Parant.all is not supported")
+ return AllProxy(self.search_self, self.search_up)
else:
return AttrProxy(self.search_self, self.search_up, attr)
else:
return AttrProxy(self.search_self, self.search_up, attr)