Commit 5487dc25 authored by Maximilien Naveau's avatar Maximilien Naveau
Browse files

[sot-loader] Allow the user to load the device in python from a simple string.

parent 3a1c4b46
Pipeline #16934 failed with stage
in 8 minutes and 48 seconds
......@@ -95,6 +95,9 @@ public:
/// \brief Load the Device entity in the python global scope.
void loadDeviceInPython(const Device &device);
/// \brief Load the Device entity in the python global scope.
void loadDeviceInPython(const std::string &device_name);
};
} /* namespace sot */
......
......@@ -174,6 +174,10 @@ void SotLoader::oneIteration() {
}
void SotLoader::loadDeviceInPython(const Device &device) {
loadDeviceInPython(device.getName());
}
void SotLoader::loadDeviceInPython(const std::string &device_name) {
std::string result, out, err;
// Debug print.
runPythonCommand("print(\"Load device from C++ to Python...\")", result, out,
......@@ -184,7 +188,7 @@ void SotLoader::loadDeviceInPython(const Device &device) {
err);
// Get the existing C++ entity pointer in the Python interpreter.
runPythonCommand("device_cpp_object = Device(" + device.getName() + ")",
runPythonCommand("device_cpp_object = Device(" + device_name + ")",
result, out, err);
// Debug print.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment