Skip to content

Commit

Permalink
Add Python wrapper for UnitSpecies APIs (#454)
Browse files Browse the repository at this point in the history
  • Loading branch information
kaizu authored Feb 7, 2020
1 parent 7c4d5c2 commit cebd2a1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
5 changes: 5 additions & 0 deletions ecell4/core/UnitSpecies.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,11 @@ class UnitSpecies
std::make_pair(name, site_type()), site_comparerator()));
}

const container_type& sites() const
{
return sites_;
}

protected:

std::string name_;
Expand Down
10 changes: 8 additions & 2 deletions ecell4/python_api/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,16 @@ void define_species(py::module& m)
py::class_<UnitSpecies>(m, "UnitSpecies")
.def(py::init<>())
.def(py::init<const std::string&>(), py::arg("name"))
.def("serial", &UnitSpecies::serial)
.def("name", &UnitSpecies::name)
.def("add_site", &UnitSpecies::add_site)
.def("set_name", &UnitSpecies::set_name)
.def("deserialize", &UnitSpecies::deserialize)
.def("serial", &UnitSpecies::serial)
.def("clear", &UnitSpecies::clear)
.def("add_site", &UnitSpecies::add_site)
// .def("num_sites", &UnitSpecies::num_sites)
.def("has_site", &UnitSpecies::has_site)
.def("get_site", &UnitSpecies::get_site)
.def("sites", &UnitSpecies::sites)
.def(py::self == py::self)
.def("__hash__",
[](const UnitSpecies& self)
Expand Down

0 comments on commit cebd2a1

Please sign in to comment.