Begin templating
This commit is contained in:
@@ -83,7 +83,8 @@ namespace pywrap {
|
||||
PyErr_Print();
|
||||
exit(1);
|
||||
}
|
||||
void PyWrap::callMethod(const std::string& moduleName, const std::string& className, const std::string& method)
|
||||
template<typename T>
|
||||
T PyWrap::callMethod(const std::string& moduleName, const std::string& className, const std::string& method)
|
||||
{
|
||||
std::cout << "Llamando método" << std::endl;
|
||||
auto item = moduleClassMap.find({ moduleName, className });
|
||||
@@ -95,8 +96,11 @@ namespace pywrap {
|
||||
PyObject* result;
|
||||
if (!(result = PyObject_CallMethod(instance, method.c_str(), NULL)))
|
||||
errorAbort("Couldn't call method " + method);
|
||||
std::cout << "Result: " << PyUnicode_AsUTF8(result) << std::endl;
|
||||
|
||||
T value = PyUnicode_AsUTF8(result);
|
||||
std::cout << "Result: " << value << std::endl;
|
||||
Py_DECREF(result);
|
||||
return value;
|
||||
}
|
||||
// void PyWrap::doCommand2()
|
||||
// {
|
||||
|
Reference in New Issue
Block a user