tgba: simplify usage of named properties

* src/tgba/tgba.hh, src/tgba/tgba.cc (set_named_prop): Add a template
version.
(get_named_prop): Hide the old version, and supply a template version
that casts.
* src/bin/ltlcross.cc, src/hoaparse/hoaparse.yy, src/tgbaalgos/hoa.cc,
src/tgbaalgos/product.cc: Adjust usage.
This commit is contained in:
Alexandre Duret-Lutz 2014-12-09 16:20:12 +01:00
parent 5a1e38d90f
commit 61edf7f41d
6 changed files with 23 additions and 12 deletions

View file

@ -250,9 +250,9 @@ namespace spot
const char nl = newline ? '\n' : ' ';
os << "HOA: v1" << nl;
auto* n = aut->get_named_prop("automaton-name");
auto n = aut->get_named_prop<std::string>("automaton-name");
if (n)
escape_str(os << "name: \"", *static_cast<std::string*>(n)) << '"' << nl;
escape_str(os << "name: \"", *n) << '"' << nl;
else if (f)
escape_str(os << "name: \"", to_string(f)) << '"' << nl;
os << "States: " << num_states << nl

View file

@ -56,9 +56,7 @@ namespace spot
+ right->acc().num_sets());
auto v = new product_states;
res->set_named_prop("product-states", v, [](void* vv) {
delete static_cast<product_states*>(vv);
});
res->set_named_prop("product-states", v);
auto new_state =
[&](unsigned left_state, unsigned right_state) -> unsigned