Loading...
Searching...
No Matches
number_wrap.cc
Go to the documentation of this file.
#include "kernel/mod2.h"
#ifdef HAVE_PYTHON
#include <boost/python.hpp>
#include "Number.h"
#include "number_wrap.h"
#include "ring_wrap.h"
using boost::python::self;
static boost::python::object Number_as_str(const Number& n)
{
using boost::python::str;
StringSetS("");
n.write();
char* out=StringEndS();
return boost::python::str(out,strlen(out));
}
static Ring Number_get_Ring(const Number & n){
return n.getRing();
}
void export_number()
{
boost::python::class_<Number>("Number")
.def(boost::python::init <int>("creates a number in currRing by default, more complex constructs can be fetched from the interpreter"))
.def("__str__", Number_as_str)
.def(-self)
.def(self*=self)
.def(self+=self)
.def(self-=self)
.def(self/=self)
.def(self==self)
.def(self+self)
.def(self*self)
.def(self/self)
.def(self-self)
.def(int()==self)
.def(int()+self)
.def(int()*self)
.def(int()/self)
.def(int()-self)
.def(self==int())
.def(self+int())
.def(self*int())
.def(self/int())
.def(self-int())
.def(self*=int())
.def(self+=int())
.def(self-=int())
.def(self/=int())
.def("ring",Number_get_Ring);
}
#endif
Number.h
Number
Definition Number.h:34
Number::getRing
ring getRing() const
Definition Number.h:212
Number::write
void write() const
Definition Number.h:202
Ring
Definition ring_wrap.h:21
mod2.h
Number_get_Ring
static Ring Number_get_Ring(const Number &n)
Definition number_wrap.cc:16
export_number
void export_number()
Definition number_wrap.cc:19
Number_as_str
static boost::python::object Number_as_str(const Number &n)
Definition number_wrap.cc:8
number_wrap.h
StringSetS
void StringSetS(const char *st)
Definition reporter.cc:128
StringEndS
char * StringEndS()
Definition reporter.cc:151
ring_wrap.h