All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
GaudiPython::CallbackStreamBuf Class Reference

#include <GaudiPython/CallbackStreamBuf.h>

Inheritance diagram for GaudiPython::CallbackStreamBuf:
Collaboration diagram for GaudiPython::CallbackStreamBuf:

Public Member Functions

 CallbackStreamBuf (PyObject *self)
 CallbackStreamBuf constructor. More...
 
 ~CallbackStreamBuf ()
 CallbackStreamBuf destructor. More...
 
virtual int sync ()
 reimplementation of stringbuf::sync() More...
 

Private Attributes

PyObject * m_self
 
char * m_callbackBuff
 

Detailed Description

Definition at line 15 of file CallbackStreamBuf.h.

Constructor & Destructor Documentation

GaudiPython::CallbackStreamBuf::CallbackStreamBuf ( PyObject *  self)

CallbackStreamBuf constructor.

Definition at line 40 of file CallbackStreamBuf.cpp.

40  : stringbuf(), m_self(self)
41 {
42  Py_INCREF(this->m_self);
43  this->m_callbackBuff = new char[512]; //used for passing the flushed chars in the python callback
44 }
GaudiPython::CallbackStreamBuf::~CallbackStreamBuf ( )

CallbackStreamBuf destructor.

Definition at line 49 of file CallbackStreamBuf.cpp.

50 {
51  Py_DECREF( this->m_self );
52  delete this->m_callbackBuff;
53 }

Member Function Documentation

int GaudiPython::CallbackStreamBuf::sync ( )
virtual

reimplementation of stringbuf::sync()

Definition at line 58 of file CallbackStreamBuf.cpp.

59 {
60  int length;
61  char *x;
62  for ( length = 0, x = this->pbase(); x < this->epptr(); x++ , length++ ) ;
63  //getting in a null terminated buffer the characters
64  memcpy( this->m_callbackBuff, this->pbase(), min(length, 512) );
65  this->m_callbackBuff[ min(length, 512) ] = '\0';
66  //calling the python method
68  //reseting in/out buffer pointers
69  setp( this->pbase() , this->pbase() );
70  setg( this->eback(), this->eback(), this->eback() );
71  return 0;
72 }
#define min(a, b)
GAUDI_API StatusCode call_python_method(PyObject *self, const char *method)
call the python method
Definition: Algorithm.cpp:30

Member Data Documentation

char* GaudiPython::CallbackStreamBuf::m_callbackBuff
private

Definition at line 19 of file CallbackStreamBuf.h.

PyObject* GaudiPython::CallbackStreamBuf::m_self
private

Definition at line 18 of file CallbackStreamBuf.h.


The documentation for this class was generated from the following files: