My Project
Loading...
Searching...
No Matches
Functions
number_wrap.cc File Reference
#include "kernel/mod2.h"
#include <boost/python.hpp>
#include "Number.h"
#include "number_wrap.h"
#include "ring_wrap.h"

Go to the source code of this file.

Functions

static boost::python::object Number_as_str (const Number &n)
 
static Ring Number_get_Ring (const Number &n)
 
void export_number ()
 

Function Documentation

◆ export_number()

void export_number ( )

Definition at line 19 of file number_wrap.cc.

20{
21 boost::python::class_<Number>("Number")
22 .def(boost::python::init <int>("creates a number in currRing by default, more complex constructs can be fetched from the interpreter"))
23 .def("__str__", Number_as_str)
24 .def(-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(self-self)
34 .def(int()==self)
35 .def(int()+self)
36 .def(int()*self)
37 .def(int()/self)
38 .def(int()-self)
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 .def(self/=int())
48 .def("ring",Number_get_Ring);
49}
static Ring Number_get_Ring(const Number &n)
Definition: number_wrap.cc:16
static boost::python::object Number_as_str(const Number &n)
Definition: number_wrap.cc:8

◆ Number_as_str()

static boost::python::object Number_as_str ( const Number n)
static

Definition at line 8 of file number_wrap.cc.

9{
10 using boost::python::str;
11 StringSetS("");
12 n.write();
13 char* out=StringEndS();
14 return boost::python::str(out,strlen(out));
15}
void write() const
Definition: Number.h:202
void StringSetS(const char *st)
Definition: reporter.cc:128
char * StringEndS()
Definition: reporter.cc:151

◆ Number_get_Ring()

static Ring Number_get_Ring ( const Number n)
static

Definition at line 16 of file number_wrap.cc.

16 {
17 return n.getRing();
18}
ring getRing() const
Definition: Number.h:212