Gaudi Framework, version v20r2

Generated: 18 Jul 2008

GaudiPython::CallbackStreamBuf Class Reference

#include <CallbackStreamBuf.h>

Inheritance diagram for GaudiPython::CallbackStreamBuf:

Inheritance graph
[legend]
Collaboration diagram for GaudiPython::CallbackStreamBuf:

Collaboration graph
[legend]
List of all members.

Detailed Description

Definition at line 15 of file CallbackStreamBuf.h.

Public Member Functions

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

Private Attributes

PyObject * m_self
char * m_callbackBuff


Constructor & Destructor Documentation

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

CallbackStreamBuf constructor.

Definition at line 42 of file CallbackStreamBuf.cpp.

00042                 : stringbuf(), m_self(self)
00043 {
00044   Py_INCREF(this->m_self);
00045   this->m_callbackBuff = new char[512]; //used for passing the flushed chars in the python callback
00046 }

GaudiPython::CallbackStreamBuf::~CallbackStreamBuf (  ) 

CallbackStreamBuf destructor.

Definition at line 51 of file CallbackStreamBuf.cpp.

References m_callbackBuff.

00052 {
00053   Py_DECREF( this->m_self );
00054   delete this->m_callbackBuff;
00055 }


Member Function Documentation

int GaudiPython::CallbackStreamBuf::sync (  )  [virtual]

reimplementation of stringbuf::sync()

Reimplemented from std::basic_stringbuf< _CharT, _Traits, _Alloc >.

Definition at line 60 of file CallbackStreamBuf.cpp.

References GaudiPython::call_python_method(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::eback(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::epptr(), m_callbackBuff, min, std::basic_stringbuf< _CharT, _Traits, _Alloc >::pbase(), std::basic_stringbuf< _CharT, _Traits, _Alloc >::setg(), and std::basic_stringbuf< _CharT, _Traits, _Alloc >::setp().

00061 {
00062   int length;
00063   char *x;
00064   for ( length = 0, x = this->pbase(); x < this->epptr(); x++ , length++ ) ;
00065   //getting in a null terminated buffer the characters
00066   memcpy( this->m_callbackBuff, this->pbase(), min(length, 512) );
00067   this->m_callbackBuff[ min(length, 512) ] = '\0';
00068   //calling the python method
00069   GaudiPython::call_python_method(this->m_self, "_sync", this->m_callbackBuff);
00070   //reseting in/out buffer pointers
00071   setp( this->pbase() , this->pbase() );
00072   setg( this->eback(), this->eback(), this->eback() );
00073   return 0;
00074 }


Member Data Documentation

PyObject* GaudiPython::CallbackStreamBuf::m_self [private]

Definition at line 18 of file CallbackStreamBuf.h.

char* GaudiPython::CallbackStreamBuf::m_callbackBuff [private]

Definition at line 19 of file CallbackStreamBuf.h.

Referenced by sync(), and ~CallbackStreamBuf().


The documentation for this class was generated from the following files:
Generated at Fri Jul 18 12:10:33 2008 for Gaudi Framework, version v20r2 by Doxygen version 1.5.1 written by Dimitri van Heesch, © 1997-2004