Commit 34e91b76 authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz
Browse files

c++11: replace Sgi::hash_* by Sgi::unordered_*.

* bench/scc-stats/stats.cc, bench/split-product/cutscc.cc,
iface/gspn/ssp.cc, src/bin/ltlcross.cc, src/bin/ltlfilt.cc,
src/bin/randltl.cc, src/dstarparse/nsa2tgba.cc, src/ltlast/formula.hh,
src/ltlast/nfa.hh, src/ltlvisit/contain.hh, src/ltlvisit/dotty.cc,
src/ltlvisit/mark.hh, src/ltlvisit/relabel.cc, src/ltlvisit/relabel.hh,
src/ltlvisit/simplify.cc, src/ltlvisit/snf.hh, src/misc/hash.hh,
src/misc/mspool.hh, src/priv/acccompl.hh, src/priv/accconv.hh,
src/saba/explicitstateconjunction.hh, src/saba/sabastate.hh,
src/sabaalgos/sabareachiter.hh, src/sanity/style.test,
src/ta/taexplicit.cc, src/ta/taexplicit.hh, src/taalgos/emptinessta.cc,
src/taalgos/minimize.cc, src/taalgos/reachiter.hh, src/tgba/state.hh,
src/tgba/taatgba.hh, src/tgba/tgbabddconcretefactory.hh,
src/tgba/tgbaexplicit.hh, src/tgba/tgbakvcomplement.cc,
src/tgba/tgbasafracomplement.cc, src/tgba/tgbatba.cc,
src/tgba/tgbatba.hh, src/tgbaalgos/cutscc.cc, src/tgbaalgos/cycles.hh,
src/tgbaalgos/degen.cc, src/tgbaalgos/dtbasat.cc,
src/tgbaalgos/dtgbasat.cc, src/tgbaalgos/eltl2tgba_lacim.cc,
src/tgbaalgos/emptiness.cc, src/tgbaalgos/gtec/explscc.hh,
src/tgbaalgos/gtec/nsheap.hh, src/tgbaalgos/gv04.cc,
src/tgbaalgos/ltl2tgba_fm.cc, src/tgbaalgos/magic.cc,
src/tgbaalgos/minimize.cc, src/tgbaalgos/ndfs_result.hxx,
src/tgbaalgos/powerset.hh, src/tgbaalgos/randomgraph.cc,
src/tgbaalgos/reachiter.hh, src/tgbaalgos/replayrun.cc,
src/tgbaalgos/safety.cc, src/tgbaalgos/scc.hh, src/tgbaalgos/se05.cc,
src/tgbaalgos/simulation.cc, src/tgbaalgos/tau03.cc,
src/tgbaalgos/tau03opt.cc: Adjust code.
* src/sanity/style.test: Remove check.
parent c568b4d3
......@@ -66,9 +66,9 @@ namespace spot
/// The class becomes owner of \a state.
void add(saba_state* state);
private:
typedef Sgi::hash_set<shared_saba_state,
spot::saba_state_shared_ptr_hash,
spot::saba_state_shared_ptr_equal> saba_state_set_t;
typedef std::unordered_set<shared_saba_state,
saba_state_shared_ptr_hash,
saba_state_shared_ptr_equal> saba_state_set_t;
saba_state_set_t set_;
saba_state_set_t::iterator it_;
};
......
......@@ -52,9 +52,10 @@ namespace spot
///
/// Note that the hash value is guaranteed to be unique for all
/// equal states (in compare()'s sense) for only has long has one
/// of these states exists. So it's OK to use a spot::saba_state as a
/// key in a \c hash_map because the mere use of the state as a
/// key in the hash will ensure the state continues to exist.
/// of these states exists. So it's OK to use a spot::saba_state
/// as a key in an \c unordered_map because the mere use of the
/// state as a key in the hash will ensure the state continues to
/// exist.
///
/// However if you create the state, get its hash key, delete the
/// state, recreate the same state, and get its hash key, you may
......@@ -63,7 +64,7 @@ namespace spot
/// occur only when the state is BDD-encoded, because BDD numbers
/// (used to build the hash value) can be reused for other
/// formulas. That probably doesn't matter, since the hash value
/// is meant to be used in a \c hash_map, but it had to be noted.
/// is meant to be used in an \c unordered_map, but it had to be noted.
virtual size_t hash() const = 0;
/// Duplicate a state.
......@@ -107,13 +108,13 @@ namespace spot
/// \brief An Equivalence Relation for \c saba_state*.
///
/// This is meant to be used as a comparison functor for
/// Sgi \c hash_map whose key are of type \c saba_state*.
/// \c unordered_map whose keys are of type \c saba_state*.
///
/// For instance here is how one could declare
/// a map of \c saba_state*.
/// \code
/// // Remember how many times each state has been visited.
/// Sgi::hash_map<spot::saba_state*, int, spot::saba_state_ptr_hash,
/// std::unordered_map<spot::saba_state*, int, spot::saba_state_ptr_hash,
/// spot::saba_state_ptr_equal> seen;
/// \endcode
struct saba_state_ptr_equal:
......@@ -132,13 +133,13 @@ namespace spot
/// \brief Hash Function for \c saba_state*.
///
/// This is meant to be used as a hash functor for
/// Sgi's \c hash_map whose key are of type \c saba_state*.
/// an \c unordered_map whose keys are of type \c saba_state*.
///
/// For instance here is how one could declare
/// a map of \c saba_state*.
/// \code
/// // Remember how many times each state has been visited.
/// Sgi::hash_map<spot::saba_state*, int, spot::saba_state_ptr_hash,
/// std::unordered_map<spot::saba_state*, int, spot::saba_state_ptr_hash,
/// spot::saba_state_ptr_equal> seen;
/// \endcode
struct saba_state_ptr_hash:
......@@ -162,7 +163,7 @@ namespace spot
/// (shared_ptr<const saba_state*>).
///
/// This is meant to be used as a comparison functor for
/// STL \c map whose key are of type \c shared_saba_state.
/// STL \c map whose keys are of type \c shared_saba_state.
///
/// For instance here is how one could declare
/// a map of \c shared_saba_state.
......@@ -189,15 +190,15 @@ namespace spot
/// (shared_ptr<const saba_state*>).
///
/// This is meant to be used as a comparison functor for
/// Sgi \c hash_map whose key are of type \c shared_saba_state.
/// an \c unordred_map whose keys are of type \c shared_saba_state.
///
/// For instance here is how one could declare
/// a map of \c shared_saba_state
/// \code
/// // Remember how many times each state has been visited.
/// Sgi::hash_map<shared_saba_state, int,
/// spot::saba_state_shared_ptr_hash,
/// spot::saba_state_shared_ptr_equal> seen;
/// std::unordered_map<shared_saba_state, int,
/// saba_state_shared_ptr_hash,
/// saba_state_shared_ptr_equal> seen;
/// \endcode
struct saba_state_shared_ptr_equal:
public std::binary_function<shared_saba_state,
......@@ -218,16 +219,16 @@ namespace spot
/// (shared_ptr<const saba_state*>).
///
/// This is meant to be used as a hash functor for
/// Sgi's \c hash_map whose key are of type
/// \c unordered_map whose key are of type
/// \c shared_saba_state.
///
/// For instance here is how one could declare
/// a map of \c shared_saba_state.
/// \code
/// // Remember how many times each state has been visited.
/// Sgi::hash_map<shared_saba_state, int,
/// spot::saba_state_shared_ptr_hash,
/// spot::saba_state_shared_ptr_equal> seen;
/// std::unordered_map<shared_saba_state, int,
/// saba_state_shared_ptr_hash,
/// saba_state_shared_ptr_equal> seen;
/// \endcode
struct saba_state_shared_ptr_hash:
public std::unary_function<shared_saba_state, size_t>
......
......@@ -108,8 +108,9 @@ namespace spot
protected:
const saba* automata_; ///< The spot::saba to explore.
typedef Sgi::hash_map<const saba_state*, int,
saba_state_ptr_hash, saba_state_ptr_equal> seen_map;
typedef
std::unordered_map<const saba_state*, int,
saba_state_ptr_hash, saba_state_ptr_equal> seen_map;
seen_map seen; ///< States already seen.
};
......
......@@ -238,12 +238,6 @@ for dir in "${INCDIR-..}" "${INCDIR-..}"/../iface; do
grep '[^a-zA-Z0-9_](\*[a-zA-Z0-9_]*)\.' $tmp &&
diag 'Use "x->y", not "(*x).y"'
grep 'std::hash' $tmp &&
diag 'use Sgi:: for hash and hash_map'
grep 'Sgi::[^h]' $tmp &&
diag 'Sgi:: is for hash and hash_map only'
egrep 'bdd_(false|true)[ ]*\(' $tmp &&
diag 'Use bddfalse and bddtrue instead of bdd_false() and bdd_true()'
......
......@@ -116,7 +116,7 @@ namespace spot
state_ta_explicit::get_transitions(bdd condition) const
{
Sgi::hash_map<int, transitions*, Sgi::hash<int> >::const_iterator i =
std::unordered_map<int, transitions*, std::hash<int> >::const_iterator i =
transitions_by_condition.find(condition.id());
if (i == transitions_by_condition.end())
......@@ -334,8 +334,8 @@ namespace spot
}
delete trans;
Sgi::hash_map<int, transitions*, Sgi::hash<int> >::iterator i =
transitions_by_condition.begin();
std::unordered_map<int, transitions*, std::hash<int> >::iterator i =
transitions_by_condition.begin();
while (i != transitions_by_condition.end())
{
delete i->second;
......
......@@ -236,7 +236,8 @@ namespace spot
bool is_accepting_state_;
bool is_livelock_accepting_state_;
transitions* transitions_;
Sgi::hash_map<int, transitions*, Sgi::hash<int> > transitions_by_condition;
std::unordered_map<int, transitions*, std::hash<int>>
transitions_by_condition;
#endif // !SWIG
};
......
// -*- coding: utf-8 -*-
// Copyright (C) 2010, 2011, 2012 Laboratoire de Recherche et
// Copyright (C) 2010, 2011, 2012, 2013 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
......@@ -72,14 +72,15 @@ namespace spot
// it is also used as a key in H.
std::stack<pair_state_iter> todo;
Sgi::hash_map<const state*, std::string, state_ptr_hash, state_ptr_equal>
colour;
std::unordered_map<const state*, std::string,
state_ptr_hash, state_ptr_equal> colour;
trace
<< "PASS 1" << std::endl;
Sgi::hash_map<const state*, std::set<const state*, state_ptr_less_than>,
state_ptr_hash, state_ptr_equal> liveset;
std::unordered_map<const state*,
std::set<const state*, state_ptr_less_than>,
state_ptr_hash, state_ptr_equal> liveset;
std::stack<spot::state*> livelock_roots;
......
......@@ -40,9 +40,10 @@
namespace spot
{
typedef Sgi::hash_set<const state*, state_ptr_hash, state_ptr_equal> hash_set;
typedef Sgi::hash_map<const state*, unsigned, state_ptr_hash, state_ptr_equal>
hash_map;
typedef std::unordered_set<const state*,
state_ptr_hash, state_ptr_equal> hash_set;
typedef std::unordered_map<const state*, unsigned,
state_ptr_hash, state_ptr_equal> hash_map;
typedef std::list<hash_set*> partition_t;
namespace
......
......@@ -89,8 +89,8 @@ namespace spot
const ta* t_automata_; ///< The spot::ta to explore.
typedef Sgi::hash_map<const state*, int, state_ptr_hash, state_ptr_equal>
seen_map;
typedef std::unordered_map<const state*, int,
state_ptr_hash, state_ptr_equal> seen_map;
seen_map seen; ///< States already seen.
};
......
......@@ -127,13 +127,13 @@ namespace spot
/// \brief An Equivalence Relation for \c state*.
///
/// This is meant to be used as a comparison functor for
/// Sgi \c hash_map whose key are of type \c state*.
/// an \c unordered_map whose key are of type \c state*.
///
/// For instance here is how one could declare
/// a map of \c state*.
/// \code
/// // Remember how many times each state has been visited.
/// Sgi::hash_map<spot::state*, int, spot::state_ptr_hash,
/// std::unordered_map<spot::state*, int, spot::state_ptr_hash,
/// spot::state_ptr_equal> seen;
/// \endcode
struct state_ptr_equal:
......@@ -152,13 +152,13 @@ namespace spot
/// \brief Hash Function for \c state*.
///
/// This is meant to be used as a hash functor for
/// Sgi's \c hash_map whose key are of type \c state*.
/// an \c unordered_map whose key are of type \c state*.
///
/// For instance here is how one could declare
/// a map of \c state*.
/// \code
/// // Remember how many times each state has been visited.
/// Sgi::hash_map<spot::state*, int, spot::state_ptr_hash,
/// std::unordered_map<spot::state*, int, spot::state_ptr_hash,
/// spot::state_ptr_equal> seen;
/// \endcode
struct state_ptr_hash:
......@@ -172,9 +172,8 @@ namespace spot
}
};
typedef Sgi::hash_set<const state*,
spot::state_ptr_hash,
spot::state_ptr_equal> state_set;
typedef std::unordered_set<const state*,
state_ptr_hash, state_ptr_equal> state_set;
// Functions related to shared_ptr.
......@@ -215,15 +214,15 @@ namespace spot
/// (shared_ptr<const state*>).
///
/// This is meant to be used as a comparison functor for
/// Sgi \c hash_map whose key are of type \c shared_state.
/// un \c unordered_map whose key are of type \c shared_state.
///
/// For instance here is how one could declare
/// a map of \c shared_state
/// \code
/// // Remember how many times each state has been visited.
/// Sgi::hash_map<shared_state, int,
/// spot::state_shared_ptr_hash,
/// spot::state_shared_ptr_equal> seen;
/// std::unordered_map<shared_state, int,
/// state_shared_ptr_hash,
/// state_shared_ptr_equal> seen;
/// \endcode
struct state_shared_ptr_equal:
public std::binary_function<shared_state,
......@@ -243,16 +242,16 @@ namespace spot
/// \brief Hash Function for \c shared_state (shared_ptr<const state*>).
///
/// This is meant to be used as a hash functor for
/// Sgi's \c hash_map whose key are of type
/// an \c unordered_map whose key are of type
/// \c shared_state.
///
/// For instance here is how one could declare
/// a map of \c shared_state.
/// \code
/// // Remember how many times each state has been visited.
/// Sgi::hash_map<shared_state, int,
/// spot::state_shared_ptr_hash,
/// spot::state_shared_ptr_equal> seen;
/// std::unordered_map<shared_state, int,
/// state_shared_ptr_hash,
/// state_shared_ptr_equal> seen;
/// \endcode
struct state_shared_ptr_hash:
public std::unary_function<shared_state, size_t>
......@@ -265,9 +264,9 @@ namespace spot
}
};
typedef Sgi::hash_set<shared_state,
state_shared_ptr_hash,
state_shared_ptr_equal> shared_state_set;
typedef std::unordered_set<shared_state,
state_shared_ptr_hash,
state_shared_ptr_equal> shared_state_set;
}
......
......@@ -127,9 +127,9 @@ namespace spot
typedef taa_tgba::state::const_iterator iterator;
typedef std::pair<iterator, iterator> iterator_pair;
typedef std::vector<iterator_pair> bounds_t;
typedef Sgi::hash_map<
const spot::set_state*, std::vector<taa_tgba::transition*>,
state_ptr_hash, state_ptr_equal> seen_map;
typedef std::unordered_map<const spot::set_state*,
std::vector<taa_tgba::transition*>,
state_ptr_hash, state_ptr_equal> seen_map;
struct distance_sort :
public std::binary_function<const iterator_pair&,
......@@ -252,12 +252,10 @@ namespace spot
protected:
typedef label label_t;
typedef Sgi::hash_map<
const label, taa_tgba::state*, label_hash
> ns_map;
typedef Sgi::hash_map<
const taa_tgba::state*, label, ptr_hash<taa_tgba::state>
> sn_map;
typedef std::unordered_map<const label, taa_tgba::state*,
label_hash> ns_map;
typedef std::unordered_map<const taa_tgba::state*, label,
ptr_hash<taa_tgba::state>> sn_map;
ns_map name_state_map_;
sn_map state_name_map_;
......
......@@ -93,8 +93,8 @@ namespace spot
private:
tgba_bdd_core_data data_; ///< Core data for the new automata.
typedef Sgi::hash_map<const ltl::formula*, bdd,
ltl::formula_ptr_hash> acc_map_;
typedef std::unordered_map<const ltl::formula*, bdd,
ltl::formula_ptr_hash> acc_map_;
acc_map_ acc_; ///< BDD associated to each acceptance condition
};
......
......@@ -261,9 +261,9 @@ namespace spot
typedef typename State::transition transition;
typedef State state;
protected:
typedef Sgi::hash_map<label_t, State, label_hash_t> ls_map;
typedef Sgi::hash_map<label_t, State*, label_hash_t> alias_map;
typedef Sgi::hash_map<const State*, label_t, ptr_hash<State> > sl_map;
typedef std::unordered_map<label_t, State, label_hash_t> ls_map;
typedef std::unordered_map<label_t, State*, label_hash_t> alias_map;
typedef std::unordered_map<const State*, label_t, ptr_hash<State> > sl_map;
public:
......@@ -397,8 +397,8 @@ namespace spot
{
typedef typename transitions_t::iterator trans_t;
typedef std::map<int, trans_t> acc_map;
typedef Sgi::hash_map<const spot::state*, acc_map,
ptr_hash<spot::state> > dest_map;
typedef std::unordered_map<const spot::state*, acc_map,
ptr_hash<spot::state> > dest_map;
typename ls_map::iterator i;
for (i = ls_.begin(); i != ls_.end(); ++i)
......
......@@ -88,9 +88,9 @@ namespace spot
};
// typedefs.
typedef Sgi::hash_map<shared_state, rank_t,
state_shared_ptr_hash,
state_shared_ptr_equal> state_rank_map;
typedef std::unordered_map<shared_state, rank_t,
state_shared_ptr_hash,
state_shared_ptr_equal> state_rank_map;
////////////////////////////////////////
// state_kv_complement
......
......@@ -763,8 +763,8 @@ namespace spot
//////////////////////////////
namespace test
{
typedef Sgi::hash_map<const state*, int,
state_ptr_hash, state_ptr_equal> stnum_t;
typedef std::unordered_map<const state*, int,
state_ptr_hash, state_ptr_equal> stnum_t;
void print_safra_tree(const safra_tree* this_node,
stnum_t& node_names,
......
......@@ -44,7 +44,7 @@ namespace spot
}
// Note: There is a default copy constructor, needed by
// Sgi::hash_set. It does not clone the state "s", because the
// std::unordered_set. It does not clone the state "s", because the
// destructor will not destroy it either. Actually, the states
// are all destroyed in the tgba_tba_proxy destructor.
......@@ -127,9 +127,9 @@ namespace spot
}
};
typedef Sgi::hash_set<state_tba_proxy,
state_tba_proxy_hash,
state_tba_proxy_equal> uniq_map_t;
typedef std::unordered_set<state_tba_proxy,
state_tba_proxy_hash,
state_tba_proxy_equal> uniq_map_t;
typedef std::pair<const state_tba_proxy*, bool> state_ptr_bool_t;
......@@ -382,9 +382,9 @@ namespace spot
protected:
const bdd the_acceptance_cond_;
typedef Sgi::hash_map<state_ptr_bool_t, bdd,
state_ptr_bool_hash,
state_ptr_bool_equal> transmap_t;
typedef std::unordered_map<state_ptr_bool_t, bdd,
state_ptr_bool_hash,
state_ptr_bool_equal> transmap_t;
transmap_t transmap_;
typedef transmap_t::const_iterator mapit_t;
typedef std::list<mapit_t> translist_t;
......
......@@ -111,8 +111,8 @@ namespace spot
private:
bdd the_acceptance_cond_;
typedef Sgi::hash_map<const state*, bdd,
state_ptr_hash, state_ptr_equal> accmap_t;
typedef std::unordered_map<const state*, bdd,
state_ptr_hash, state_ptr_equal> accmap_t;
mutable accmap_t accmap_;
mutable accmap_t accmapu_;
......
......@@ -35,8 +35,8 @@ namespace spot
tgba_explicit_string* sub_a = new tgba_explicit_string(a->get_dict());
state* cur = a->get_init_state();
std::queue<state*> tovisit;
typedef Sgi::hash_set<const state*,
state_ptr_hash, state_ptr_equal> hash_type;
typedef std::unordered_set<const state*,
state_ptr_hash, state_ptr_equal> hash_type;
// Setup
hash_type seen;
unsigned scc_number;
......
......@@ -79,8 +79,8 @@ namespace spot
class SPOT_API enumerate_cycles
{
protected:
typedef Sgi::hash_set<const state*,
state_ptr_hash, state_ptr_equal> set_type;
typedef std::unordered_set<const state*,
state_ptr_hash, state_ptr_equal> set_type;
// Extra information required for the algorithm for each state.
struct state_info
......@@ -105,8 +105,8 @@ namespace spot
};
// Store the state_info for all visited states.
typedef Sgi::hash_map<const state*, state_info,
state_ptr_hash, state_ptr_equal> hash_type;
typedef std::unordered_map<const state*, state_info,
state_ptr_hash, state_ptr_equal> hash_type;
hash_type tags_;
// A tagged_state s is a state* (s->first) associated to its
......
......@@ -60,8 +60,8 @@ namespace spot
};
// Associate the degeneralized state to its number.
typedef Sgi::hash_map<degen_state, int,
degen_state_hash, degen_state_equal> ds2num_map;
typedef std::unordered_map<degen_state, int,
degen_state_hash, degen_state_equal> ds2num_map;
// Queue of state to be processed.
typedef std::deque<degen_state> queue_t;
......@@ -69,7 +69,7 @@ namespace spot
// Memory management for the input states.
class unicity_table
{
typedef Sgi::hash_set<const state*,
typedef std::unordered_set<const state*,
state_ptr_hash, state_ptr_equal> uniq_set;
uniq_set m;
public:
......@@ -112,8 +112,8 @@ namespace spot
{
const tgba* a_;
typedef std::pair<bdd, bdd> cache_entry;
typedef Sgi::hash_map<const state*, cache_entry,
state_ptr_hash, state_ptr_equal> cache_t;
typedef std::unordered_map<const state*, cache_entry,
state_ptr_hash, state_ptr_equal> cache_t;
cache_t cache_;
const scc_map* sm_;
......@@ -170,8 +170,8 @@ namespace spot
class has_acc_loop
{
const tgba* a_;
typedef Sgi::hash_map<const state*, bool,
state_ptr_hash, state_ptr_equal> cache_t;
typedef std::unordered_map<const state*, bool,
state_ptr_hash, state_ptr_equal> cache_t;
cache_t cache_;
unicity_table& uniq_;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment