Go to the documentation of this file.00001
00002
00003
00004
00005
00006 #include <boost/numpy.hpp>
00007 #include <boost/cstdint.hpp>
00008
00009 namespace p = boost::python;
00010 namespace np = boost::numpy;
00011
00012 template <typename T>
00013 np::dtype accept(T) {
00014 return np::dtype::get_builtin<T>();
00015 }
00016
00017 BOOST_PYTHON_MODULE(dtype_mod)
00018 {
00019 np::initialize();
00020
00021 p::def("equivalent", np::equivalent);
00022
00023 p::def("accept_int8", accept<boost::int8_t>);
00024 p::def("accept_uint8", accept<boost::uint8_t>);
00025 p::def("accept_int16", accept<boost::int16_t>);
00026 p::def("accept_uint16", accept<boost::uint16_t>);
00027 p::def("accept_int32", accept<boost::int32_t>);
00028 p::def("accept_uint32", accept<boost::uint32_t>);
00029 p::def("accept_int64", accept<boost::int64_t>);
00030 p::def("accept_uint64", accept<boost::uint64_t>);
00031
00032 p::def("accept_bool_", accept<bool>);
00033 p::def("accept_byte", accept<signed char>);
00034 p::def("accept_ubyte", accept<unsigned char>);
00035 p::def("accept_short", accept<short>);
00036 p::def("accept_ushort", accept<unsigned short>);
00037 p::def("accept_intc", accept<int>);
00038 p::def("accept_uintc", accept<unsigned int>);
00039
00040 p::def("accept_float32", accept<float>);
00041 p::def("accept_complex64", accept< std::complex<float> >);
00042 p::def("accept_float64", accept<double>);
00043 p::def("accept_complex128", accept< std::complex<double> >);
00044 if (sizeof(long double) > sizeof(double)) {
00045 p::def("accept_longdouble", accept<long double>);
00046 p::def("accept_clongdouble", accept< std::complex<long double> >);
00047 }
00048 }