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:
parent
e429e2f056
commit
901f287032
3 changed files with 143 additions and 13 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue