python: add prints for atomic_prop_set

Fixes #159.

* python/spot/ltsmin.i: Here.
* python/spot/impl.i: Disable duplicate instantiation.
* tests/python/ltsmin.ipynb: Test it.
This commit is contained in:
Alexandre Duret-Lutz 2016-04-08 23:01:07 +02:00
parent e429e2f056
commit 901f287032
3 changed files with 143 additions and 13 deletions

View file

@ -495,6 +495,60 @@ namespace std {
}
}
%extend std::set<spot::formula> {
std::string __str__()
{
std::ostringstream s;
s << "{";
bool comma = false;
for (auto& i: *self)
{
if (comma)
s << ", ";
else
comma = true;
spot::print_psl(s, i);
}
s << "}";
return s.str();
}
std::string __repr__()
{
std::ostringstream s;
s << "{";
bool comma = false;
for (auto& i: *self)
{
if (comma)
s << ", ";
else
comma = true;
spot::print_psl(s, i);
}
s << "}";
return s.str();
}
std::string _repr_latex_()
{
std::ostringstream s;
s << "$\\{";
bool comma = false;
for (auto& i: *self)
{
if (comma)
s << ", ";
else
comma = true;
spot::print_sclatex_psl(s, i);
}
s << "\\}$";
return s.str();
}
}
%exception spot::formula::__getitem__ {
try {
$action

View file

@ -57,10 +57,6 @@ using namespace spot;
}
}
namespace std {
%template(atomic_prop_set) set<spot::formula>;
}
%rename(model) spot::ltsmin_model;
%rename(kripke_raw) spot::ltsmin_model::kripke;
%include <spot/ltsmin/ltsmin.hh>