itom
Loading...
Searching...
No Matches
ito::PyStream Class Reference

static class which implements a new python type. The members cout and cerr of the python system are set to variables of this type PyStream in order to observe the python's cout and cerr stream and to transmit the stream's content to the main application. More...

Classes

struct  PythonStream
 

Static Public Member Functions

static void PythonStream_dealloc (PythonStream *self)
 static method which is called if variable of type PyStream in python workspace has been deleted in order to free allocated memory.
 
static int PythonStream_init (PythonStream *self, PyObject *args, PyObject *kwds)
 static init method, which is called if any variable of type PyStream is initialized. This method extracts type value from args.
 
static PyObject * PythonStream_name (PythonStream *self)
 static method returning name representation of this type
 
static PyObject * PythonStream_fileno (PythonStream *self)
 
static PyObject * PythonStream_write (PythonStream *self, PyObject *args)
 static method invoked if string has been written to stream
 
static PyObject * PythonStream_flush (PythonStream *self, PyObject *args)
 static method is invoked if stream has been flushed
 
static PyObject * PythonStream_readline (PythonStream *self, PyObject *args)
 
static PyObject * PythonStream_isatty (PythonStream *self, PyObject *args)
 setting IOBase params to False since help(bla) will open a terminal if True.idfc.
 
static PyObject * PythonStream_seekable (PythonStream *self, PyObject *args)
 
static PyObject * PythonStream_writable (PythonStream *self, PyObject *args)
 
static PyObject * PythonStream_readable (PythonStream *self, PyObject *args)
 

Static Public Attributes

static PyMemberDef PythonStream_members []
 static PyMemberDef table which describes every member of PyStream type
 
static PyMethodDef PythonStream_methods []
 static table of type PyMethodDef which contains function pointers and descriptions to all methods, belonging to this type
 
static PyTypeObject PythonStreamType
 static PyTypeObject for type PyStream with function pointers to all required static methods.
 

Detailed Description

static class which implements a new python type. The members cout and cerr of the python system are set to variables of this type PyStream in order to observe the python's cout and cerr stream and to transmit the stream's content to the main application.

Member Function Documentation

◆ PythonStream_flush()

PyObject * ito::PyStream::PythonStream_flush ( PythonStream * self,
PyObject * args )
static

static method is invoked if stream has been flushed

stream is flushed if python is destroyed. Must return Py_None.

Returns
PyNone

◆ PythonStream_write()

PyObject * ito::PyStream::PythonStream_write ( PythonStream * self,
PyObject * args )
static

static method invoked if string has been written to stream

string is contained in args reference and then sent to std::cout or std::cerr-stream, depending on value of member type.

Returns
PyNone

Member Data Documentation

◆ PythonStream_members

PyMemberDef ito::PyStream::PythonStream_members
static
Initial value:
= {
{"type", T_INT, offsetof(PyStream::PythonStream, type), READONLY, "PythonStream type"},
{"encoding", T_OBJECT_EX, offsetof(PyStream::PythonStream, encoding), READONLY, "Encoding of stream"},
{"closed", T_BOOL, offsetof(PyStream::PythonStream, closed), READONLY, "Indicates if stream is closed"},
{NULL}
}
Definition pythonStream.h:48

static PyMemberDef table which describes every member of PyStream type

◆ PythonStream_methods

PyMethodDef ito::PyStream::PythonStream_methods
static
Initial value:
= {
{"name", (PyCFunction)PyStream::PythonStream_name, METH_NOARGS, "name"},
{"write", (PyCFunction)PyStream::PythonStream_write, METH_VARARGS, "write function"},
{"flush", (PyCFunction)PyStream::PythonStream_flush, METH_VARARGS, "flush function"},
{"readline", (PyCFunction)PyStream::PythonStream_readline, METH_VARARGS, "readline function" },
{"fileno", (PyCFunction)PyStream::PythonStream_fileno, METH_NOARGS, "returns the virtual file number of this stream (0: in [not supported yet], 1: out, 2: err, 3: in)"},
{"isatty", (PyCFunction)PyStream::PythonStream_isatty, METH_NOARGS, "returns True."},
{"seekable", (PyCFunction)PyStream::PythonStream_writable, METH_NOARGS, "returns False." },
{"writable", (PyCFunction)PyStream::PythonStream_writable, METH_NOARGS, "returns False." },
{"readable", (PyCFunction)PyStream::PythonStream_seekable, METH_NOARGS, "returns False." },
{NULL}
}
static PyObject * PythonStream_isatty(PythonStream *self, PyObject *args)
setting IOBase params to False since help(bla) will open a terminal if True.idfc.
Definition pythonStream.cpp:91
static PyObject * PythonStream_flush(PythonStream *self, PyObject *args)
static method is invoked if stream has been flushed
Definition pythonStream.cpp:249
static PyObject * PythonStream_write(PythonStream *self, PyObject *args)
static method invoked if string has been written to stream
Definition pythonStream.cpp:170
static PyObject * PythonStream_name(PythonStream *self)
static method returning name representation of this type
Definition pythonStream.cpp:81

static table of type PyMethodDef which contains function pointers and descriptions to all methods, belonging to this type


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