comparison PyPlugin.h @ 67:146d14ab15e7

Debug output: off by default, on with VAMPY_VERBOSE environment variable
author Chris Cannam
date Mon, 17 Nov 2014 10:03:44 +0000
parents 5664fe298af2
children 40a01bb24209 f5c028376bf9
comparison
equal deleted inserted replaced
66:5664fe298af2 67:146d14ab15e7
47 #define _PYTHON_WRAPPER_PLUGIN_H_ 47 #define _PYTHON_WRAPPER_PLUGIN_H_
48 48
49 #define _CLASS_METHOD_ m_class << "::" << method 49 #define _CLASS_METHOD_ m_class << "::" << method
50 #define PLUGIN_ERROR "ERROR: In Vampy plugin [" << _CLASS_METHOD_ << "]" << endl << "Cause: " 50 #define PLUGIN_ERROR "ERROR: In Vampy plugin [" << _CLASS_METHOD_ << "]" << endl << "Cause: "
51 #define DEBUG_NAME "[Vampy::call] " << _CLASS_METHOD_ << " " 51 #define DEBUG_NAME "[Vampy::call] " << _CLASS_METHOD_ << " "
52 #define DEAFULT_RETURN "Method [" << _CLASS_METHOD_ << "] is not implemented. Returning default value." 52 #define DEFAULT_RETURN "Method [" << _CLASS_METHOD_ << "] is not implemented. Returning default value."
53 #define FLAG_VALUE "Flag: " << flagName << ": " << ((rValue==0)?"False":"True") 53 #define FLAG_VALUE "Flag: " << flagName << ": " << ((rValue==0)?"False":"True")
54 54
55 #include <Python.h> 55 #include <Python.h>
56 #include "PyExtensionModule.h" 56 #include "PyExtensionModule.h"
57 #include "PyTypeInterface.h" 57 #include "PyTypeInterface.h"
169 Py_CLEAR(pyValue); 169 Py_CLEAR(pyValue);
170 typeErrorHandler(method); 170 typeErrorHandler(method);
171 } 171 }
172 return rValue; 172 return rValue;
173 } 173 }
174 if (m_debugFlag) cerr << DEAFULT_RETURN << endl; 174 if (m_debugFlag) cerr << DEFAULT_RETURN << endl;
175 return rValue; 175 return rValue;
176 } 176 }
177 177
178 /// unary call 178 /// unary call
179 template<typename RET,typename A1> 179 template<typename RET,typename A1>
180 RET genericMethodCallArgs(const char *method, A1 arg1) const 180 RET genericMethodCallArgs(const char *method, A1 arg1) const
181 { 181 {
182 RET rValue = RET(); 182 RET rValue = RET();
183 if (m_debugFlag) cerr << DEBUG_NAME << endl; 183 if (m_debugFlag) cerr << DEBUG_NAME << endl;
184 if (!PyObject_HasAttrString(m_pyInstance,method)) { 184 if (!PyObject_HasAttrString(m_pyInstance,method)) {
185 if (m_debugFlag) cerr << DEAFULT_RETURN << endl; 185 if (m_debugFlag) cerr << DEFAULT_RETURN << endl;
186 return rValue; 186 return rValue;
187 } 187 }
188 188
189 /// prepare arguments for fast method call 189 /// prepare arguments for fast method call
190 PyObject *pyMethod = m_ti.PyValue_From_CValue(method); 190 PyObject *pyMethod = m_ti.PyValue_From_CValue(method);
246 RET genericMethodCallArgs(const char *method, A1 arg1, A2 arg2) const 246 RET genericMethodCallArgs(const char *method, A1 arg1, A2 arg2) const
247 { 247 {
248 RET rValue = RET(); 248 RET rValue = RET();
249 if (m_debugFlag) cerr << DEBUG_NAME << endl; 249 if (m_debugFlag) cerr << DEBUG_NAME << endl;
250 if (!PyObject_HasAttrString(m_pyInstance,method)) { 250 if (!PyObject_HasAttrString(m_pyInstance,method)) {
251 if (m_debugFlag) cerr << DEAFULT_RETURN << endl; 251 if (m_debugFlag) cerr << DEFAULT_RETURN << endl;
252 return rValue; 252 return rValue;
253 } 253 }
254 254
255 /// prepare arguments for fast method call 255 /// prepare arguments for fast method call
256 PyObject *pyMethod = m_ti.PyValue_From_CValue(method); 256 PyObject *pyMethod = m_ti.PyValue_From_CValue(method);
318 RET genericMethodCallArgs(const char *method, A1 arg1, A2 arg2, A3 arg3) const 318 RET genericMethodCallArgs(const char *method, A1 arg1, A2 arg2, A3 arg3) const
319 { 319 {
320 RET rValue = RET(); 320 RET rValue = RET();
321 if (m_debugFlag) cerr << DEBUG_NAME << endl; 321 if (m_debugFlag) cerr << DEBUG_NAME << endl;
322 if (!PyObject_HasAttrString(m_pyInstance,method)) { 322 if (!PyObject_HasAttrString(m_pyInstance,method)) {
323 if (m_debugFlag) cerr << DEAFULT_RETURN << endl; 323 if (m_debugFlag) cerr << DEFAULT_RETURN << endl;
324 return rValue; 324 return rValue;
325 } 325 }
326 326
327 /// prepare arguments for fast method call 327 /// prepare arguments for fast method call
328 PyObject *pyMethod = m_ti.PyValue_From_CValue(method); 328 PyObject *pyMethod = m_ti.PyValue_From_CValue(method);