python: add get_highlight_state and get_highlight_edge
* python/spot/impl.i: Here. * tests/python/highlighting.ipynb: Test it. * NEWS: Mention it.
This commit is contained in:
parent
ba86dc6b18
commit
3c638f2a88
3 changed files with 119 additions and 47 deletions
|
|
@ -594,6 +594,14 @@ namespace std {
|
|||
%}
|
||||
|
||||
// Must occur before the twa declaration
|
||||
%typemap(out) unsigned* spot::twa::get_highlight_state,
|
||||
unsigned* spot::twa::get_highlight_edge %{
|
||||
if (!$1)
|
||||
$result = SWIG_Py_Void();
|
||||
else
|
||||
$result = swig::from(*$1);
|
||||
%}
|
||||
|
||||
%typemap(out) SWIGTYPE* spot::twa::get_product_states %{
|
||||
if (!$1)
|
||||
$result = SWIG_Py_Void();
|
||||
|
|
@ -1056,6 +1064,18 @@ static void* ptr_for_bdddict(PyObject* obj)
|
|||
return self;
|
||||
}
|
||||
|
||||
unsigned* get_highlight_state(unsigned state)
|
||||
{
|
||||
std::map<unsigned, unsigned>* hs =
|
||||
self->get_named_prop<std::map<unsigned, unsigned>>("highlight-states");
|
||||
if (!hs)
|
||||
return nullptr;
|
||||
auto it = hs->find(state);
|
||||
if (it == hs->end())
|
||||
return nullptr;
|
||||
return &it->second;
|
||||
}
|
||||
|
||||
twa* remove_highlight_states()
|
||||
{
|
||||
self->set_named_prop("highlight-states", nullptr);
|
||||
|
|
@ -1084,6 +1104,18 @@ static void* ptr_for_bdddict(PyObject* obj)
|
|||
return self;
|
||||
}
|
||||
|
||||
unsigned* get_highlight_edge(unsigned edge)
|
||||
{
|
||||
std::map<unsigned, unsigned>* he =
|
||||
self->get_named_prop<std::map<unsigned, unsigned>>("highlight-edges");
|
||||
if (!he)
|
||||
return nullptr;
|
||||
auto it = he->find(edge);
|
||||
if (it == he->end())
|
||||
return nullptr;
|
||||
return &it->second;
|
||||
}
|
||||
|
||||
twa* remove_highlight_edges()
|
||||
{
|
||||
self->set_named_prop("highlight-edges", nullptr);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue