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
python_class.h File Reference
#include "config.h"
#include "cs_python.h"
#include <boost/version.hpp>
#include "boost/python/object.hpp"
#include "boost/python/class.hpp"
#include "boost/python/call_method.hpp"
#include "cs_boostpython.h"
#include "init.h"
#include "cmd/script/pythonmission.h"
#include <compile.h>
#include <eval.h>
#include "python/python_compile.h"
#include "cmd/ai/fire.h"
#include <memory>

Go to the source code of this file.

Classes

class  PythonClass< SuperClass >
 
class  PythonAI< SuperClass >
 
class  pythonMission
 

Macros

#define class_builder   class_
 module.hpp> More...
 
#define PYTHONCALLBACK(rtype, ptr, str)   boost::python::call_method<rtype>(ptr, str)
 
#define PYTHONCALLBACK2(rtype, ptr, str, str2)   boost::python::call_method<rtype>(ptr, str, str2)
 
#define TO_PYTHON_SMART_POINTER(Pointer)
 
#define ADD_FROM_PYTHON_FUNCTION(SuperClass)
 
#define PYTHON_INIT_INHERIT_GLOBALS(name, SuperClass)   template <> PythonClass <SuperClass> *PythonClass< SuperClass >::last_instance = NULL;
 
#define PYTHON_INIT_GLOBALS(name, Class)
 
#define PYTHON_BEGIN_MODULE(name)   BOOST_PYTHON_MODULE(name) {
 
#define PYTHON_DEFINE_GLOBAL(modul, fun, funname)   boost::python::def (funname,fun)
 
#define VS_BOOST_MAKE_TUPLE(a, b, c)   boost::python::make_tuple(a,b,c)
 
#define VS_BOOST_MAKE_TUPLE_2(a, b)   boost::python::make_tuple(a,b)
 
#define VS_BOOST_MAKE_TUPLE_4(a, b, c, d)   boost::python::make_tuple(a,b,c,d)
 
#define PYTHON_END_MODULE(name)   }
 
#define PYTHON_INIT_MODULE(name)   init##name()
 
#define PYTHON_BASE_BEGIN_INHERIT_CLASS(name, NewClass, SuperClass, myclass)
 
#define PYTHON_BEGIN_INHERIT_CLASS(name, NewClass, SuperClass, myclass)
 
#define PYTHON_BASE_BEGIN_CLASS(name, CLASS, myclass)
 
#define PYTHON_BEGIN_CLASS(name, CLASS, myclass)
 
#define PYTHON_DEFINE_METHOD(modul, fun, funname)   modul.def (funname,fun)
 
#define PYTHON_DEFINE_METHOD_DEFAULT(modul, fun, funname, deflt)   modul.def (funname,deflt)
 
#define PYTHON_END_CLASS(name, SuperClass)   }
 

Macro Definition Documentation

#define ADD_FROM_PYTHON_FUNCTION (   SuperClass)
Value:
BOOST_PYTHON_BEGIN_CONVERSION_NAMESPACE \
SuperClass & from_python(PyObject *obj,boost::python::type<SuperClass &>) { \
boost::python::detail::extension_instance* self = boost::python::detail::get_extension_instance(obj); \
typedef std::vector<boost::python::detail::instance_holder_base*>::const_iterator iterator; \
for (iterator p = self->wrapped_objects().begin(); \
p != self->wrapped_objects().end(); ++p) \
{ \
boost::python::detail::instance_holder<SuperClass>* held = dynamic_cast<boost::python::detail::instance_holder<SuperClass>*>(*p); \
if (held != 0) \
return *held->target(); \
void* target = boost::python::detail::class_registry<SuperClass>::class_object()->try_class_conversions(*p); \
if(target) \
return *boost::python::detail::check_non_null(static_cast<SuperClass*>(target)); \
} \
boost::python::detail::report_missing_instance_data(self, boost::python::detail::class_registry<SuperClass>::class_object(), typeid(SuperClass)); \
boost::python::throw_argument_error(); \
return *((SuperClass*)0); \
}BOOST_PYTHON_END_CONVERSION_NAMESPACE

Definition at line 101 of file python_class.h.

#define class_builder   class_

module.hpp>

Definition at line 32 of file python_class.h.

#define PYTHON_BASE_BEGIN_CLASS (   name,
  CLASS,
  myclass 
)
Value:
{ \
boost::python::class_builder <CLASS> Class (myclass

Definition at line 153 of file python_class.h.

#define PYTHON_BASE_BEGIN_INHERIT_CLASS (   name,
  NewClass,
  SuperClass,
  myclass 
)
Value:
{ \
boost::python::class_builder <SuperClass, NewClass, boost::noncopyable > Class (myclass

Definition at line 148 of file python_class.h.

#define PYTHON_BEGIN_CLASS (   name,
  CLASS,
  myclass 
)
Value:
PYTHON_BASE_BEGIN_CLASS(name,CLASS,myclass) \
);

Definition at line 155 of file python_class.h.

#define PYTHON_BEGIN_INHERIT_CLASS (   name,
  NewClass,
  SuperClass,
  myclass 
)
Value:
PYTHON_BASE_BEGIN_INHERIT_CLASS(name,NewClass,SuperClass,myclass) \
);

Definition at line 150 of file python_class.h.

#define PYTHON_BEGIN_MODULE (   name)    BOOST_PYTHON_MODULE(name) {

Definition at line 132 of file python_class.h.

#define PYTHON_DEFINE_GLOBAL (   modul,
  fun,
  funname 
)    boost::python::def (funname,fun)

Definition at line 133 of file python_class.h.

#define PYTHON_DEFINE_METHOD (   modul,
  fun,
  funname 
)    modul.def (funname,fun)

Definition at line 157 of file python_class.h.

Referenced by DefineOddUnitFunctions().

#define PYTHON_DEFINE_METHOD_DEFAULT (   modul,
  fun,
  funname,
  deflt 
)    modul.def (funname,deflt)

Definition at line 158 of file python_class.h.

#define PYTHON_END_CLASS (   name,
  SuperClass 
)    }

Definition at line 173 of file python_class.h.

#define PYTHON_END_MODULE (   name)    }

Definition at line 144 of file python_class.h.

#define PYTHON_INIT_GLOBALS (   name,
  Class 
)

Definition at line 128 of file python_class.h.

#define PYTHON_INIT_INHERIT_GLOBALS (   name,
  SuperClass 
)    template <> PythonClass <SuperClass> *PythonClass< SuperClass >::last_instance = NULL;

Definition at line 127 of file python_class.h.

#define PYTHON_INIT_MODULE (   name)    init##name()

Definition at line 145 of file python_class.h.

Referenced by InitBase(), InitBriefing(), InitDirector(), and InitVS().

#define PYTHONCALLBACK (   rtype,
  ptr,
  str 
)    boost::python::call_method<rtype>(ptr, str)
#define PYTHONCALLBACK2 (   rtype,
  ptr,
  str,
  str2 
)    boost::python::call_method<rtype>(ptr, str, str2)

Definition at line 55 of file python_class.h.

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

#define TO_PYTHON_SMART_POINTER (   Pointer)
Value:
BOOST_PYTHON_BEGIN_CONVERSION_NAMESPACE \
inline PyObject* to_python(class Pointer* x) {return boost::python::python_extension_class_converters<Pointer>::smart_ptr_to_python(x);} \
inline PyObject* to_python(const class Pointer* p) {return to_python(const_cast<class Pointer*>(p));} \
BOOST_PYTHON_END_CONVERSION_NAMESPACE

Definition at line 92 of file python_class.h.

#define VS_BOOST_MAKE_TUPLE (   a,
  b,
  c 
)    boost::python::make_tuple(a,b,c)
#define VS_BOOST_MAKE_TUPLE_2 (   a,
  b 
)    boost::python::make_tuple(a,b)
#define VS_BOOST_MAKE_TUPLE_4 (   a,
  b,
  c,
  d 
)    boost::python::make_tuple(a,b,c,d)

Definition at line 136 of file python_class.h.

Referenced by UnitWrapper::GetMountInfo(), and UnitWrapper::InsideCollideTree().