Skip to content

Commit d025449

Browse files
pytthon binding fixes
1 parent fbc51f0 commit d025449

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/fields/type_registry_python.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44
#include "fields/field_definition.h"
55
#include "fields/field_update.h"
66
#include "fields/type.h"
7+
#include "fields/obj.h"
78
#include "fields/type_registry.h"
89
#include "fields/input_field.h"
910
#include "fields/subtraction.h"
1011
#include "fields/test_type.h"
12+
#include "fields/test_object.h"
1113

1214

1315
// ----------------
@@ -70,8 +72,17 @@ PYBIND11_MODULE(aika, m)
7072
);
7173
}, py::return_value_policy::take_ownership);
7274

75+
py::class_<Obj>(m, "Obj")
76+
.def("__str__", [](const Obj &t) {
77+
return t.toString();
78+
});
79+
7380
py::class_<TestType, Type>(m, "TestType")
74-
.def(py::init<TypeRegistry*, const std::string&>());
81+
.def(py::init<TypeRegistry*, const std::string&>())
82+
.def("instantiate", &TestType::instantiate, py::return_value_policy::take_ownership);
83+
84+
py::class_<TestObject, Obj>(m, "TestObj")
85+
.def(py::init<TestType*>());
7586

7687
py::class_<TypeRegistry>(m, "TypeRegistry")
7788
.def(py::init<>())

0 commit comments

Comments
 (0)