summaryrefslogtreecommitdiff
path: root/src/python/swig/pyobject.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/python/swig/pyobject.cc')
-rw-r--r--src/python/swig/pyobject.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/python/swig/pyobject.cc b/src/python/swig/pyobject.cc
index 51bd1f62f..fed60ba46 100644
--- a/src/python/swig/pyobject.cc
+++ b/src/python/swig/pyobject.cc
@@ -157,9 +157,12 @@ extern "C" SimObject *convertSwigSimObjectPtr(PyObject *);
// these in sim/main.cc as well that are handled without this define.
#define PCC(s) const_cast<char *>(s)
+/** Single instance of PythonSimObjectResolver as its action is effectively
+ * static but SimObjectResolver can use a non-persistent object */
+PythonSimObjectResolver pythonSimObjectResolver;
SimObject *
-resolveSimObject(const string &name)
+PythonSimObjectResolver::resolveSimObject(const string &name)
{
PyObject *module = PyImport_ImportModule(PCC("m5.SimObject"));
if (module == NULL)
@@ -188,3 +191,9 @@ resolveSimObject(const string &name)
return obj;
}
+
+Checkpoint *
+getCheckpoint(const std::string &cpt_dir)
+{
+ return new Checkpoint(cpt_dir, pythonSimObjectResolver);
+}