source: git/dyn_modules/python/vector_wrap.cc @ 6ce030f

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