Make load map methods const

This commit is contained in:
nsubiron 2019-02-22 15:49:50 +01:00
parent 3ec2483316
commit 5210cd71f0
3 changed files with 5 additions and 4 deletions

View File

@ -43,11 +43,11 @@ namespace client {
return _simulator->GetServerVersion();
}
World ReloadWorld() {
World ReloadWorld() const {
return World{_simulator->ReloadEpisode()};
}
World LoadWorld(std::string map_name) {
World LoadWorld(std::string map_name) const {
return World{_simulator->LoadEpisode(std::move(map_name))};
}

View File

@ -22,8 +22,8 @@ void export_client() {
.def("get_client_version", &cc::Client::GetClientVersion)
.def("get_server_version", CONST_CALL_WITHOUT_GIL(cc::Client, GetServerVersion))
.def("get_world", &cc::Client::GetWorld)
.def("reload_world", CALL_WITHOUT_GIL(cc::Client, ReloadWorld))
.def("load_world", CALL_WITHOUT_GIL_1(cc::Client, LoadWorld, std::string), (arg("map_name")))
.def("reload_world", CONST_CALL_WITHOUT_GIL(cc::Client, ReloadWorld))
.def("load_world", CONST_CALL_WITHOUT_GIL_1(cc::Client, LoadWorld, std::string), (arg("map_name")))
.def("start_recorder", CALL_WITHOUT_GIL_1(cc::Client, StartRecorder, std::string), (arg("name")))
.def("stop_recorder", &cc::Client::StopRecorder)
.def("show_recorder_file_info", CALL_WITHOUT_GIL_1(cc::Client, ShowRecorderFileInfo, std::string), (arg("name")))

View File

@ -44,6 +44,7 @@
// Convenient for const requests without arguments.
#define CONST_CALL_WITHOUT_GIL(cls, fn) CALL_WITHOUT_GIL(const cls, fn)
#define CONST_CALL_WITHOUT_GIL_1(cls, fn, T1_) CALL_WITHOUT_GIL_1(const cls, fn, T1_)
// Convenient for const requests that need to make a copy of the returned value.
#define CALL_RETURNING_COPY(cls, fn) +[](const cls &self) \