Make bdd_dict a shared pointer.

* src/tgba/bdddict.hh (bdd_dict_ptr): New type.
(make_bdd_dict): New function.
* iface/dve2/dve2.cc, iface/dve2/dve2.hh, iface/dve2/dve2check.cc,
src/bin/dstar2tgba.cc, src/bin/ltlcross.cc,
src/dstarparse/dstarparse.yy, src/dstarparse/public.hh,
src/graphtest/tgbagraph.cc, src/kripke/kripkeexplicit.cc,
src/kripke/kripkeexplicit.hh, src/kripke/kripkeprint.cc,
src/kripkeparse/kripkeparse.yy, src/kripkeparse/public.hh,
src/kripketest/parse_print_test.cc, src/ltlvisit/apcollect.cc,
src/ltlvisit/contain.cc, src/ltlvisit/contain.hh,
src/ltlvisit/simplify.cc, src/ltlvisit/simplify.hh,
src/neverparse/neverclaimparse.yy, src/neverparse/public.hh,
src/priv/accmap.hh, src/saba/saba.hh, src/saba/sabacomplementtgba.cc,
src/saba/sabacomplementtgba.hh, src/sabatest/sabacomplementtgba.cc,
src/ta/ta.hh, src/ta/taexplicit.cc, src/ta/taexplicit.hh,
src/ta/taproduct.cc, src/ta/taproduct.hh, src/ta/tgtaexplicit.cc,
src/ta/tgtaexplicit.hh, src/taalgos/dotty.cc, src/tgba/bddprint.cc,
src/tgba/bddprint.hh, src/tgba/formula2bdd.cc, src/tgba/formula2bdd.hh,
src/tgba/taatgba.cc, src/tgba/taatgba.hh, src/tgba/tgba.hh,
src/tgba/tgbagraph.hh, src/tgba/tgbakvcomplement.cc,
src/tgba/tgbakvcomplement.hh, src/tgba/tgbaproduct.cc,
src/tgba/tgbaproduct.hh, src/tgba/tgbaproxy.cc, src/tgba/tgbaproxy.hh,
src/tgba/tgbasafracomplement.cc, src/tgba/tgbasafracomplement.hh,
src/tgba/tgbascc.cc, src/tgba/tgbascc.hh, src/tgba/tgbasgba.cc,
src/tgba/tgbasgba.hh, src/tgba/tgbaunion.cc, src/tgba/tgbaunion.hh,
src/tgba/wdbacomp.cc, src/tgbaalgos/compsusp.cc,
src/tgbaalgos/compsusp.hh, src/tgbaalgos/degen.cc,
src/tgbaalgos/dtbasat.cc, src/tgbaalgos/dtgbasat.cc,
src/tgbaalgos/emptiness.cc, src/tgbaalgos/lbtt.cc,
src/tgbaalgos/lbtt.hh, src/tgbaalgos/ltl2taa.cc,
src/tgbaalgos/ltl2taa.hh, src/tgbaalgos/ltl2tgba_fm.cc,
src/tgbaalgos/ltl2tgba_fm.hh, src/tgbaalgos/randomgraph.cc,
src/tgbaalgos/randomgraph.hh, src/tgbaalgos/save.cc,
src/tgbaalgos/translate.cc, src/tgbaalgos/translate.hh,
src/tgbaalgos/word.cc, src/tgbaalgos/word.hh, src/tgbaparse/public.hh,
src/tgbaparse/tgbaparse.yy, src/tgbatest/complementation.cc,
src/tgbatest/explprod.cc, src/tgbatest/ltl2tgba.cc,
src/tgbatest/ltlprod.cc, src/tgbatest/maskacc.cc,
src/tgbatest/powerset.cc, src/tgbatest/randtgba.cc,
src/tgbatest/taatgba.cc, src/tgbatest/tgbaread.cc,
src/tgbatest/tripprod.cc, wrap/python/ajax/spot.in,
wrap/python/tests/alarm.py, wrap/python/tests/ltl2tgba.py,
wrap/python/tests/parsetgba.py: Update to use bdd_dict_ptr and
make_bdd_dict().
This commit is contained in:
Alexandre Duret-Lutz 2014-08-13 16:55:25 +02:00
parent 10e5c62386
commit dc5ad78b3e
93 changed files with 199 additions and 245 deletions

View file

@ -215,7 +215,7 @@ namespace spot
tgba_digraph*
susp_prod(tgba* left, const ltl::formula* f, bdd v)
{
bdd_dict* dict = left->get_dict();
bdd_dict_ptr dict = left->get_dict();
const tgba_digraph* a1 = ltl_to_tgba_fm(f, dict, true, true);
const tgba_digraph* a2 = scc_filter(a1, false);
@ -350,7 +350,7 @@ namespace spot
tgba_digraph*
compsusp(const ltl::formula* f, bdd_dict* dict,
compsusp(const ltl::formula* f, bdd_dict_ptr dict,
bool no_wdba, bool no_simulation,
bool early_susp, bool no_susp_product, bool wdba_smaller,
bool oblig)

View file

@ -51,7 +51,7 @@ namespace spot
/// long-term stability should better use the services of the
/// spot::translator class instead.
SPOT_API tgba_digraph*
compsusp(const ltl::formula* f, bdd_dict* dict,
compsusp(const ltl::formula* f, bdd_dict_ptr dict,
bool no_wdba = false, bool no_simulation = false,
bool early_susp = false, bool no_susp_product = false,
bool wdba_smaller = false, bool oblig = false);

View file

@ -208,7 +208,7 @@ namespace spot
}
void
print(int scc, const bdd_dict* dict)
print(int scc, const bdd_dict_ptr dict)
{
std::vector<bdd>::iterator i;
std::cout << "Order_" << scc << ":\t";
@ -241,7 +241,7 @@ namespace spot
}
void
print(const bdd_dict* dict)
print(const bdd_dict_ptr dict)
{
std::map<int, acc_order>::iterator i;
for (i = orders_.begin(); i != orders_.end(); i++)
@ -256,7 +256,7 @@ namespace spot
{
bool use_scc = use_lvl_cache || use_cust_acc_orders || use_z_lvl;
bdd_dict* dict = a->get_dict();
bdd_dict_ptr dict = a->get_dict();
// The result automaton is an SBA.
auto res = new tgba_digraph(dict);

View file

@ -53,7 +53,7 @@ namespace spot
{
namespace
{
static bdd_dict* debug_dict = 0;
static bdd_dict_ptr debug_dict;
struct transition
{

View file

@ -56,7 +56,7 @@ namespace spot
{
namespace
{
static bdd_dict* debug_dict = 0;
static bdd_dict_ptr debug_dict = 0;
struct transition
{
@ -303,7 +303,7 @@ namespace spot
{
d.nvars = 0;
bdd_dict* bd = aut->get_dict();
bdd_dict_ptr bd = aut->get_dict();
ltl::default_environment& env = ltl::default_environment::instance();
d.cand_acc.resize(d.cand_nacc);

View file

@ -80,7 +80,7 @@ namespace spot
const tgba* a,
const tgba_run* run)
{
bdd_dict* d = a->get_dict();
bdd_dict_ptr d = a->get_dict();
os << "Prefix:" << std::endl;
for (tgba_run::steps::const_iterator i = run->prefix.begin();
i != run->prefix.end(); ++i)

View file

@ -173,7 +173,7 @@ namespace spot
const tgba_digraph*
lbtt_read_tgba(unsigned num_states, unsigned num_acc,
std::istream& is, std::string& error,
bdd_dict* dict,
bdd_dict_ptr dict,
ltl::environment& env, ltl::environment& envacc)
{
auto aut = std::unique_ptr<tgba_digraph>(new tgba_digraph(dict));
@ -238,7 +238,7 @@ namespace spot
const tgba_digraph*
lbtt_read_gba(unsigned num_states, unsigned num_acc,
std::istream& is, std::string& error,
bdd_dict* dict,
bdd_dict_ptr dict,
ltl::environment& env, ltl::environment& envacc)
{
auto aut = std::unique_ptr<tgba_digraph>(new tgba_digraph(dict));
@ -314,7 +314,7 @@ namespace spot
const tgba_digraph*
lbtt_parse(std::istream& is, std::string& error, bdd_dict* dict,
lbtt_parse(std::istream& is, std::string& error, bdd_dict_ptr dict,
ltl::environment& env, ltl::environment& envacc)
{
is >> std::skipws;

View file

@ -53,7 +53,7 @@ namespace spot
/// \return the read tgba or 0 on error.
SPOT_API const tgba_digraph*
lbtt_parse(std::istream& is, std::string& error,
bdd_dict* dict,
bdd_dict_ptr dict,
ltl::environment& env = ltl::default_environment::instance(),
ltl::environment& envacc = ltl::default_environment::instance());
}

View file

@ -418,7 +418,7 @@ namespace spot
} // anonymous
taa_tgba*
ltl_to_taa(const ltl::formula* f, bdd_dict* dict, bool refined_rules)
ltl_to_taa(const ltl::formula* f, bdd_dict_ptr dict, bool refined_rules)
{
// TODO: s/unabbreviate_ltl/unabbreviate_logic/
const ltl::formula* f1 = ltl::unabbreviate_ltl(f);
@ -426,9 +426,9 @@ namespace spot
f1->destroy();
spot::taa_tgba_formula* res = new spot::taa_tgba_formula(dict);
bdd_dict b;
language_containment_checker* lcc =
new language_containment_checker(&b, false, false, false, false);
new language_containment_checker(make_bdd_dict(),
false, false, false, false);
ltl2taa_visitor v(res, lcc, refined_rules);
f2->accept(v);
taa_tgba* taa = v.result(); // Careful: before the destroy!

View file

@ -49,7 +49,7 @@ namespace spot
/// \param refined_rules If this parameter is set, refined rules are used.
/// \return A spot::taa that recognizes the language of \a f.
SPOT_API taa_tgba*
ltl_to_taa(const ltl::formula* f, bdd_dict* dict,
ltl_to_taa(const ltl::formula* f, bdd_dict_ptr dict,
bool refined_rules = false);
}

View file

@ -141,7 +141,7 @@ namespace spot
{
public:
translate_dict(bdd_dict* dict, ltl_simplifier* ls, bool exprop,
translate_dict(bdd_dict_ptr dict, ltl_simplifier* ls, bool exprop,
bool single_acc)
: dict(dict),
ls(ls),
@ -167,7 +167,7 @@ namespace spot
j++->first.f->destroy();
}
bdd_dict* dict;
bdd_dict_ptr dict;
ltl_simplifier* ls;
mark_tools mt;
@ -2029,7 +2029,7 @@ namespace spot
tgba_digraph*
ltl_to_tgba_fm(const formula* f, bdd_dict* dict,
ltl_to_tgba_fm(const formula* f, bdd_dict_ptr dict,
bool exprop, bool symb_merge, bool branching_postponement,
bool fair_loop_approx, const atomic_prop_set* unobs,
ltl_simplifier* simplifier)

View file

@ -123,7 +123,7 @@ namespace spot
///
/// \return A spot::tgba_digraph that recognizes the language of \a f.
SPOT_API tgba_digraph*
ltl_to_tgba_fm(const ltl::formula* f, bdd_dict* dict,
ltl_to_tgba_fm(const ltl::formula* f, bdd_dict_ptr dict,
bool exprop = false, bool symb_merge = true,
bool branching_postponement = false,
bool fair_loop_approx = false,

View file

@ -82,7 +82,7 @@ namespace spot
tgba*
random_graph(int n, float d,
const ltl::atomic_prop_set* ap, bdd_dict* dict,
const ltl::atomic_prop_set* ap, bdd_dict_ptr dict,
int n_acc, float a, float t,
ltl::environment* env)
{

View file

@ -1,6 +1,6 @@
// -*- coding: utf-8 -*-
// Copyright (C) 2011, 2013 Laboratoire de Recherche et Developpement de
// l'Epita (LRDE).
// Copyright (C) 2011, 2013, 2014 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
// Copyright (C) 2004, 2005 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie.
@ -25,10 +25,10 @@
#include "ltlvisit/apcollect.hh"
#include "ltlenv/defaultenv.hh"
#include "tgba/bdddict.hh"
namespace spot
{
class bdd_dict;
class tgba;
/// \ingroup tgba_misc
@ -80,7 +80,7 @@ namespace spot
/// successors one by one.)
SPOT_API tgba*
random_graph(int n, float d,
const ltl::atomic_prop_set* ap, bdd_dict* dict,
const ltl::atomic_prop_set* ap, bdd_dict_ptr dict,
int n_acc = 0, float a = 0.1, float t = 0.5,
ltl::environment* env = &ltl::default_environment::instance());
}

View file

@ -50,7 +50,7 @@ namespace spot
void
process_state(const state* s, int, tgba_succ_iterator* si)
{
const bdd_dict* d = aut_->get_dict();
const bdd_dict_ptr d = aut_->get_dict();
std::string cur = escape_str(aut_->format_state(s));
if (si->first())
do
@ -73,7 +73,7 @@ namespace spot
std::ostream&
print_acc(bdd acc)
{
const bdd_dict* d = aut_->get_dict();
const bdd_dict_ptr d = aut_->get_dict();
while (acc != bddfalse)
{
bdd cube = bdd_satone(acc);

View file

@ -41,7 +41,7 @@ namespace spot
}
}
void translator::build_simplifier(bdd_dict* dict)
void translator::build_simplifier(bdd_dict_ptr dict)
{
ltl::ltl_simplifier_options options(false, false, false);
switch (level_)

View file

@ -55,7 +55,7 @@ namespace spot
setup_opt(opt);
}
translator(bdd_dict* dict, const option_map* opt = 0)
translator(bdd_dict_ptr dict, const option_map* opt = 0)
: postprocessor(opt)
{
build_simplifier(dict);
@ -65,7 +65,7 @@ namespace spot
translator(const option_map* opt = 0)
: postprocessor(opt)
{
build_simplifier(0);
build_simplifier(make_bdd_dict());
setup_opt(opt);
}
@ -114,7 +114,7 @@ namespace spot
protected:
void setup_opt(const option_map* opt);
void build_simplifier(bdd_dict* dict);
void build_simplifier(bdd_dict_ptr dict);
private:
ltl::ltl_simplifier* simpl_;

View file

@ -84,7 +84,7 @@ namespace spot
}
std::ostream&
tgba_word::print(std::ostream& os, bdd_dict* d) const
tgba_word::print(std::ostream& os, bdd_dict_ptr d) const
{
if (!prefix.empty())
for (seq_t::const_iterator i = prefix.begin(); i != prefix.end(); ++i)

View file

@ -31,7 +31,7 @@ namespace spot
{
tgba_word(const tgba_run* run);
void simplify();
std::ostream& print(std::ostream& os, bdd_dict* d) const;
std::ostream& print(std::ostream& os, bdd_dict_ptr d) const;
typedef std::list<bdd> seq_t;
seq_t prefix;