Skip to content

Commit 267e21f

Browse files
committed
add Job.cpp
1 parent c07422d commit 267e21f

File tree

3 files changed

+17
-3
lines changed

3 files changed

+17
-3
lines changed

Jamfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ local sourceFiles =
221221
Url.cpp
222222
UTF8.cpp
223223
TLS.cpp
224+
Job.cpp
224225

225226
#Kernel
226227
fs_attr.cpp

bindings/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@
111111
from .Url import *
112112
from .UTF8 import *
113113
from .TLS import *
114+
from .Job import *
114115

115116
from .fs_attr import *
116117
from .OS import *

bindings/support/Job.cpp

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,19 @@
88
namespace py = pybind11;
99
using namespace BSupportKit;
1010

11-
void define_Job(py::module_& m)
11+
class PyBJob : public BJob{
12+
public:
13+
using BJob::BJob;
14+
status_t Run() override {
15+
PYBIND11_OVERLOAD(status_t, BJob, Run);
16+
}
17+
status_t Execute() override {
18+
PYBIND11_OVERLOAD_PURE(status_t, BJob, Execute);
19+
}
20+
};
21+
22+
23+
PYBIND11_MODULE(Job, m)
1224
{
1325
py::enum_<BJobState>(m, "BJobState", "")
1426
.value("B_JOB_STATE_WAITING_TO_RUN", BJobState::B_JOB_STATE_WAITING_TO_RUN, "")
@@ -27,7 +39,7 @@ py::class_<BJobStateListener>(m, "BJobStateListener")
2739
.def("JobAborted", &BJobStateListener::JobAborted, "", py::arg("job"))
2840
;
2941

30-
py::class_<BJob>(m, "BJob")
42+
py::class_<BJob,PyBJob>(m, "BJob")
3143
.def(py::init<const BString &>(), "", py::arg("title"))
3244
.def("InitCheck", &BJob::InitCheck, "")
3345
.def("Run", &BJob::Run, "")
@@ -43,7 +55,7 @@ py::class_<BJob>(m, "BJob")
4355
.def("RemoveDependency", &BJob::RemoveDependency, "", py::arg("job"))
4456
.def("CountDependencies", &BJob::CountDependencies, "")
4557
.def("DependantJobAt", &BJob::DependantJobAt, "", py::arg("index"))
46-
.def_readwrite("Private", &BJob::Private, "")
58+
//.def_readwrite("Private", &BJob::Private, "")
4759
;
4860

4961

0 commit comments

Comments
 (0)