| # Gaudi Framework, version v22r4 |

Home |  | Generated: Fri Sep 2 2011

Public Member Functions | Private Attributes

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

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

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

CallbackStreamBuf destructor.

Definition at line 52 of file CallbackStreamBuf.cpp.

    {
      Py_DECREF( this->m_self );
      delete this->m_callbackBuff;
    }

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

    {
      int length;
      char *x;
      for ( length = 0, x = this->pbase(); x < this->epptr(); x++ , length++ ) ;
      //getting in a null terminated buffer the characters
      memcpy( this->m_callbackBuff, this->pbase(), min(length, 512) );
      this->m_callbackBuff[ min(length, 512) ] = '\0';
      //calling the python method
      GaudiPython::call_python_method(this->m_self, "_sync", this->m_callbackBuff);
      //reseting in/out buffer pointers
      setp( this->pbase() , this->pbase() );
      setg( this->eback(), this->eback(), this->eback() );
      return 0;
    }

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

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

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines