17 #ifndef VCSN_ALGORITHMS_INTERNAL_SKELETON_HXX
18 # define VCSN_ALGORITHMS_INTERNAL_SKELETON_HXX
29 template<
typename A,
typename T>
30 Skeleton<A, T>::Skeleton(
const Element<A, T>& x) : a(x)
33 typedef Element<A, T> automaton_t;
35 AUTOMATON_TYPES(automaton_t);
38 std::list<htransition_t> out;
39 std::map<series_set_elt_t, int> Lmap;
40 std::map<hstate_t, int> Smap;
42 states.reserve(a.states().size());
44 src_transitions.reserve(a.transitions().size());
45 dst_transitions.reserve(a.transitions().size());
46 transitions_labels.reserve(a.transitions().size());
51 delta_in.assign(a.states().size(), dummy);
52 delta_out.assign(a.states().size(), dummy);
82 for_all_transitions(e, a)
85 src_transitions.push_back(Smap[a.src_of(*e)]);
86 dst_transitions.push_back(Smap[a.dst_of(*e)]);
88 if (Lmap.find(a.series_of(*e)) == Lmap.end())
89 transitions_labels.push_back(Lmap[a.series_of(*e)] = i++);
91 transitions_labels.push_back(Lmap[a.series_of(*e)]);
112 std::vector< std::list<int> > transitions_lex(i);
114 for (i = 0; i < static_cast<int>(a.transitions().size()); i++)
115 transitions_lex[transitions_labels[i]].push_front(i);
119 for (i = 0; i < static_cast<int>(transitions_lex.capacity()); i++)
120 for (std::list<int>::iterator it = transitions_lex[i].begin();
121 it != transitions_lex[i].end(); it++)
123 delta_in[dst_transitions[*it]].push_back(*it);
124 delta_out[src_transitions[*it]].push_back(*it);
129 template<
typename A,
typename T>
130 void Skeleton<A, T>::reserve_aux_states_int()
132 aux_states_int.reserve(a.states().size());
135 template<
typename A,
typename T>
136 void Skeleton<A, T>::reserve_aux_states_bool()
138 aux_states_bool.reserve(a.states().size());
141 template<
typename A,
typename T>
142 void Skeleton<A, T>::reserve_aux_states_generic()
144 aux_states_generic.reserve(a.states().size());
147 template<
typename A,
typename T>
148 void Skeleton<A, T>::reserve_aux_transitions_int()
150 aux_transitions_int.reserve(a.transitions().size());
153 template<
typename A,
typename T>
154 void Skeleton<A, T>::reserve_aux_transitions_bool()
156 aux_transitions_bool.reserve(a.transitions().size());
159 template<
typename A,
typename T>
160 void Skeleton<A, T>::reserve_aux_transitions_generic()
162 aux_transitions_generic.reserve(a.transitions().size());
167 #endif // ! VCSN_ALGORITHMS_INTERNAL_SKELETON_HXX