source: git/modules/python/CF_wrap.cc @ d5774ab

spielwiese
Last change on this file since d5774ab was d5774ab, checked in by Michael Brickenstein <bricken@…>, 19 years ago
*bricken: support for NOSTREAMIO git-svn-id: file:///usr/local/Singular/svn/trunk@8616 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 1.0 KB
Line 
1#include <sstream>
2#include <boost/python.hpp>
3#include "mod2.h"
4#include "factory.h"
5
6using boost::python::self;
7#ifndef NOSTREAMIO
8static boost::python::object CF_as_str(const CanonicalForm& f)
9{
10  using boost::python::str;
11  std::basic_stringstream<char>  s;
12  s<<f;
13  return boost::python::str(s.str());
14}
15#endif
16void export_CF(){
17    boost::python::class_<CanonicalForm>("canonical_form")
18    .def(boost::python::init <const int>())
19    .def(boost::python::init <const Variable>())
20#ifndef NOSTREAMIO
21    .def("__str__", CF_as_str)
22#endif
23    .def(-self)
24    .def(self*=self)
25    .def(self+=self)
26    .def(self-=self)
27    .def(self/=self)
28    .def(self==self)
29    .def(self+self)
30    .def(self*self)
31    .def(self/self)
32    .def(self-self)
33    .def(int()==self)
34    .def(int()+self)
35    .def(int()*self)
36    .def(int()/self)
37    .def(int()-self)
38    .def(self==int())
39    .def(self+int())
40    .def(self*int())
41    .def(self/int())
42    .def(self-int())
43    .def(self*=int())
44    .def(self+=int())
45    .def(self-=int())
46    .def(self/=int());
47}
Note: See TracBrowser for help on using the repository browser.