My Project  debian-1:4.1.1-p2+ds-4build4
vector_wrap.cc
Go to the documentation of this file.
1 #include "kernel/mod2.h"
2 #ifdef HAVE_PYTHON_MOD
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
int p
Definition: cfModGcd.cc:4019
Definition: Number.h:34
Definition: ring_wrap.h:21
Definition: Poly.h:509
boost::python::str Vector_as_str(const Vector &p)
Definition: janet.h:15
void export_vector()