17 #ifndef VCSN_ALGORITHMS_KRAT_EXP_REALTIME_HXX
18 # define VCSN_ALGORITHMS_KRAT_EXP_REALTIME_HXX
22 # include <vaucanson/algebra/concept/series_base.hh>
23 # include <vaucanson/algebra/implementation/series/krat_exp_pattern.hh>
31 class KRatExpIsRealtime :
32 public algebra::KRatExpMatcher<
33 KRatExpIsRealtime<Exp_, Dispatch_>,
40 typedef KRatExpIsRealtime<Exp_, Dispatch_> this_class;
41 typedef bool return_type;
42 typedef typename Exp_::monoid_elt_value_t monoid_elt_value_t;
43 typedef typename Exp_::semiring_elt_value_t semiring_elt_value_t;
44 INHERIT_CONSTRUCTORS(this_class, Exp_,
bool, Dispatch_);
48 return this->
match(l) and this->match(r);
52 MATCH__(Product, l, r)
54 return this->
match(l) and this->match(r);
60 return this->
match(e);
64 MATCH__(LeftWeight, w, e)
67 return this->
match(e);
71 MATCH__(RightWeight, e, w)
74 return this->
match(e);
80 typename monoid_elt_value_t::const_iterator i = m.begin();
81 return ++i == m.end();
100 template <
class Exp_,
class S_>
102 do_is_realtime(
const algebra::SeriesBase<S_>&,
const Exp_& exp)
105 typedef typename Exp_::value_t T;
107 algebra::KRatExpIsRealtime< T, algebra::DispatchFunction<T> >
109 return matcher.match(exp.value());
115 template <
class Series,
class T,
class Dispatch>
116 struct KRatExpRealtime : algebra::KRatExpIdentity<
117 KRatExpRealtime<Series, T, Dispatch>,
123 typedef KRatExpRealtime<Series, T, Dispatch> self_t;
124 typedef Element<Series, T> return_type;
125 typedef typename Element<Series, T>::semiring_elt_t semiring_elt_t;
126 typedef typename semiring_elt_t::value_t semiring_elt_value_t;
127 typedef typename Element<Series, T>::monoid_elt_t monoid_elt_t;
128 typedef typename monoid_elt_t::value_t monoid_elt_value_t;
129 typedef typename monoid_elt_t::set_t monoid_t;
130 typedef typename monoid_t::alphabet_t alphabet_t;
131 typedef typename alphabet_t::letter_t letter_t;
132 INHERIT_CONSTRUCTORS(self_t, T, semiring_elt_t, Dispatch);
134 KRatExpRealtime(
const Element<Series, T>& exp) :
135 KRatExpIdentity<KRatExpRealtime<Series, T, Dispatch>,
144 return_type exp = identity_as<T>::of(this->exp_.structure());
145 return_type tmp (this->exp_.structure());
146 monoid_elt_t letter (this->exp_.structure().monoid());
147 for (
typename monoid_elt_value_t::const_iterator i = m.begin();
162 template <
class Exp_,
class S_>
164 do_realtime(
const algebra::SeriesBase<S_>&,
const Exp_& exp)
167 typedef typename Exp_::value_t T;
169 algebra::KRatExpRealtime< S, T, algebra::DispatchFunction<T> >
171 return matcher.match(exp.value());
174 template <
class Exp_,
class S_>
176 do_realtime_here(
const algebra::SeriesBase<S_>&, Exp_& exp)
179 typedef typename Exp_::value_t T;
181 algebra::KRatExpRealtime< S, T, algebra::DispatchFunction<T> >
183 exp = matcher.match(exp.value());
188 #endif // ! VCSN_ALGORITHMS_KRAT_EXP_REALTIME_HXX