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

View file

@ -35,6 +35,7 @@ check_PROGRAMS = \
bddprod \
complement \
explicit \
explicit2 \
expldot \
explprod \
intvcomp \
@ -53,6 +54,7 @@ bddprod_SOURCES = ltlprod.cc
bddprod_CXXFLAGS = -DBDD_CONCRETE_PRODUCT
complement_SOURCES = complementation.cc
explicit_SOURCES = explicit.cc
explicit2_SOURCES = explicit2.cc
expldot_SOURCES = powerset.cc
expldot_CXXFLAGS = -DDOTTY
explprod_SOURCES = explprod.cc

View file

@ -131,7 +131,7 @@ int main(int argc, char* argv[])
{
spot::ltl::environment& env(spot::ltl::default_environment::instance());
spot::tgba_parse_error_list pel;
spot::tgba_explicit* a = spot::tgba_parse(file, pel, dict, env);
spot::tgba_explicit_string* a = spot::tgba_parse(file, pel, dict, env);
if (spot::format_tgba_parse_errors(std::cerr, file, pel))
return 2;

View file

@ -37,7 +37,7 @@ main()
spot::ltl::default_environment::instance();
spot::tgba_explicit_string* a = new spot::tgba_explicit_string(dict);
typedef spot::tgba_explicit::transition trans;
typedef spot::state_explicit_string::transition trans;
trans* t1 = a->create_transition("state 0", "state 1");
trans* t2 = a->create_transition("state 1", "state 2");

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);
}

View file

@ -49,11 +49,11 @@ main(int argc, char** argv)
spot::ltl::environment& env(spot::ltl::default_environment::instance());
spot::tgba_parse_error_list pel1;
spot::tgba_explicit* a1 = spot::tgba_parse(argv[1], pel1, dict, env);
spot::tgba_explicit_string* a1 = spot::tgba_parse(argv[1], pel1, dict, env);
if (spot::format_tgba_parse_errors(std::cerr, argv[1], pel1))
return 2;
spot::tgba_parse_error_list pel2;
spot::tgba_explicit* a2 = spot::tgba_parse(argv[2], pel2, dict, env);
spot::tgba_explicit_string* a2 = spot::tgba_parse(argv[2], pel2, dict, env);
if (spot::format_tgba_parse_errors(std::cerr, argv[2], pel2))
return 2;

View file

@ -1058,7 +1058,7 @@ main(int argc, char** argv)
}
}
const spot::tgba_explicit* expl = 0;
const spot::tgba_explicit_string* expl = 0;
switch (dupexp)
{
case NoneDup:

View file

@ -57,7 +57,7 @@ main(int argc, char** argv)
return 2;
spot::tgba_parse_error_list pel2;
spot::tgba_explicit* a2 = spot::tgba_parse(argv[2], pel2, dict, env);
spot::tgba_explicit_string* a2 = spot::tgba_parse(argv[2], pel2, dict, env);
if (spot::format_tgba_parse_errors(std::cerr, argv[2], pel2))
return 2;

View file

@ -50,13 +50,13 @@ main(int argc, char** argv)
spot::ltl::environment& env(spot::ltl::default_environment::instance());
spot::tgba_parse_error_list pel;
spot::tgba_explicit* a = spot::tgba_parse(argv[1], pel, dict, env);
spot::tgba_explicit_string* a = spot::tgba_parse(argv[1], pel, dict, env);
if (spot::format_tgba_parse_errors(std::cerr, argv[1], pel))
return 2;
#ifndef DOTTY
spot::tgba_explicit* e = spot::tgba_powerset(a);
spot::tgba_explicit_number* e = spot::tgba_powerset(a);
spot::tgba_save_reachable(std::cout, e);
delete e;
#else

View file

@ -58,8 +58,8 @@ main(int argc, char** argv)
spot::ltl::environment& env(spot::ltl::default_environment::instance());
spot::tgba_parse_error_list pel;
spot::tgba_explicit* a = spot::tgba_parse(argv[filename_index],
pel, dict, env, env, debug);
spot::tgba_explicit_string* a = spot::tgba_parse(argv[filename_index],
pel, dict, env, env, debug);
if (spot::format_tgba_parse_errors(std::cerr, argv[filename_index], pel))
return 2;

View file

@ -49,15 +49,15 @@ main(int argc, char** argv)
spot::ltl::environment& env(spot::ltl::default_environment::instance());
spot::tgba_parse_error_list pel1;
spot::tgba_explicit* a1 = spot::tgba_parse(argv[1], pel1, dict, env);
spot::tgba_explicit_string* a1 = spot::tgba_parse(argv[1], pel1, dict, env);
if (spot::format_tgba_parse_errors(std::cerr, argv[1], pel1))
return 2;
spot::tgba_parse_error_list pel2;
spot::tgba_explicit* a2 = spot::tgba_parse(argv[2], pel2, dict, env);
spot::tgba_explicit_string* a2 = spot::tgba_parse(argv[2], pel2, dict, env);
if (spot::format_tgba_parse_errors(std::cerr, argv[2], pel2))
return 2;
spot::tgba_parse_error_list pel3;
spot::tgba_explicit* a3 = spot::tgba_parse(argv[3], pel3, dict, env);
spot::tgba_explicit_string* a3 = spot::tgba_parse(argv[3], pel3, dict, env);
if (spot::format_tgba_parse_errors(std::cerr, argv[3], pel3))
return 2;