12 #define min(a,b) (((a)<(b))?(a):(b))
20 ( PyObject*
self,
const char* method,
char* buf )
22 if ( 0 ==
self || 0 == method ) {
return 1 ; }
23 PyObject* r = PyObject_CallMethod(
self, const_cast<char*>(method),
24 const_cast<char*>(
"s"), buf);
26 string err(
"Unsuccessful call to bound Python method");
28 PyErr_SetString( PyExc_TypeError , err.c_str() ) ;
40 (PyObject*
self): stringbuf(), m_self(
self)
42 Py_INCREF(this->m_self);
43 this->m_callbackBuff =
new char[512];
51 Py_DECREF( this->m_self );
52 delete this->m_callbackBuff;
62 for ( length = 0, x = this->pbase(); x < this->epptr(); x++ , length++ ) ;
64 memcpy( this->m_callbackBuff, this->pbase(),
min(length, 512) );
65 this->m_callbackBuff[
min(length, 512) ] =
'\0';
69 setp( this->pbase() , this->pbase() );
70 setg( this->eback(), this->eback(), this->eback() );
virtual int sync()
reimplementation of stringbuf::sync()
~CallbackStreamBuf()
CallbackStreamBuf destructor.
CallbackStreamBuf(PyObject *self)
CallbackStreamBuf constructor.
GAUDI_API StatusCode call_python_method(PyObject *self, const char *method)
call the python method