00001 00012 #ifdef HAVE_CONFIG_H 00013 #include "config.h" 00014 #endif 00015 00016 #ifdef _MSC_VER 00017 # pragma warning(disable:4231) // nonstandard extension used 'extern' 00018 // before... 00019 # pragma warning(disable:4251) // needs to have dll-interface used by client 00020 # pragma warning(disable:4275) // non dll-interface struct 00021 # pragma warning(disable:4800) // 'int' : forcing value to bool 00022 // 'true' or 'false' (performance 00023 // warning) 00024 #endif 00025 00026 #include "exportToPython.h" 00027 00028 #include "QtDisplay.h" 00029 #include "PyDataRep.h" 00030 #include "PyDataSource.h" 00031 00032 #include "pyconversions.h" 00033 00034 using std::vector; 00035 using namespace hippodraw::Python; 00036 using namespace boost::python; 00037 00038 namespace hippodraw { 00039 namespace Python { 00040 00041 #if __GNUC__ < 3 00042 00049 void 00050 translate ( const std::exception & e ) 00051 { 00052 PyErr_SetString ( PyExc_RuntimeError, e.what() ); 00053 } 00054 #endif 00055 00056 void 00057 exportToPython () 00058 { 00059 #if __GNUC__ < 3 00060 register_exception_translator < std::exception > ( & translate ); 00061 #endif 00062 00063 /* The following is neede for PyGILState_Ensure / _Release to 00064 work. */ 00065 PyEval_InitThreads(); 00066 00067 // The order is important. Base class before derived classes 00068 00069 export_CanvasWindow (); 00070 export_DataSource (); 00071 export_DataArray (); 00072 export_ListTuple (); // derived from DataSource 00073 #ifdef HAVE_NUMARRAY 00074 export_NumArrayTuple (); // derived from DataSource 00075 #endif 00076 #ifdef HAVE_ROOT 00077 export_RootNTuple (); // derived from DataSource 00078 export_RootController (); 00079 #endif 00080 00081 #ifdef HAVE_CFITSIO 00082 export_FitsController (); 00083 export_FitsNTuple (); // derived from DataSource 00084 #endif 00085 export_NTuple (); // derived from DataSource 00086 export_CircularBuffer (); // derived from NTuple 00087 export_NTupleController (); 00088 export_Observer (); 00089 export_QtDisplay (); 00090 export_QtCut (); // derived from QtDisplay 00091 export_Function (); 00092 export_Canvas (); 00093 export_HDApp (); 00094 export_DataRep (); 00095 export_RepBase (); 00096 export_Factory_PointRep (); 00097 export_PointRepFactory (); 00098 export_Fitter (); 00099 export_FitterFactory (); 00100 // order is important, base class first 00101 export_FCNBase (); 00102 export_StatedFCN (); 00103 export_NTupleFCN (); 00104 #ifndef BOOST_DEFECT 00105 export_FunctionBase (); 00106 #endif 00107 export_FunctionFactory (); 00108 00109 std_vector_to_tuple < double > (); 00110 std_vector_to_tuple < int > (); 00111 std_vector_to_tuple < std::string > (); 00112 std_vector_to_tuple < QtDisplay * > (); 00113 std_vector_to_tuple < PyDataRep * > (); 00114 00115 from_python_sequence < std::vector < std::string >, 00116 variable_capacity_policy > (); 00117 00118 from_python_sequence < std::vector < double >, 00119 variable_capacity_policy > (); 00120 00121 from_python_sequence < std::vector < int >, 00122 variable_capacity_policy > (); 00123 00124 from_python_sequence < std::vector < QtDisplay * >, 00125 variable_capacity_policy > (); 00126 00127 from_python_sequence < std::vector < std::vector < double > >, 00128 variable_capacity_policy > (); 00129 00130 } 00131 00132 } // end namespace Python 00133 } // end namespace hippodraw