18 #ifndef VCSN_AUTOMATA_IMPLEMENTATION_BMIG_GRAPH_LETTERS_SPEC_HH_
19 # define VCSN_AUTOMATA_IMPLEMENTATION_BMIG_GRAPH_LETTERS_SPEC_HH_
22 # include <vaucanson/automata/implementation/bmig_graph_impl.hh>
30 template <
typename WordValue,
31 typename SeriesValue,
typename Letter,
typename Tag,
typename GeometryCoords>
32 class Graph<labels_are_letters, WordValue, bool, SeriesValue, Letter,
41 typedef Graph<labels_are_letters, WordValue, bool,
42 SeriesValue, Letter, Tag, GeometryCoords>
45 typedef bool semiring_elt_value_t;
46 typedef WordValue monoid_elt_value_t;
47 typedef WordValue word_value_t;
48 typedef SeriesValue series_set_elt_value_t;
49 typedef Letter letter_t;
52 typedef typename LabelOf<labels_are_letters, WordValue, bool,
53 SeriesValue, Letter>::ret label_t;
55 typedef boost::shared_ptr<std::size_t> state_t;
58 typedef handler<state_h, state_t> hstate_t;
60 typedef EdgeValue<state_t, label_t> edge_data_t;
62 typedef GraphContainer<state_t, label_t, edge_data_t> graph_data_t;
74 typedef typename graph_data_t::iterator edges_iterator;
75 typedef handler<transition_h, edges_iterator> htransition_t;
76 typedef htransition_t hedge_t;
78 typedef VGraphContainer<edges_iterator, graph_data_t, htransition_t> edges_t;
79 typedef std::vector<state_t> states_data_t;
80 typedef misc::Support<states_data_t> states_t;
82 typedef std::set<state_t> initial_t;
83 typedef std::set<state_t> final_t;
85 typedef misc::Support<initial_t> initial_support_t;
86 typedef misc::Support<final_t> final_support_t;
88 typedef GeometryCoords geometry_coords_t;
94 typedef typename graph_data_t::iterator iterator;
95 typedef typename graph_data_t::const_iterator const_iterator;
96 typedef iterator transition_iterator;
98 typedef typename index_iterator<graph_data_t, src>::type
100 typedef src_iterator src_const_iterator;
101 typedef typename index_iterator<graph_data_t, dst>::type
103 typedef dst_iterator dst_const_iterator;
104 typedef typename index_iterator<graph_data_t, pred>::type
106 typedef pred_iterator pred_const_iterator;
107 typedef typename index_iterator<graph_data_t, succ>::type
109 typedef succ_iterator succ_const_iterator;
110 typedef std::pair<src_iterator, src_iterator> src_range;
111 typedef std::pair<dst_iterator, dst_iterator> dst_range;
112 typedef std::pair<pred_iterator, pred_iterator> pred_range;
113 typedef std::pair<succ_iterator, succ_iterator> succ_range;
116 Graph (
unsigned int reserve_number_of_state,
117 unsigned int reserve_number_edge);
118 Graph (
const self_t&);
121 self_t& operator= (
const self_t&);
125 states_t states ()
const;
126 edges_t edges ()
const;
127 initial_support_t initial ()
const;
128 final_support_t
final ()
const;
131 bool has_state (
const hstate_t& h)
const;
132 hstate_t add_state ();
133 hstate_t get_state (
unsigned h)
const;
134 void del_state (
const hstate_t& h);
136 void set_initial(
const hstate_t& s,
137 const series_set_elt_value_t& v,
138 const series_set_elt_value_t& z);
139 const series_set_elt_value_t&
140 get_initial(
const hstate_t&,
141 const series_set_elt_value_t&)
const;
142 bool is_initial(
const hstate_t& s,
143 const series_set_elt_value_t&)
const;
144 void clear_initial();
146 void set_final(
const hstate_t&,
147 const series_set_elt_value_t&,
148 const series_set_elt_value_t&);
149 const series_set_elt_value_t&
150 get_final(
const hstate_t&,
151 const series_set_elt_value_t&)
const;
152 bool is_final(
const hstate_t& s,
153 const series_set_elt_value_t&)
const;
158 bool has_edge (
const hedge_t& h)
const;
159 hedge_t add_edge (
const hstate_t& from,
162 void del_edge (
const hedge_t& h);
164 hstate_t src_of (
const hedge_t& h)
const;
165 hstate_t dst_of (
const hedge_t& h)
const;
167 const label_t& label_of (
const hedge_t& h)
const;
168 void update(
const hedge_t& h,
const label_t& l);
172 bool exists (
const AutomataBase<S>& s)
const;
174 self_t& clone ()
const;
177 const tag_t& tag ()
const;
178 geometry_t& geometry ();
179 const geometry_t& geometry ()
const;
183 # define DECLARE_DELTA_FUNCTION(FunName, DeltaKind) \
184 template <typename OutputIterator, typename Query> \
185 void FunName (OutputIterator res, const hstate_t& from, \
186 const Query& q, ::vcsn::delta_kind::DeltaKind) const
187 DECLARE_DELTA_FUNCTION (delta, states);
188 DECLARE_DELTA_FUNCTION (delta, transitions);
189 DECLARE_DELTA_FUNCTION (rdelta, states);
190 DECLARE_DELTA_FUNCTION (rdelta, transitions);
191 # undef DECLARE_DELTA_FUNCTION
195 typename graph_data_t::const_iterator
196 find_edge(
const state_t&,
198 const label_t&)
const;
200 geometry_t geometry_;
207 boost::dynamic_bitset<> initial_bitset_;
208 boost::dynamic_bitset<> final_bitset_;
209 unsigned number_of_epsilon_;
212 unsigned number_of_state_;
213 states_data_t states_;
218 # define BMIGRAPH_TPARAM \
219 template <class S, class WordValue, class SeriesValue, \
220 class Letter, class Tag, class GeometryCoords>
222 # define BMIGRAPH_LETTERS \
223 Graph<labels_are_letters, WordValue, bool, SeriesValue, \
224 Letter, Tag, GeometryCoords>
227 ADAPT_WORD_OF_TO_LETTERS_LABEL(BMIGRAPH_LETTERS);
230 ADAPT_SERIE_OF_TO_LETTERS_LABEL(BMIGRAPH_LETTERS);
233 ADAPT_ADD_SERIE_TRANSITION_TO_LETTERS_LABEL(BMIGRAPH_LETTERS);
236 Graph<labels_are_letters, WordValue, bool, SerieValue, \
237 Letter, Tag, GeometryCoords>
239 template <
class WordValue,
class SerieValue,
240 class Letter,
class Tag,
class GeometryCoords,
class I>
241 Tag& op_tag(
const AutomataBase<I>&, BMIGRAPH&);
243 template <
class WordValue,
class SerieValue,
244 class Letter,
class Tag,
class GeometryCoords,
class I>
245 const Tag& op_tag(
const AutomataBase<I>&, BMIGRAPH&);
247 template <
class WordValue,
class SerieValue,
248 class Letter,
class Tag,
class GeometryCoords,
class I>
249 typename BMIGRAPH::geometry_t&
250 op_geometry(
const AutomataBase<I>&, BMIGRAPH&);
252 template <
class WordValue,
class SerieValue,
253 class Letter,
class Tag,
class GeometryCoords,
class I>
254 const typename BMIGRAPH::geometry_t&
255 op_geometry(
const AutomataBase<I>&,
const BMIGRAPH&);
258 # undef BMIGRAPH_TPARAM
263 template <
typename WordValue,
264 typename SeriesValue,
267 typename GeometryCoords>
268 struct automaton_traits<bmig::Graph<labels_are_letters, WordValue, bool, SeriesValue,
269 Letter, Tag, GeometryCoords> >
271 typedef bmig::Graph<labels_are_letters, WordValue, bool, SeriesValue,
272 Letter, Tag, GeometryCoords> graph_t;
273 typedef typename graph_t::semiring_elt_value_t semiring_elt_value_t;
274 typedef typename graph_t::monoid_elt_value_t monoid_elt_value_t;
275 typedef typename graph_t::word_value_t word_value_t;
276 typedef typename graph_t::series_set_elt_value_t series_set_elt_value_t;
277 typedef typename graph_t::letter_t letter_t;
278 typedef typename graph_t::tag_t tag_t;
279 typedef typename graph_t::geometry_t geometry_t;
280 typedef typename graph_t::label_t label_t;
281 typedef typename graph_t::states_t states_t;
282 typedef typename states_t::iterator state_iterator;
283 typedef typename graph_t::hstate_t hstate_t;
284 typedef typename graph_t::edges_t transitions_t;
285 typedef typename transitions_t::iterator transition_iterator;
286 typedef typename graph_t::htransition_t htransition_t;
287 typedef typename graph_t::initial_t initial_t;
288 typedef typename graph_t::initial_support_t initial_support_t;
289 typedef typename initial_support_t::iterator initial_iterator;
290 typedef typename graph_t::final_t final_t;
291 typedef typename graph_t::final_support_t final_support_t;
292 typedef typename final_support_t::iterator final_iterator;
297 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
298 # include <vaucanson/automata/implementation/bmig_graph_letters_spec.hxx>
299 # endif // !VCSN_USE_INTERFACE_ONLY || VCSN_USE_LIB
301 #endif // !VCSN_AUTOMATA_IMPLEMENTATION_BMIG_GRAPH_LETTERS_SPEC_HH_ //