// Copyright (C) 2002-2005 Gideon May (gideon@computer.org) // // Permission to copy, use, sell and distribute this software is granted // provided this copyright notice appears in all copies. // Permission to modify the code and to distribute modified code is granted // provided this copyright notice appears in all copies, and a notice // that the code was modified is included with the copyright notice. // // This software is provided "as is" without express or implied warranty, // and with no claim as to its suitability for any purpose. // // updated by brett hartshorn #include #include #include #include #include #include #include #include #include #include "producer_ptr.hpp" using namespace boost::python; namespace PyProd { void init_Block(); void init_Events(); void init_Camera(); void init_CameraConfig(); void init_CameraGroup(); void init_InputArea(); void init_Keyboard(); void init_KeyboardMouse(); void init_Math(); void init_Referenced(); void init_RenderSurface(); void init_Timer(); void init_Trackball(); void init_VisualChooser(); const char * buildinfo(); } using namespace PyProd; namespace { void __init_Producer() { class_ thread("Thread", no_init); thread .def("SetConcurrency", &OpenThreads::Thread::SetConcurrency) .def("CurrentThread", &OpenThreads::Thread::CurrentThread, return_internal_reference<>()) .def("Init", &OpenThreads::Thread::Init) .def("YieldCurrentThread", &OpenThreads::Thread::YieldCurrentThread) .def("GetMasterPriority", &OpenThreads::Thread::GetMasterPriority) .def("getThreadId", &OpenThreads::Thread::getThreadId) .def("getProcessId", &OpenThreads::Thread::getProcessId) .def("start", &OpenThreads::Thread::start) .def("startThread", &OpenThreads::Thread::startThread) .def("testCancel", &OpenThreads::Thread::testCancel) .def("cancel", &OpenThreads::Thread::cancel) // not doing SchedulePriority and SchedulePolicy since they take an enum types .def("setStackSize", &OpenThreads::Thread::setStackSize) .def("getStackSize", &OpenThreads::Thread::getStackSize) .def("detach", &OpenThreads::Thread::detach) .def("join", &OpenThreads::Thread::join) .def("setCancelModeDisable", &OpenThreads::Thread::setCancelModeDisable) .def("setCancelModeAsynchronous", &OpenThreads::Thread::setCancelModeAsynchronous) .def("setCancelModeDeferred", &OpenThreads::Thread::setCancelModeDeferred) .def("isRunning", &OpenThreads::Thread::isRunning) .def("run", &OpenThreads::Thread::run) .def("cancelCleanup", &OpenThreads::Thread::cancelCleanup) ; // need to initialize the important base classes before the other classes init_Referenced(); init_Block(); init_Events(); init_Timer(); init_Math(); init_Keyboard(); init_Camera(); init_CameraConfig(); init_CameraGroup(); init_InputArea(); init_KeyboardMouse(); init_Trackball(); init_VisualChooser(); init_RenderSurface(); } } BOOST_PYTHON_MODULE(_Producer) { // std::cerr << "BOOST_PYTHON_MODULE(Producer)\n"; // Setup the osg module info scope().attr("__doc__") = "Wrapper for Don Burns' Producer library\n"; scope().attr("__name__") = "Producer"; #ifdef _DEBUG scope().attr("__version__") = VERSION " debug"; #else scope().attr("__version__") = VERSION " release"; #endif scope().attr("__author__") = "Gideon May (C) 2002-2005"; scope().attr("__email__") = "gideon@computer.org"; scope().attr("__credits__") = "Based on the following libraries :\n" " Producer 1.0.1 (http://www.andesengineering.com/Producer)\n" " OpenThreads (http://openthreads.sourceforge.net/)\n" " Boost Python Library V2 (1.33.1) (http://www.boost.org)\n"; scope().attr("__build__") = buildinfo(); __init_Producer(); } #include "module_tail.hpp"