| # Gaudi Framework, version v21r10p1 |

Home |  | Generated: 29 Jul 2010

# GaudiPython::CallbackStreamBuf Class Reference

`#include <CallbackStreamBuf.h>`

Inheritance diagram for GaudiPython::CallbackStreamBuf:

[legend]
Collaboration diagram for GaudiPython::CallbackStreamBuf:

[legend]

List of all members.

## 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

## Detailed Description

Definition at line 15 of file CallbackStreamBuf.h.

## Constructor & Destructor Documentation

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

CallbackStreamBuf constructor.

Definition at line 43 of file CallbackStreamBuf.cpp.

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

GaudiPython::CallbackStreamBuf::~CallbackStreamBuf | ( |  | ) |

CallbackStreamBuf destructor.

Definition at line 52 of file CallbackStreamBuf.cpp.

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

## Member Function Documentation

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

reimplementation of stringbuf::sync()

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

Definition at line 61 of file CallbackStreamBuf.cpp.

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

## 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.

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v21r10p1/GaudiPython/GaudiPython/CallbackStreamBuf.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v21r10p1/GaudiPython/src/Lib/CallbackStreamBuf.cpp