My Project
Loading...
Searching...
No Matches
Singular
dyn_modules
python
number_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 "
Number.h
"
5
#include "
number_wrap.h
"
6
#include "
ring_wrap.h
"
7
using
boost::python::self;
8
static
boost::python::object
Number_as_str
(
const
Number
& n)
9
{
10
using
boost::python::str;
11
StringSetS
(
""
);
12
n.
write
();
13
char
* out=
StringEndS
();
14
return
boost::python::str(out,strlen(out));
15
}
16
static
Ring
Number_get_Ring
(
const
Number
& n){
17
return
n.
getRing
();
18
}
19
void
export_number
()
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
}
50
#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
Generated on Thu Mar 20 2025 00:00:00 for My Project by
doxygen 1.13.2
for
Singular