From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- docs/doxygen/nel/python__export_8h-source.html | 453 +++++++++++++++++++++++++ 1 file changed, 453 insertions(+) create mode 100644 docs/doxygen/nel/python__export_8h-source.html (limited to 'docs/doxygen/nel/python__export_8h-source.html') diff --git a/docs/doxygen/nel/python__export_8h-source.html b/docs/doxygen/nel/python__export_8h-source.html new file mode 100644 index 00000000..0891d6d8 --- /dev/null +++ b/docs/doxygen/nel/python__export_8h-source.html @@ -0,0 +1,453 @@ + + + + nevrax.org : docs + + + + + + + + + + + + + + +
# Home   # nevrax.com   
+ + + + +
Nevrax
+ + + + + + + + + + +
+ + +
+ Nevrax.org
+ + + + + + + +
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
+
+ + +
+ + +
+Docs + +
+  + + + + + +
Documentation 
+ +
+Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  
+

python_export.h

Go to the documentation of this file.
00001 
+00007 /* Copyright, 2000 Nevrax Ltd.
+00008  *
+00009  * This file is part of NEVRAX NEL.
+00010  * NEVRAX NEL is free software; you can redistribute it and/or modify
+00011  * it under the terms of the GNU General Public License as published by
+00012  * the Free Software Foundation; either version 2, or (at your option)
+00013  * any later version.
+00014 
+00015  * NEVRAX NEL is distributed in the hope that it will be useful, but
+00016  * WITHOUT ANY WARRANTY; without even the implied warranty of
+00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+00018  * General Public License for more details.
+00019 
+00020  * You should have received a copy of the GNU General Public License
+00021  * along with NEVRAX NEL; see the file COPYING. If not, write to the
+00022  * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+00023  * MA 02111-1307, USA.
+00024  */
+00025 #ifndef _PY_EXPORT_H
+00026 #define _PY_EXPORT_H
+00027 
+00028 #ifdef NL_OS_WINDOWS
+00029 #pragma warning (disable: 4666)
+00030 #endif
+00031 
+00032 #include "nel/ai/pyserver/pylib.h"
+00033 #include "nel/ai/c/abstract_interface.h"
+00034 
+00035 namespace NLAIC
+00036 {
+00037         enum PyMemDeleteType {unDeleteMemory,deleteMemory};
+00038 
+00039         template <class T>
+00040         class CPyTemplateDef
+00041         {
+00042         public:
+00043                 PyObject_HEAD   
+00044                 T  *Instance;
+00045                 //PyMemDeleteType memType;
+00046 
+00047 
+00048         public:         
+00049                 CPyTemplateDef(T *a)
+00050                 {
+00051                         Instance = a;
+00052                         Instance->incRef();
+00053                 }
+00054                 operator T *() const
+00055                 {
+00056                         return Instance;
+00057                 }
+00058 
+00059                 ~CPyTemplateDef()
+00060                 {
+00061                         Instance->release();
+00062                 }
+00063         };
+00064 
+00065         /*
+00066         struct PyRyzomeDict
+00067         {
+00068                 const char *Name;
+00069                 PyObject *Obj;
+00070                 PyRyzomeDict(const char *varName,PyObject *object):     Name (varName),Obj(object)
+00071                 {
+00072                 }
+00073                 PyRyzomeDict(const PyRyzomeDict &dict): Name (dict.Name),Obj(dict.Obj)
+00074                 {
+00075                 }
+00076         };
+00077         
+00078         class PyCharStr: public IPointerGestion
+00079         {
+00080         private:
+00081                 char *_Str;
+00082                 sint32 _Size;
+00083         public:
+00084                 PyCharStr(sint32 size):_Str(new char [size]),_Size(size)
+00085                 {
+00086                         memset(_Str,0,_Size);
+00087                 }
+00088 
+00089                 operator char *() const
+00090                 {
+00091                         return _Str;
+00092                 }
+00093 
+00094                 sint32 getSize() const
+00095                 {
+00096                         return _Size;
+00097                 }
+00098                 
+00099                 virtual ~PyCharStr()
+00100                 {
+00101                         delete []_Str;
+00102                 }
+00103         };
+00104 
+00105         class PyOstream: public IPointerGestion
+00106         {                       
+00107         public:
+00108                 PyOstream()
+00109                 {
+00110                 }
+00111                 
+00112                 virtual operator std::ostream &() const = 0;
+00113                 virtual void getDebug(char *) const = 0;
+00114                 virtual void save(char *typeName,void *type)
+00115                 {
+00116                         std::ostream &os = (std::ostream &)*this;
+00117                         switch(typeName[0])
+00118                         {
+00119                         case 'f':
+00120                                 os << *((float *)type);
+00121                                 break;
+00122 
+00123                         case 'i':
+00124                                 os << *((sint32 *)type);
+00125                                 break;
+00126 
+00127                         case 'c':
+00128                                 os << *((char *)type);
+00129                                 break;
+00130 
+00131                         case 'b':
+00132                                 os << *((bool *)type);
+00133                                 break;
+00134 
+00135                         case 's':
+00136                                 os << *((char *)type);
+00137                                 break;                  
+00138                                 
+00139                         }
+00140                 }               
+00141 
+00142                 virtual ~PyOstream()
+00143                 {
+00144                 }
+00145 
+00146         };
+00147         class PyFileOstream:public PyOstream
+00148         {
+00149         private:                
+00150                 std::ostream &_Stream;
+00151         public:
+00152 
+00153                 PyFileOstream(const char *nameFile);            
+00154                 
+00155                 virtual operator std::ostream &() const
+00156                 {
+00157                         return _Stream;
+00158                 }
+00159                 virtual void getDebug(char *txt) const
+00160                 {
+00161                         sprintf(txt,"class PyMemOstream inst,ace at <%4x>",this);
+00162                 }               
+00163 
+00164                 virtual ~PyFileOstream()
+00165                 {
+00166                         delete &_Stream;
+00167                 }
+00168 
+00169         };
+00170         class PyMemOstream:public PyOstream
+00171         {
+00172         private:
+00173                 std::ostream &_Stream;
+00174         public:
+00175                 PyMemOstream(char *buffer,sint32 size);
+00176 
+00177                 operator const char *() const;
+00178 
+00179                 virtual operator std::ostream &() const
+00180                 {
+00181                         return _Stream;
+00182                 }
+00183 
+00184                 virtual void getDebug(char *txt) const
+00185                 {
+00186                         sprintf(txt,"class PyMemOstream inst,ace at <%4x>",this);
+00187                 }               
+00188 
+00189                 virtual ~PyMemOstream()
+00190                 {
+00191                         delete &_Stream;
+00192                 }
+00193                 
+00194 
+00195         };
+00196 
+00197         class PyTypeOstream:public PyOstream
+00198         {
+00199         private:
+00200                 std::ostream &_Stream;
+00201         public:
+00202                 PyTypeOstream(std::ostream &stream): _Stream(stream)
+00203                 {
+00204                 }
+00205 
+00206                 virtual operator std::ostream &() const
+00207                 {
+00208                         return _Stream;
+00209                 }
+00210 
+00211                 virtual void getDebug(char *txt) const
+00212                 {
+00213                         sprintf(txt,"class PyTypeOstream inst,ace at <%4x>",this);
+00214                 }               
+00215 
+00216                 virtual ~PyTypeOstream()
+00217                 {                       
+00218                 }
+00219                 
+00220 
+00221         };
+00222 
+00223         class PyIstream: public IPointerGestion
+00224         {
+00225         private:                
+00226         public:
+00227                 PyIstream()
+00228                 {
+00229                 }
+00230                 virtual operator NLMISC::IStream &() const = 0;
+00231                 virtual void getDebug(char *) const = 0;
+00232 
+00233                 virtual void load(char *typeName,void *type)
+00234                 {
+00235                         NLMISC::IStream &is = (NLMISC::IStream &)*this;
+00236                         switch(typeName[0])
+00237                         {
+00238                         case 'f':
+00239                         case 'F':
+00240                                 is.serial( *((float *)type) );
+00241                                 break;
+00242 
+00243                         case 'i':
+00244                         case 'I':
+00245                                 is.serial( *((sint32 *)type) );
+00246                                 break;
+00247 
+00248                         case 'c':
+00249                         case 'C':
+00250                                 is.serial( *((char *)type) );
+00251                                 break;
+00252 
+00253                         case 'b':
+00254                         case 'B':
+00255                                 is.serial( *((char *)type) );
+00256                                 break;
+00257 
+00258                         case 's':
+00259                         case 'S':
+00260                                 is.serial( *((char *)type) );
+00261                                 break;                  
+00262                                 
+00263                         }
+00264                 }
+00265                 
+00266                 virtual ~PyIstream()
+00267                 {
+00268                 }
+00269 
+00270         };
+00271 
+00272         class PyFileIstream:public PyIstream
+00273         {
+00274         private:                
+00275                 NLMISC::IStream &_Stream;
+00276         public:
+00277 
+00278                 PyFileIstream(const char *nameFile);            
+00279                 
+00280                 virtual operator NLMISC::IStream &() const
+00281                 {
+00282                         return _Stream;
+00283                 }
+00284                 virtual void getDebug(char *txt) const
+00285                 {
+00286                         sprintf(txt,"class PyMemOstream inst,ace at <%4x>",this);
+00287                 }               
+00288 
+00289                 virtual ~PyFileIstream()
+00290                 {
+00291                         delete &_Stream;
+00292                 }
+00293 
+00294         };
+00295 
+00296         class PyMemIstream:public PyIstream
+00297         {
+00298         private:
+00299                 NLMISC::IStream &_Stream;
+00300         public:
+00301                 PyMemIstream(const char *buffer);
+00302                 operator const char *() const;
+00303 
+00304                 virtual operator NLMISC::IStream &() const
+00305                 {
+00306                         return _Stream;
+00307                 }
+00308 
+00309                 virtual void getDebug(char *txt) const
+00310                 {
+00311                         sprintf(txt,"class PyMemIstream inst,ace at <%4x>",this);
+00312                 }
+00313                 
+00314                 virtual ~PyMemIstream()
+00315                 {               
+00316                         delete &_Stream;
+00317                 }
+00318 
+00319         };
+00320 
+00321         class PyTypeIstream:public PyIstream
+00322         {
+00323         private:
+00324                 NLMISC::IStream &_Stream;
+00325         public:
+00326                 PyTypeIstream(NLMISC::IStream &stream): _Stream(stream)
+00327                 {
+00328                 }
+00329 
+00330                 virtual operator NLMISC::IStream &() const
+00331                 {
+00332                         return _Stream;
+00333                 }
+00334 
+00335                 virtual void getDebug(char *txt) const
+00336                 {
+00337                         sprintf(txt,"class PyTypeIstream inst,ace at <%4x>",this);
+00338                 }
+00339                 
+00340                 virtual ~PyTypeIstream()
+00341                 {                       
+00342                 }
+00343                 
+00344 
+00345         };
+00346 
+00347         class CIdentType;
+00348         class IBasicInterface;
+00349 
+00350         typedef ryzPyObjetDef<CIdentType> tPyIdentType;
+00351         typedef ryzPyObjetDef<IBasicInterface> tPyiBasicInterface;
+00352         typedef ryzPyObjetDef<PyOstream> tPyOstream;
+00353         typedef ryzPyObjetDef<PyIstream> tPyIstream;
+00354         typedef ryzPyObjetDef<PyCharStr> tPyCharStr;
+00355         
+00356 
+00357         Py::PyExport *getPyServer();
+00358         void setPyServer(Py::PyExport *);
+00359         void addMethode(PyMethodDef *methodeDef);
+00360         inline void addMethode(char *name,PyCFunction   func,sint32 flag = 1,char *doc = NULL)
+00361         {
+00362                 PyMethodDef m = {name, (PyCastMethod)func, flag, doc};
+00363                 addMethode(&m);
+00364         }
+00365         void removeMethode(const char *methodeName);
+00366         void addToDict(const PyRyzomeDict &dict);
+00367         void removeFromDict(const char *name);
+00368         void initPyExport();
+00369         void releasePyExport();*/
+00370 
+00371         template<class T>
+00372         CPyTemplateDef<T> *CreatePyObjectInstance(T *o,PyTypeObject *defType)
+00373         {
+00374                 CPyTemplateDef<T> *ThisClass;
+00375                 ThisClass = new CPyTemplateDef<T>(o);
+00376                 if(ThisClass == NULL) return NULL;              
+00377                 ThisClass->Instance = o;
+00378                 ThisClass->ob_type = defType;
+00379                 _Py_NewReference((PyObject *)ThisClass);
+00380                 return ThisClass;
+00381         }
+00382 }
+00383 
+00384 #endif
+
+ + +
                                                                                                                                                                    +
+ + -- cgit v1.2.1