#include "ClassDefs.hh" #include #include namespace python = boost::python; namespace { BOOST_PYTHON_MODULE_INIT(Base) { try { python::module_builder basemodule("Base"); // Wrap AbstractBase python::class_builder AbstractBaseBoost(basemodule, "AbstractBase"); AbstractBaseBoost.def(&AbstractBase::pureMethod, "pureMethod"); // Want to export the type for use by other modules, but can't!! python::export_converters(AbstractBaseBoost); // Wrap DerivedClass python::class_builder DerivedClassBoost(basemodule, "DerivedClass"); DerivedClassBoost.declare_base(AbstractBaseBoost); DerivedClassBoost.def(python::constructor<>()); // Wrap UseAbstractType python::class_builder UseAbstractTypeBoost(basemodule, "UseAbstractType"); UseAbstractTypeBoost.def(python::constructor()); UseAbstractTypeBoost.def(&UseAbstractType::callPureMethod, "callPureMethod"); // Wrap DefiniteBase python::class_builder DefiniteBaseBoost(basemodule, "DefiniteBase"); DefiniteBaseBoost.def(&DefiniteBase::method, "method"); python::export_converters(DefiniteBaseBoost); // Wrap AnotherDerivedClass python::class_builder AnotherDerivedClassBoost(basemodule, "AnotherDerivedClass"); AnotherDerivedClassBoost.declare_base(DefiniteBaseBoost); AnotherDerivedClassBoost.def(python::constructor<>()); // Wrap UseDefiniteType python::class_builder UseDefiniteTypeBoost(basemodule, "UseDefiniteType"); UseDefiniteTypeBoost.def(python::constructor()); UseDefiniteTypeBoost.def(&UseDefiniteType::callMethod, "callMethod"); } catch(...) { python::handle_exception(); } } }