Revamp tgbaexplicit.hh

* src/tgba/tgbaexplicit.hh, src/tgba/tgbaexplicit.cc: Factor most of
the code in an explicit_graph<State, Type> that inherits from type.
The tgba_explicit type<State> now inherits from
explicit_graph<State,tgba>.
* src/ltlvisit/contain.cc, src/neverparse/neverclaimparse.yy
src/tgba/tgbareduc.cc, src/tgba/tgbareduc.hh, src/tgbaalgos/cutscc.cc,
src/tgbaalgos/dupexp.cc, src/tgbaalgos/dupexp.hh,
src/tgbaalgos/emptiness.cc, src/tgbaalgos/ltl2tgba_fm.cc,
src/tgbaalgos/ltl2tgba_fm.hh, src/tgbaalgos/minimize.cc,
src/tgbaalgos/powerset.cc, src/tgbaalgos/randomgraph.cc,
src/tgbaalgos/sccfilter.cc, src/tgbaparse/tgbaparse.yy,
src/tgbatest/complementation.cc, src/tgbatest/explicit.cc,
src/tgbatest/explprod.cc, src/tgbatest/ltl2tgba.cc,
src/tgbatest/mixprod.cc, src/tgbatest/powerset.cc,
src/tgbatest/tgbaread.cc, src/tgbatest/tripprod.cc:
Replace tgba_explicit* by the actual type used.
* src/tgbatest/explicit2.cc: New file.
* src/tgbatest/Makefile.am: Add it.
This commit is contained in:
Pierre PARUTTO 2012-03-06 00:13:15 +01:00 committed by Alexandre Duret-Lutz
parent 9e2b932fe6
commit a15aac2845
27 changed files with 810 additions and 708 deletions

126
src/tgbatest/explicit2.cc Normal file
View file

@ -0,0 +1,126 @@
// Copyright (C) 2012 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
//
// Spot is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// Spot is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
// License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Spot; see the file COPYING. If not, write to the Free
// Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
#include <iostream>
#include <cassert>
#include "ltlenv/defaultenv.hh"
#include "ltlast/allnodes.hh"
#include "tgba/tgbaexplicit.hh"
using namespace spot;
void
create_tgba_explicit_string(bdd_dict* d)
{
tgba_explicit<state_explicit_string>* tgba =
new tgba_explicit<state_explicit_string>(d);
state_explicit_string* s1 = tgba->add_state("toto");
state_explicit_string* s2 = tgba->add_state("tata");
state_explicit_string::transition* t =
tgba->create_transition(s1, s2);
(void) t;
tgba_explicit_succ_iterator<state_explicit_string>* it
= tgba->succ_iter(tgba->get_init_state());
for (it->first(); !it->done(); it->next())
{
state_explicit_string* se = it->current_state();
std::cout << se->label() << std::endl;
se->destroy();
}
delete it;
delete tgba;
}
void
create_tgba_explicit_number(bdd_dict* d)
{
tgba_explicit<state_explicit_number>* tgba =
new tgba_explicit<state_explicit_number>(d);
state_explicit_number* s1 = tgba->add_state(51);
state_explicit_number* s2 = tgba->add_state(69);
state_explicit_number::transition* t =
tgba->create_transition(s1, s2);
(void) t;
tgba_explicit_succ_iterator<state_explicit_number>* it =
tgba->succ_iter(tgba->get_init_state());
for (it->first(); !it->done(); it->next())
{
state_explicit_number* s = it->current_state();
std::cout << s->label() << std::endl;
s->destroy();
}
delete it;
delete tgba;
}
void
create_tgba_explicit_formula(bdd_dict* d, spot::ltl::default_environment& e)
{
tgba_explicit<state_explicit_formula>* tgba =
new tgba_explicit<state_explicit_formula>(d);
state_explicit_formula* s1 = tgba->add_state(e.require("a"));
state_explicit_formula* s2 = tgba->add_state(e.require("b"));
state_explicit_formula::transition* t =
tgba->create_transition(s1, s2);
(void) t;
tgba_explicit_succ_iterator<state_explicit_formula>* it =
tgba->succ_iter(tgba->get_init_state());
for (it->first(); !it->done(); it->next())
{
state_explicit_formula* s = it->current_state();
std::cout << s->label() << std::endl;
s->destroy();
}
delete it;
delete tgba;
}
int
main(int argc, char** argv)
{
(void) argc;
(void) argv;
bdd_dict* d = new spot::bdd_dict();
spot::ltl::default_environment& e =
spot::ltl::default_environment::instance();
create_tgba_explicit_string(d);
create_tgba_explicit_number(d);
create_tgba_explicit_formula(d, e);
delete d;
assert(spot::ltl::atomic_prop::instance_count() == 0);
assert(spot::ltl::unop::instance_count() == 0);
assert(spot::ltl::binop::instance_count() == 0);
assert(spot::ltl::multop::instance_count() == 0);
}