fieker-DuValspielwiese
Last change
on this file since 814a65 was
814a65,
checked in by Hans Schoenemann <hannes@…>, 7 years ago
|
dyn_mod/python_module: depends on HAVE_PYTHON_MODULE
|
-
Property mode set to
100644
|
File size:
833 bytes
|
Line | |
---|
1 | #include <kernel/mod2.h> |
---|
2 | #ifdef HAVE_PYTHON_MODULE |
---|
3 | #include <boost/python.hpp> |
---|
4 | #include "Poly.h" |
---|
5 | #include "vector_wrap.h" |
---|
6 | #include "ring_wrap.h" |
---|
7 | using boost::python::self; |
---|
8 | |
---|
9 | static boost::python::object Vector_as_str(Vector& p) |
---|
10 | { |
---|
11 | using boost::python::str; |
---|
12 | //ring r=p.getRing(); |
---|
13 | |
---|
14 | char* out=p.c_string(); |
---|
15 | return boost::python::str(out,strlen(out)); |
---|
16 | } |
---|
17 | static Ring Vector_get_Ring(const Vector & p){ |
---|
18 | return p.getRing(); |
---|
19 | } |
---|
20 | void export_vector(){ |
---|
21 | boost::python::class_<Vector>("Vector") |
---|
22 | .def(boost::python::init <>()) |
---|
23 | .def("__str__", Vector_as_str) |
---|
24 | |
---|
25 | // .def("__str__", Poly_as_str) |
---|
26 | .def("__iter__", boost::python::iterator<Vector>()) |
---|
27 | .def(-self) |
---|
28 | .def(self+=self) |
---|
29 | |
---|
30 | .def(self+self) |
---|
31 | .def(self*=Number()) |
---|
32 | .def(Poly() * self) |
---|
33 | .def(Number() * self) |
---|
34 | .def("ring",Vector_get_Ring); |
---|
35 | } |
---|
36 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.