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