mirror of
https://github.com/boostorg/python.git
synced 2026-01-24 06:02:14 +00:00
Much more extensive testing of import_converters.
[SVN r9618]
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
#include "ivect.h"
|
||||
#include "dvect.h"
|
||||
#include "ivect.h"
|
||||
#include <boost/python/cross_module.hpp>
|
||||
namespace python = boost::python;
|
||||
|
||||
namespace {
|
||||
|
||||
# include "dvect_conversions.cpp"
|
||||
# include "ivect_conversions.cpp"
|
||||
|
||||
vects::dvect ivect_as_dvect(const vects::ivect& iv)
|
||||
{
|
||||
vects::dvect dv(iv.size());
|
||||
@@ -12,36 +15,9 @@ namespace {
|
||||
for (int i = 0; i < iv.size(); i++) dviter[i] = static_cast<double>(iv[i]);
|
||||
return dv;
|
||||
}
|
||||
|
||||
boost::python::tuple dvect_as_tuple(const vects::dvect& dv)
|
||||
{
|
||||
return dv.as_tuple();
|
||||
}
|
||||
|
||||
std::auto_ptr<vects::dvect> auto_ptr_dvect(const vects::ivect& iv)
|
||||
{
|
||||
return std::auto_ptr<vects::dvect>(new vects::dvect(ivect_as_dvect(iv)));
|
||||
}
|
||||
|
||||
boost::shared_ptr<vects::dvect> shared_ptr_dvect(const vects::ivect& iv)
|
||||
{
|
||||
return boost::shared_ptr<vects::dvect>(new vects::dvect(ivect_as_dvect(iv)));
|
||||
}
|
||||
|
||||
boost::python::tuple auto_ptr_dvect_as_tuple(std::auto_ptr<vects::dvect>& dv)
|
||||
{
|
||||
return dv->as_tuple();
|
||||
}
|
||||
|
||||
boost::python::tuple shared_ptr_dvect_as_tuple(boost::shared_ptr<vects::dvect>& dv)
|
||||
{
|
||||
return dv->as_tuple();
|
||||
}
|
||||
}
|
||||
|
||||
extern "C"
|
||||
DL_EXPORT(void)
|
||||
initivect()
|
||||
BOOST_PYTHON_MODULE_INIT(ivect)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -56,11 +32,8 @@ initivect()
|
||||
ivect_class.def(&vects::ivect::as_tuple, "as_tuple");
|
||||
ivect_class.def(ivect_as_dvect, "as_dvect");
|
||||
|
||||
this_module.def(dvect_as_tuple, "dvect_as_tuple");
|
||||
ivect_class.def(auto_ptr_dvect, "auto_ptr_dvect");
|
||||
ivect_class.def(shared_ptr_dvect, "shared_ptr_dvect");
|
||||
this_module.def(auto_ptr_dvect_as_tuple, "auto_ptr_dvect_as_tuple");
|
||||
this_module.def(shared_ptr_dvect_as_tuple, "shared_ptr_dvect_as_tuple");
|
||||
# include "dvect_defs.cpp"
|
||||
# include "ivect_defs.cpp"
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user