show how to implement product in Python

* wrap/python/tests/product.ipynb: New file.
* wrap/python/tests/Makefile.am, doc/org/tut.org: Add it.
* wrap/python/tests/ipnbdoctest.py: Ignore %timeit results.
* wrap/python/spot_impl.i: Add bindings for
set_state_names()/get_state_names().
* spot/twaalgos/product.cc: Fix computation of properties.
* doc/org/hoa.org: Name.
* NEWS: Update.
This commit is contained in:
Alexandre Duret-Lutz 2015-12-24 13:15:10 +01:00
parent ad37cacbc0
commit 74ec9c54c4
8 changed files with 2055 additions and 3 deletions

View file

@ -339,6 +339,7 @@ namespace std {
%template(liststr) list<std::string>;
%template(vectorformula) vector<spot::formula>;
%template(vectorunsigned) vector<unsigned>;
%template(vectorstring) vector<string>;
%template(atomic_prop_set) set<spot::formula>;
%template(relabeling_map) map<spot::formula, spot::formula>;
}
@ -465,6 +466,18 @@ namespace std {
std::string __str__() { return spot::str_psl(*self); }
}
%extend spot::bdd_dict {
bool operator==(const spot::bdd_dict& b) const
{
return self == &b;
}
bool operator!=(const spot::bdd_dict& b) const
{
return self != &b;
}
}
%extend spot::twa {
void set_name(std::string name)
{
@ -475,6 +488,17 @@ namespace std {
{
return self->get_named_prop<std::string>("automaton-name");
}
void set_state_names(std::vector<std::string> names)
{
self->set_named_prop("state-names",
new std::vector<std::string>(std::move(names)));
}
std::vector<std::string>* get_state_names()
{
return self->get_named_prop<std::vector<std::string>>("state-names");
}
}