My Project
intvec_wrap.cc
Go to the documentation of this file.
1 #include "kernel/mod2.h"
2 #ifdef HAVE_PYTHON
3 #include <boost/python.hpp>
4 #include <boost/python/suite/indexing/vector_indexing_suite.hpp>
5 #include "IIntvec.h"
6 #include "intvec_wrap.h"
7 
8 
9 using namespace boost::python;
10 static boost::python::object intvec_as_str(const Intvec& p)
11 {
12  using boost::python::str;
13  //ring r=p.getRing();
14  str helper;
15  list tojoin;
16  int i;
17  int s=p.size();
18  tojoin.append("[");
19  for(i=0;i<s;i++){
20  tojoin.append(str(p[i]));
21  if (i<s-1)
22  tojoin.append(", ");
23  }
24  tojoin.append("]");
25  str res=helper.join(tojoin);
26  return res;
27 
28 }
29 
31 boost::python::class_<Intvec>("IntVector")
32  .def("__str__", intvec_as_str)
33  .def(boost::python::init <>())
34  .def(boost::python::vector_indexing_suite<Intvec>());
35 }
36 #endif
int i
Definition: cfEzgcd.cc:132
int p
Definition: cfModGcd.cc:4080
Definition: IIntvec.h:6
const CanonicalForm int s
Definition: facAbsFact.cc:51
CanonicalForm res
Definition: facAbsFact.cc:60
void export_intvec()
Definition: intvec_wrap.cc:30
static boost::python::object intvec_as_str(const Intvec &p)
Definition: intvec_wrap.cc:10
char * str(leftv arg)
Definition: shared.cc:704