word: store the bdd dict for easier printing
* src/twaalgos/word.hh, src/twaalgos/word.cc: Store the bdd_dict, and replace the print() method by a << overload. * NEWS: Mention it. * src/bin/ltlcross.cc, src/bin/common_aoutput.hh: Adjust.
This commit is contained in:
parent
cff79b063b
commit
2052e73af8
5 changed files with 27 additions and 9 deletions
1
NEWS
1
NEWS
|
|
@ -81,6 +81,7 @@ New in spot 1.99.5a (not yet released)
|
||||||
* Renamings:
|
* Renamings:
|
||||||
is_guarantee_automaton() -> is_terminal_automaton()
|
is_guarantee_automaton() -> is_terminal_automaton()
|
||||||
tgba_run -> twa_run
|
tgba_run -> twa_run
|
||||||
|
twa_word::print -> operator<<
|
||||||
dtgba_sat_synthetize() -> dtwa_sat_synthetize()
|
dtgba_sat_synthetize() -> dtwa_sat_synthetize()
|
||||||
dtgba_sat_synthetize_dichotomy() -> dtwa_sat_synthetize_dichotomy()
|
dtgba_sat_synthetize_dichotomy() -> dtwa_sat_synthetize_dichotomy()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -181,7 +181,7 @@ public:
|
||||||
spot::twa_word w(run->reduce());
|
spot::twa_word w(run->reduce());
|
||||||
w.simplify();
|
w.simplify();
|
||||||
std::ostringstream out;
|
std::ostringstream out;
|
||||||
w.print(out, aut->get_dict());
|
out << w;
|
||||||
aut_word_ = out.str();
|
aut_word_ = out.str();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -695,7 +695,7 @@ namespace
|
||||||
<< " ";
|
<< " ";
|
||||||
spot::twa_word w(run->reduce());
|
spot::twa_word w(run->reduce());
|
||||||
w.simplify();
|
w.simplify();
|
||||||
w.print(example(), prod->get_dict()) << '\n';
|
example() << w << '\n';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -24,11 +24,13 @@
|
||||||
namespace spot
|
namespace spot
|
||||||
{
|
{
|
||||||
twa_word::twa_word(const twa_run_ptr run)
|
twa_word::twa_word(const twa_run_ptr run)
|
||||||
|
: dict_(run->aut->get_dict())
|
||||||
{
|
{
|
||||||
for (auto& i: run->prefix)
|
for (auto& i: run->prefix)
|
||||||
prefix.push_back(i.label);
|
prefix.push_back(i.label);
|
||||||
for (auto& i: run->cycle)
|
for (auto& i: run->cycle)
|
||||||
cycle.push_back(i.label);
|
cycle.push_back(i.label);
|
||||||
|
dict_->register_all_variables_of(run->aut, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -81,18 +83,19 @@ namespace spot
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostream&
|
std::ostream&
|
||||||
twa_word::print(std::ostream& os, const bdd_dict_ptr& d) const
|
operator<<(std::ostream& os, const twa_word& w)
|
||||||
{
|
{
|
||||||
if (!prefix.empty())
|
auto d = w.get_dict();
|
||||||
for (auto& i: prefix)
|
if (!w.prefix.empty())
|
||||||
|
for (auto& i: w.prefix)
|
||||||
{
|
{
|
||||||
bdd_print_formula(os, d, i);
|
bdd_print_formula(os, d, i);
|
||||||
os << "; ";
|
os << "; ";
|
||||||
}
|
}
|
||||||
assert(!cycle.empty());
|
assert(!w.cycle.empty());
|
||||||
bool notfirst = false;
|
bool notfirst = false;
|
||||||
os << "cycle{";
|
os << "cycle{";
|
||||||
for (auto& i: cycle)
|
for (auto& i: w.cycle)
|
||||||
{
|
{
|
||||||
if (notfirst)
|
if (notfirst)
|
||||||
os << "; ";
|
os << "; ";
|
||||||
|
|
|
||||||
|
|
@ -26,15 +26,29 @@ namespace spot
|
||||||
class bdd_dict;
|
class bdd_dict;
|
||||||
|
|
||||||
/// \brief An infinite word stored as a lasso.
|
/// \brief An infinite word stored as a lasso.
|
||||||
struct SPOT_API twa_word
|
struct SPOT_API twa_word final
|
||||||
{
|
{
|
||||||
twa_word(const twa_run_ptr run);
|
twa_word(const twa_run_ptr run);
|
||||||
|
~twa_word()
|
||||||
|
{
|
||||||
|
dict_->unregister_all_my_variables(this);
|
||||||
|
}
|
||||||
|
|
||||||
void simplify();
|
void simplify();
|
||||||
std::ostream& print(std::ostream& os, const bdd_dict_ptr& d) const;
|
|
||||||
|
|
||||||
typedef std::list<bdd> seq_t;
|
typedef std::list<bdd> seq_t;
|
||||||
seq_t prefix;
|
seq_t prefix;
|
||||||
seq_t cycle;
|
seq_t cycle;
|
||||||
|
|
||||||
|
bdd_dict_ptr get_dict() const
|
||||||
|
{
|
||||||
|
return dict_;
|
||||||
|
}
|
||||||
|
|
||||||
|
SPOT_API
|
||||||
|
friend std::ostream& operator<<(std::ostream& os, const twa_word& w);
|
||||||
|
private:
|
||||||
|
bdd_dict_ptr dict_;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue