source: git/dyn_modules/python/intvec_wrap.cc @ 246bbb

fieker-DuValspielwiese
Last change on this file since 246bbb was 6ce030f, checked in by Oleksandr Motsak <motsak@…>, 12 years ago
removal of the $Id$ svn tag from everywhere NOTE: the git SHA1 may be used instead (only on special places) NOTE: the libraries Singular/LIB/*.lib still contain the marker due to our current use of svn
  • Property mode set to 100644
File size: 736 bytes
Line 
1#include <boost/python.hpp>
2#include <boost/python/suite/indexing/vector_indexing_suite.hpp>
3#include <kernel/mod2.h>
4#include "intvec_wrap.h"
5
6
7using namespace boost::python;
8static boost::python::object intvec_as_str(const Intvec& p)
9{ 
10  using boost::python::str;
11  //ring r=p.getRing();
12  str helper;
13  list tojoin;
14  int i;
15  int s=p.size();
16  tojoin.append("[");
17  for(i=0;i<s;i++){
18    tojoin.append(str(p[i]));
19    if (i<s-1)
20      tojoin.append(", ");
21  }
22  tojoin.append("]");
23  str res=helper.join(tojoin);
24  return res;
25
26}
27
28void export_intvec(){
29boost::python::class_<Intvec>("IntVector")
30      .def("__str__", intvec_as_str)
31     .def(boost::python::init <>())
32     .def(boost::python::vector_indexing_suite<Intvec>());
33}
Note: See TracBrowser for help on using the repository browser.