Great, thanks very much for that, Steve. Tim
On 17/07/2010 11:57, Steve Reinhardt wrote:
changeset b543b8e5fcbc in /z/repo/m5 details: http://repo.m5sim.org/m5?cmd=changeset;node=b543b8e5fcbc description: SimObject: transparently forward Python attribute refs to C++. 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. diffstat: src/python/m5/SimObject.py | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diffs (17 lines): diff -r be7c22eb8c20 -r b543b8e5fcbc src/python/m5/SimObject.py --- a/src/python/m5/SimObject.py Thu Jul 15 02:11:56 2010 -0700 +++ b/src/python/m5/SimObject.py Sat Jul 17 08:56:49 2010 -0700 @@ -527,6 +527,13 @@ 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) _______________________________________________ m5-dev mailing list m5-dev@m5sim.org http://m5sim.org/mailman/listinfo/m5-dev
-- Timothy M. Jones http://homepages.inf.ed.ac.uk/tjones1 The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. _______________________________________________ m5-dev mailing list m5-dev@m5sim.org http://m5sim.org/mailman/listinfo/m5-dev