Skip to content
Snippets Groups Projects
Commit 42a05359 authored by Jonathan Lambrechts's avatar Jonathan Lambrechts
Browse files

dg : functionPython can access dgDataCacheMap

parent d5b793db
No related branches found
No related tags found
No related merge requests found
#ifndef _FUNCTION_PYTHON_H_ #ifndef _FUNCTION_PYTHON_H_
#define _FUNCTION_PYTHON_H_ #define _FUNCTION_PYTHON_H_
#include "Python.h" #include "Python.h"
class functionPythonReturnMatrix : public fullMatrix<double> {
dataCacheMap *_cacheMap;
public:
void setDataCacheMap(dataCacheMap *cacheMap) {_cacheMap = cacheMap;}
dataCacheMap *getDataCacheMap() const {return _cacheMap;}
};
class functionPython : public function { class functionPython : public function {
PyObject *_pycallback, *_pyargs; PyObject *_pycallback, *_pyargs;
PyObject *_swigR, *_swigCacheMap; PyObject *_swigR, *_swigCacheMap;
std::vector<PyObject*> _swigA; std::vector<PyObject*> _swigA;
std::string _luaFunctionName; std::string _luaFunctionName;
std::vector<fullMatrix<double> > args; std::vector<fullMatrix<double> > args;
fullMatrix<double> R; functionPythonReturnMatrix R;
public: public:
void call (dataCacheMap *m, fullMatrix<double> &res) void call (dataCacheMap *m, fullMatrix<double> &res)
{ {
R.setAsProxy(res); R.setAsProxy(res);
R.setDataCacheMap(m);
PyEval_CallObject(_pycallback, _pyargs); PyEval_CallObject(_pycallback, _pyargs);
} }
functionPython (int nbCol, PyObject *callback, std::vector<const function*> dependencies) functionPython (int nbCol, PyObject *callback, std::vector<const function*> dependencies)
...@@ -19,7 +27,7 @@ class functionPython : public function { ...@@ -19,7 +27,7 @@ class functionPython : public function {
{ {
args.resize(dependencies.size()); args.resize(dependencies.size());
_swigA.resize(args.size()); _swigA.resize(args.size());
_swigR = SWIG_NewPointerObj((void*)&R,SWIGTYPE_p_fullMatrixT_double_t, 0); _swigR = SWIG_NewPointerObj((void*)&R,SWIGTYPE_p_functionPythonReturnMatrix, 0);
for (int i = 0; i < dependencies.size(); i++) { for (int i = 0; i < dependencies.size(); i++) {
setArgument(args[i], dependencies[i]); setArgument(args[i], dependencies[i]);
_swigA[i] = SWIG_NewPointerObj((void*)&args[i],SWIGTYPE_p_fullMatrixT_double_t, 0); _swigA[i] = SWIG_NewPointerObj((void*)&args[i],SWIGTYPE_p_fullMatrixT_double_t, 0);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment