Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PythonClass< SuperClass > Class Template Reference

#include <python_class.h>

Inheritance diagram for PythonClass< SuperClass >:
PythonAI< SuperClass >

Public Member Functions

 PythonClass (PyObject *self_)
 
virtual void callFunction (std::string str)
 
virtual ~PythonClass ()
 

Static Public Member Functions

static PythonClassLastPythonClass ()
 
static PythonClassFactory (const std::string &file)
 
static PythonClassFactoryString (char *code)
 

Static Public Attributes

static PythonClass< SuperClass > * last_instance
 

Protected Member Functions

virtual void Destructor ()
 

Protected Attributes

PyObject * self
 

Detailed Description

template<class SuperClass>
class PythonClass< SuperClass >

Definition at line 179 of file python_class.h.

Constructor & Destructor Documentation

template<class SuperClass>
PythonClass< SuperClass >::PythonClass ( PyObject *  self_)
inline

Definition at line 189 of file python_class.h.

189  :SuperClass()
190  {
191  self = self_;
192  Py_XINCREF(self);
193  last_instance=this;
194  }
template<class SuperClass>
virtual PythonClass< SuperClass >::~PythonClass ( )
inlinevirtual

Definition at line 217 of file python_class.h.

218  {
219  fprintf (stderr,"Destruct called. If called from C++ this is death %ld (0x%lx)",(unsigned long)this,(unsigned long)this);
220  }

Member Function Documentation

template<class SuperClass>
virtual void PythonClass< SuperClass >::callFunction ( std::string  str)
inlinevirtual

Definition at line 201 of file python_class.h.

202  {
203  PYTHONCALLBACK(void, self, str.c_str());
204  }
template<class SuperClass>
virtual void PythonClass< SuperClass >::Destructor ( )
inlineprotectedvirtual

Definition at line 183 of file python_class.h.

184  {
185  Py_XDECREF(self);
186  }
template<class SuperClass>
static PythonClass* PythonClass< SuperClass >::Factory ( const std::string &  file)
inlinestatic

Definition at line 205 of file python_class.h.

Referenced by PythonAI< SuperClass >::Factory(), pythonMission::Factory(), and Unit::LoadAIScript().

206  {
208  return LastPythonClass();
209  }
template<class SuperClass>
static PythonClass* PythonClass< SuperClass >::FactoryString ( char *  code)
inlinestatic

Definition at line 210 of file python_class.h.

Referenced by PythonAI< SuperClass >::FactoryString(), and pythonMission::FactoryString().

211  {
212  Python::reseterrors();
213  PyRun_SimpleString (code); //For some reason, PyRun_SimpleString() takes in a char *, not a const char *
214  Python::reseterrors();
215  return LastPythonClass();
216  }
template<class SuperClass>
static PythonClass* PythonClass< SuperClass >::LastPythonClass ( )
inlinestatic

Member Data Documentation

template<class SuperClass>
PythonClass< SuperClass >* PythonClass< SuperClass >::last_instance
static
template<class SuperClass>
PyObject* PythonClass< SuperClass >::self
protected

Definition at line 182 of file python_class.h.


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