projects
/
gem5.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
8cec870
)
SimObject: transparently forward Python attribute refs to C++.
author
Steve Reinhardt
<steve.reinhardt@amd.com>
Sat, 17 Jul 2010 15:56:49 +0000
(08:56 -0700)
committer
Steve Reinhardt
<steve.reinhardt@amd.com>
Sat, 17 Jul 2010 15:56:49 +0000
(08:56 -0700)
This tidbit was pulled from a larger patch for Tim's sake, so
the comment reflects functions that haven't been exported yet.
I hope to commit them soon so it didn't seem worth cleaning up.
src/python/m5/SimObject.py
patch
|
blob
|
history
diff --git
a/src/python/m5/SimObject.py
b/src/python/m5/SimObject.py
index e6f0e36b2699e7adacb8fa9228ee0a9e3772e9bd..3b84d60007fab867a6404ab9a2fd337c55731c53 100644
(file)
--- a/
src/python/m5/SimObject.py
+++ b/
src/python/m5/SimObject.py
@@
-527,6
+527,13
@@
class SimObject(object):
if self._values.has_key(attr):
return self._values[attr]
+ # If the attribute exists on the C++ object, transparently
+ # forward the reference there. This is typically used for
+ # SWIG-wrapped methods such as init(), regStats(),
+ # regFormulas(), resetStats(), and startup().
+ if self._ccObject and hasattr(self._ccObject, attr):
+ return getattr(self._ccObject, attr)
+
raise AttributeError, "object '%s' has no attribute '%s'" \
% (self.__class__.__name__, attr)