itom 2.2.1
K:/git-itom/sources/itom/Qitom/python/pythonStream.h
00001 /* ********************************************************************
00002     itom software
00003     URL: http://www.uni-stuttgart.de/ito
00004     Copyright (C) 2016, Institut fuer Technische Optik (ITO),
00005     Universitaet Stuttgart, Germany
00006 
00007     This file is part of itom.
00008   
00009     itom is free software; you can redistribute it and/or modify it
00010     under the terms of the GNU Library General Public Licence as published by
00011     the Free Software Foundation; either version 2 of the Licence, or (at
00012     your option) any later version.
00013 
00014     itom is distributed in the hope that it will be useful, but
00015     WITHOUT ANY WARRANTY; without even the implied warranty of
00016     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library
00017     General Public Licence for more details.
00018 
00019     You should have received a copy of the GNU Library General Public License
00020     along with itom. If not, see <http://www.gnu.org/licenses/>.
00021 *********************************************************************** */
00022 
00023 //###################
00024 //# pythonStream.h  #
00025 //###################
00026 
00027 #ifndef PYTHONSTREAM_H
00028 #define PYTHONSTREAM_H
00029 
00030 #ifndef Q_MOC_RUN
00031     //python
00032     // see http://vtk.org/gitweb?p=VTK.git;a=commitdiff;h=7f3f750596a105d48ea84ebfe1b1c4ca03e0bab3
00033     #if (defined _DEBUG) && (defined WIN32)
00034         #undef _DEBUG
00035         #include "Python.h"
00036         #define _DEBUG
00037     #else
00038         #include "Python.h"
00039     #endif
00040 #endif
00041 
00042 namespace ito
00043 {
00044 
00045     class PyStream
00046     {
00047 
00048     public:
00049 
00051         /*
00052             The struct's name is PythonStream. This python type consists of the basic elements for every python type,
00053             included an integer value type, which indicates whether this stream corresponds to the stream \a cout or \a cerr.
00054             */
00055         typedef struct
00056         {
00057             PyObject_HEAD
00058                 int type;   
00059             PyObject *encoding;
00060             char closed;
00061         }
00062         PythonStream;
00063 
00064         static void PythonStream_dealloc(PythonStream* self);
00065         //static PyObject *PythonStream_new(PyTypeObject *type, PyObject *args, PyObject *kwds);
00066         static int PythonStream_init(PythonStream *self, PyObject *args, PyObject *kwds);
00067 
00068         static PyObject *PythonStream_name(PythonStream* self);
00069         static PyObject *PythonStream_fileno(PythonStream* self);
00070         static PyObject *PythonStream_write(PythonStream* self, PyObject *args);
00071         static PyObject *PythonStream_flush(PythonStream* self, PyObject *args);
00072         static PyObject *PythonStream_readline(PythonStream* self, PyObject *args);
00073 
00074         static PyMemberDef PythonStream_members[];
00075         static PyMethodDef PythonStream_methods[];
00076         static PyTypeObject PythonStreamType;
00077         static PyModuleDef pythonStreamModule;
00078     };
00079 
00080 } //end namespace ito
00081 
00082 
00083 #endif
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Properties Friends