17 #ifndef VCSN_AUTOMATA_IMPLEMENTATION_LISTG_GRAPH_IMPL_HH
18 # define VCSN_AUTOMATA_IMPLEMENTATION_LISTG_GRAPH_IMPL_HH
25 # include <vaucanson/misc/usual_macros.hh>
28 # include <vaucanson/algebra/implementation/series/rat/exp.hh>
29 # include <vaucanson/automata/concept/automata_base.hh>
30 # include <vaucanson/automata/concept/automata.hh>
31 # include <vaucanson/automata/concept/transducer_base.hh>
32 # include <vaucanson/automata/concept/automata_kind.hh>
33 # include <vaucanson/automata/concept/tags.hh>
34 # include <vaucanson/automata/implementation/kind_adapter.hh>
35 # include <vaucanson/automata/implementation/geometry.hh>
36 # include <vaucanson/automata/implementation/listg/iterator.hh>
37 # include <vaucanson/automata/implementation/listg/listg_handlers.hh>
45 template <
class K,
class WordValue,
class WeightValue,
46 class SeriesValue,
class Letter,
class Tag,
class GeometryCoords>
51 typedef Graph<K, WordValue, WeightValue, SeriesValue,
54 typedef WeightValue semiring_elt_value_t;
55 typedef WordValue monoid_elt_value_t;
56 typedef WordValue word_value_t;
57 typedef SeriesValue series_set_elt_value_t;
58 typedef Letter letter_t;
62 typedef typename LabelOf<K, WordValue, WeightValue, SeriesValue, Letter>
64 typedef unsigned hstate_value_t;
65 typedef unsigned hedge_value_t;
66 typedef handler<state_h, hstate_value_t> hstate_t;
67 typedef handler<transition_h, hedge_value_t> htransition_t;
68 typedef htransition_t hedge_t;
71 template<
typename EdgeLabel>
74 inline edge_value(
const hstate_t& h1,
const hstate_t& h2,
75 const EdgeLabel& l = EdgeLabel())
81 inline operator const EdgeLabel& ()
const
84 inline operator EdgeLabel& ()
95 typedef std::set<hedge_t> edges_t;
112 typedef std::vector<state_value_t> state_data_t;
113 typedef std::vector<edge_value_t> edge_data_t;
118 typedef std::map<hstate_t, series_set_elt_value_t>
120 typedef std::map<hstate_t, series_set_elt_value_t>
123 typedef misc::Support<initial_t> initial_support_t;
124 typedef misc::Support<final_t> final_support_t;
126 typedef ::vcsn::listg::DeltaConstIterator<self_t, ::vcsn::listg::forward_iterator>
129 typedef ::vcsn::listg::DeltaConstIterator<self_t, ::vcsn::listg::backward_iterator>
134 Graph(
unsigned initial_number_of_state,
135 unsigned number_of_edge_initially_allocated);
144 initial_support_t
initial()
const;
145 final_support_t
final()
const;
174 const series_set_elt_value_t& v,
175 const series_set_elt_value_t& z);
176 const series_set_elt_value_t&
178 const series_set_elt_value_t&)
const;
180 const series_set_elt_value_t&)
const;
191 const series_set_elt_value_t&,
192 const series_set_elt_value_t&);
193 const series_set_elt_value_t&
195 const series_set_elt_value_t&)
const;
197 const series_set_elt_value_t&)
const;
205 bool has_edge(
const hedge_t& n)
const;
207 hedge_t add_edge(
const hstate_t& h1,
210 void del_edge(
const hedge_t& e);
212 hstate_t src_of(
const hedge_t& e1)
const;
213 hstate_t dst_of(
const hedge_t& e2)
const;
215 const label_t& label_of(
const hedge_t& n)
const;
216 void update(
const hedge_t&,
label_t);
232 const tag_t& tag()
const;
246 state_data_t states_;
248 std::set<hstate_t> removed_states_;
249 std::set<hedge_t> removed_edges_;
257 template <class S, class WordValue, class WeightValue, class SeriesValue, \
258 class Letter, class Tag, class GeometryCoords>
260 Graph<Kind, WordValue, WeightValue, SerieValue, \
261 Letter, Tag, GeometryCoords>
266 ADAPT_ADD_LETTER_TRANSITION_TO_SERIES_LABEL(
Graph<labels_are_series,
267 WordValue, WeightValue,
268 SeriesValue, Letter, Tag,
272 ADAPT_LETTER_OF_TO_SERIES_LABEL(
Graph<labels_are_series,
273 WordValue, WeightValue,
274 SeriesValue, Letter, Tag,
278 ADAPT_WORD_OF_TO_SERIES_LABEL(
Graph<labels_are_series,
279 WordValue, WeightValue,
280 SeriesValue, Letter, Tag,
284 ADAPT_WORD_OF_TO_LETTERS_LABEL(
Graph<labels_are_letters,
285 WordValue, WeightValue,
286 SeriesValue, Letter, Tag,
290 ADAPT_SERIE_OF_TO_LETTERS_LABEL(
Graph<labels_are_letters,
291 WordValue, WeightValue,
292 SeriesValue, Letter, Tag,
296 ADAPT_ADD_SERIE_TRANSITION_TO_LETTERS_LABEL(
Graph<labels_are_letters,
297 WordValue, WeightValue,
298 SeriesValue, Letter, Tag,
301 template <
class Kind,
class WordValue,
class WeightValue,
class SerieValue,
302 class Letter,
class Tag,
class GeometryCoords,
class I>
304 Graph<Kind, WordValue, WeightValue,
305 SerieValue, Letter, Tag,
308 template <
class Kind,
class WordValue,
class WeightValue,
class SerieValue,
309 class Letter,
class Tag,
class GeometryCoords,
class I>
311 const Graph<Kind, WordValue, WeightValue,
312 SerieValue, Letter, Tag, GeometryCoords>&);
314 template <
class Kind,
class WordValue,
class WeightValue,
class SerieValue,
315 class Letter,
class Tag,
class GeometryCoords,
class I>
316 typename GRAPH::geometry_t&
318 Graph<Kind, WordValue, WeightValue,
319 SerieValue, Letter, Tag, GeometryCoords>&);
321 template <
class Kind,
class WordValue,
class WeightValue,
class SerieValue,
322 class Letter,
class Tag,
class GeometryCoords,
class I>
323 const typename GRAPH::geometry_t&
325 const Graph<Kind, WordValue,
326 WeightValue, SerieValue, Letter, Tag,
341 template <
class Kind,
347 class GeometryCoords>
356 typedef WordValue input_monoid_elt_value_t;
357 typedef typename algebra::series_traits<WeightValue>::monoid_elt_value_t
358 output_monoid_elt_value_t;
359 typedef typename algebra::series_traits<WeightValue>::semiring_elt_value_t
360 output_semiring_elt_value_t;
364 template <
class Kind,
370 class GeometryCoords>
371 struct input_projection_traits<listg::Graph<Kind,
379 typedef listg::Graph<Kind, WordValue, WeightValue, SeriesValue,
380 Letter, Tag, GeometryCoords>
382 typedef typename transducer_traits<self_t>::output_semiring_elt_value_t
383 semiring_elt_value_t;
384 typedef typename transducer_traits<self_t>::input_monoid_elt_value_t
386 typedef typename algebra::mute_series_impl<SeriesValue,
387 semiring_elt_value_t,
388 monoid_elt_value_t>::ret
389 series_set_elt_value_t;
394 semiring_elt_value_t,
395 series_set_elt_value_t,
403 template <
class Kind,
409 class GeometryCoords>
410 struct fmp_input_projection_traits<listg::Graph<Kind,
418 typedef listg::Graph<Kind, WordValue, WeightValue, SeriesValue,
419 Letter, Tag, GeometryCoords>
422 typedef typename automaton_traits<self_t>::semiring_elt_value_t
423 semiring_elt_value_t;
425 typedef typename WordValue::first_type monoid_elt_value_t;
426 typedef typename monoid_elt_value_t::value_type letter_t;
428 typedef typename algebra::mute_series_impl<SeriesValue,
429 semiring_elt_value_t,
430 monoid_elt_value_t>::ret
431 series_set_elt_value_t;
436 semiring_elt_value_t,
437 series_set_elt_value_t,
444 template <
class Kind,
450 class GeometryCoords>
451 struct output_projection_traits<listg::Graph<Kind,
456 Tag, GeometryCoords> >
458 typedef listg::Graph<Kind, WordValue, WeightValue, SeriesValue,
459 Letter, Tag, GeometryCoords>
462 typedef typename automaton_traits<self_t>::semiring_elt_value_t
463 series_set_elt_value_t;
466 algebra::series_traits<series_set_elt_value_t>::monoid_elt_value_t
470 algebra::series_traits<series_set_elt_value_t>::semiring_elt_value_t
471 semiring_elt_value_t;
476 semiring_elt_value_t,
477 series_set_elt_value_t,
485 template <
class Kind,
491 class GeometryCoords>
492 struct fmp_output_projection_traits<listg::Graph<Kind,
500 typedef listg::Graph<Kind, WordValue, WeightValue, SeriesValue,
501 Letter, Tag, GeometryCoords>
504 typedef typename WordValue::second_type monoid_elt_value_t;
505 typedef typename monoid_elt_value_t::value_type letter_t;
507 typedef typename automaton_traits<self_t>::semiring_elt_value_t
508 semiring_elt_value_t;
510 typedef typename algebra::mute_series_impl<SeriesValue,
511 semiring_elt_value_t,
512 monoid_elt_value_t>::ret series_set_elt_value_t;
517 semiring_elt_value_t,
518 series_set_elt_value_t,
526 template <
class Kind,
532 class GeometryCoords>
533 struct extension_traits<listg::Graph<Kind,
541 typedef listg::Graph<Kind, WordValue, WeightValue,
542 SeriesValue, Letter, Tag, GeometryCoords>
544 typedef typename automaton_traits<self_t>::monoid_elt_value_t
546 typedef typename algebra::mute_series_impl<SeriesValue,
548 monoid_elt_value_t>::ret
549 series_set_elt_value_t;
555 series_set_elt_value_t,
564 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
565 # include <vaucanson/automata/implementation/listg_graph_impl.hxx>
566 # endif // VCSN_USE_INTERFACE_ONLY
568 #endif // ! VCSN_AUTOMATA_IMPLEMENTATION_LISTG_GRAPH_IMPL_HH