/// @file /// This file is included by all the *.bpi.cpp files #include #include using namespace boost; using namespace boost::python; /// Wrap a class #define WRAP(x) \ void boostPythonWrap##x() /// Wrap a singleton class #define WRAP_SINGLETON(x) \ WRAP(x) { \ class_(#x, no_init) \ .def("getInstance", & x ::getInstance, return_value_policy()) \ .staticmethod("getInstance") \ ; \ } #define WRAP_CONTAINER(x) \ class_(#x) \ .def(vector_indexing_suite()) \ ; //====================================================================================================================== // Property for simple types = //====================================================================================================================== template RetType getterSv(const ClassType* t) { return (t->*accessor)(); } template void setterSv(ClassType* t, InType in) { (t->*accessor)(in); } /// Boost python property for simple types (int, float etc) that cannot be wrapped by boost::python correctly #define BP_PROPERTY_BASIC_TYPE(Type__, Class__, var__, getter__, setter__) \ .add_property(#var__, &getterSv, \ &setterSv) //====================================================================================================================== // Math library stuff = //====================================================================================================================== template RetType getM(const ClassType* t) { return (t->*accessor)(); } template void setM(ClassType* t, InType in) { (t->*accessor)() = in; } #define BP_PROPERTY_MATH(ClassType__, name__) \ .add_property(#name__, &getM, \ &setM)