Fix tgta_explicit not to inherit from ta_explicit to please clang++.

* src/ta/tgtaexplicit.cc, src/ta/tgtaexplicit.hh: Use a ta_explicit
attribute instead of inheriting from it.
(get_ta): New method.
* src/taalgos/minimize.cc, src/taalgos/minimize.hh,
src/taalgos/tgba2ta.cc, src/tgbatest/ltl2tgba.cc: Adjust usage.
* wrap/python/spot.i (as_ta): Remove, now that we have get_ta.
* wrap/python/ajax/spot.in: Use get_ta instead of as_ta.
This commit is contained in:
Alexandre Duret-Lutz 2012-06-28 16:55:36 +02:00
parent d4130f15bf
commit 941cb0b57b
8 changed files with 59 additions and 69 deletions

View file

@ -514,13 +514,12 @@ namespace spot
std::list<hash_set*>::iterator itdone;
for (itdone = partition.begin(); itdone != partition.end(); ++itdone)
delete *itdone;
//delete ta_;
return res;
}
tgta*
minimize_tgta(const tgta* tgta_)
tgta_explicit*
minimize_tgta(const tgta_explicit* tgta_)
{
tgba_explicit_number* tgba = new tgba_explicit_number(tgta_->get_dict());
@ -528,19 +527,17 @@ namespace spot
tgta_explicit* res = new tgta_explicit(tgba, tgta_->all_acceptance_conditions(),
0, /* own_tgba = */ true);
//TODO copier le tgta_ dans un tgta_explicit au lieu de faire un cast...
const ta_explicit* tgta = dynamic_cast<const tgta_explicit*> (tgta_);
const ta_explicit* ta = tgta_->get_ta();
partition_t partition = build_partition(tgta);
partition_t partition = build_partition(ta);
// Build the minimal tgta automaton.
build_result(tgta, partition, tgba, res);
build_result(ta, partition, tgba, res->get_ta());
// Free all the allocated memory.
std::list<hash_set*>::iterator itdone;
for (itdone = partition.begin(); itdone != partition.end(); ++itdone)
delete *itdone;
//delete ta_;
return res;
}

View file

@ -1,5 +1,6 @@
// Copyright (C) 2009, 2010, 2011 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
// -*- coding: utf-8 -*-
// Copyright (C) 2009, 2010, 2011, 2012 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
//
@ -23,7 +24,7 @@
# include "ta/ta.hh"
# include "ta/tgta.hh"
# include "ta/taexplicit.hh"
# include "ta/tgtaexplicit.hh"
namespace spot
{
@ -71,8 +72,8 @@ namespace spot
/// the acceptance conditions of the outgoing transitions.
///
/// \param tgta_ the TGTA automaton to convert into a simplified TGTA
tgta*
minimize_tgta(const tgta* tgta_);
tgta_explicit*
minimize_tgta(const tgta_explicit* tgta_);
/// @}
}

View file

@ -621,28 +621,30 @@ compute_livelock_acceptance_states(ta_explicit* testing_automata,
// build a Generalized TA automaton involving a single_pass_emptiness_check
// (without an artificial livelock state):
build_ta(tgta, atomic_propositions_set_, false, true, false);
ta_explicit* ta = tgta->get_ta();
build_ta(ta, atomic_propositions_set_, false, true, false);
trace
<< "***tgba_to_tgbta: POST build_ta***" << std::endl;
trace << "***tgba_to_tgbta: POST build_ta***" << std::endl;
// adapt a ta automata to build tgta automata :
ta::states_set_t states_set = tgta->get_states_set();
ta::states_set_t states_set = ta->get_states_set();
ta::states_set_t::iterator it;
tgba_succ_iterator* initial_states_iter = tgta->succ_iter(
tgta->get_artificial_initial_state());
tgba_succ_iterator* initial_states_iter =
ta->succ_iter(ta->get_artificial_initial_state());
initial_states_iter->first();
if (initial_states_iter->done())
return tgta;
bdd first_state_condition = (initial_states_iter)->current_condition();
{
delete initial_states_iter;
return tgta;
}
bdd first_state_condition = initial_states_iter->current_condition();
delete initial_states_iter;
bdd bdd_stutering_transition = bdd_setxor(first_state_condition,
first_state_condition);
first_state_condition);
for (it = states_set.begin(); it != states_set.end(); it++)
{
state_ta_explicit* state = static_cast<state_ta_explicit*> (*it);
state_ta_explicit::transitions* trans = state->get_transitions();
@ -652,21 +654,18 @@ compute_livelock_acceptance_states(ta_explicit* testing_automata,
bool trans_empty = (trans == 0 || trans->empty());
if (trans_empty || state->is_accepting_state())
{
tgta->create_transition(state, bdd_stutering_transition,
tgta->all_acceptance_conditions(), state);
ta->create_transition(state, bdd_stutering_transition,
ta->all_acceptance_conditions(), state);
}
}
if (state->compare(tgta->get_artificial_initial_state()))
tgta->create_transition(state, bdd_stutering_transition, bddfalse,
state);
if (state->compare(ta->get_artificial_initial_state()))
ta->create_transition(state, bdd_stutering_transition, bddfalse, state);
state->set_livelock_accepting_state(false);
state->set_accepting_state(false);
trace
<< "***tgba_to_tgbta: POST create_transition ***" << std::endl;
trace << "***tgba_to_tgbta: POST create_transition ***" << std::endl;
}
return tgta;