deprecate copy() in favor of make_twa_graph()

Fixes #258.

* spot/twaalgos/copy.cc: Delete, and move the code...
* spot/twa/twagraph.cc: ... in some anonymous namespace here.
* spot/twa/twagraph.hh: Adjust the make_twa_graph() overload.
* spot/twaalgos/copy.hh, NEWS: Mark copy() as deprecated and redirect
to make_twa_graph().
* doc/org/upgrade2.org, doc/org/tut51.org, python/spot/impl.i,
spot/twaalgos/dot.cc, spot/twaalgos/langmap.cc, tests/core/ikwiad.cc:
Adjust callers.
* spot/twaalgos/Makefile.am: Remove copy.cc.
This commit is contained in:
Alexandre Duret-Lutz 2017-07-25 11:18:03 +02:00
parent 1e9daa73f3
commit 8e685e00c9
12 changed files with 197 additions and 206 deletions

View file

@ -471,7 +471,7 @@ With a small variant of the above code, we could also display the
counterexample on the state space, but only because our state space is
so small: displaying large state spaces is not sensible. Besides, highlighting
a run only works on =twa_graph= automata, so we need to convert the
Kripke structure to a =twa_graph=: this can be done with =copy()=. But
Kripke structure to a =twa_graph=: this can be done with =make_twa_graph()=. But
now =k= is no longer a Kripke structure (also not generated
on-the-fly anymore), so the =print_dot()= function will display it as
a classical automaton with conditions on edges rather than state:
@ -493,7 +493,6 @@ passing the option "~k~" to =print_dot()= will fix that.
#include <spot/twaalgos/translate.hh>
#include <spot/twa/twaproduct.hh>
#include <spot/twaalgos/emptiness.hh>
#include <spot/twaalgos/copy.hh>
<<demo-3-aux>>
int main()
{
@ -509,8 +508,9 @@ passing the option "~k~" to =print_dot()= will fix that.
spot::twa_graph_ptr af = spot::translator(d).run(f);
// Convert demo_kripke into an explicit graph
spot::twa_graph_ptr k = spot::copy(std::make_shared<demo_kripke>(d),
spot::twa::prop_set::all(), true);
spot::twa_graph_ptr k =
spot::make_twa_graph(std::make_shared<demo_kripke>(d),
spot::twa::prop_set::all(), true);
// Find a run of or demo_kripke that intersects af.
if (auto run = k->intersecting_run(af))
{
@ -518,14 +518,14 @@ passing the option "~k~" to =print_dot()= will fix that.
spot::print_dot(std::cout, k, ".k");
}
}
#+END_SRC
#+END_SRC
#+BEGIN_SRC dot :file kripke-3.png :cmdline -Tpng :cmd circo :var txt=demo-3 :exportss results
$txt
#+END_SRC
#+BEGIN_SRC dot :file kripke-3.png :cmdline -Tpng :cmd circo :var txt=demo-3 :exportss results
$txt
#+END_SRC
#+RESULTS:
[[file:kripke-3.png]]
#+RESULTS:
[[file:kripke-3.png]]
* Possible improvements