00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef VCSN_ALGEBRA_IMPLEMENTATION_FREE_MONOID_WORDS_HH
00018 # define VCSN_ALGEBRA_IMPLEMENTATION_FREE_MONOID_WORDS_HH
00019
00020 # include <string>
00021 # include <vaucanson/algebra/concept/freemonoid_base.hh>
00022 # include <vaucanson/misc/unique.hh>
00023 # include <vaucanson/misc/usual_macros.hh>
00024
00025 namespace vcsn
00026 {
00027 namespace algebra
00028 {
00032
00033
00034
00035
00037 template<typename A>
00038 struct FreeMonoid
00039 : FreeMonoidBase<FreeMonoid<A> >
00040 {
00041 typedef A alphabets_elt_t;
00042
00044 FreeMonoid(const A& a);
00045
00047 FreeMonoid(const FreeMonoid& w);
00048
00051 A& alphabet();
00052
00054 const A& alphabet() const;
00055
00056 protected:
00057 A alph_;
00058 };
00059
00060 template<typename A>
00061 bool operator==(const FreeMonoid<A>& a,
00062 const FreeMonoid<A>& b);
00063
00064
00065
00066
00067
00072 template <typename A>
00073 struct word_traits<FreeMonoid<A>,
00074 std::basic_string<typename A::letter_t> >
00075 {
00077 typedef A alphabet_t;
00078
00080 typedef Element<FreeMonoid<A>,
00081 std::basic_string<typename alphabet_t::letter_t> > word_t;
00082
00084 typedef typename word_t::value_t word_value_t;
00085
00087 typedef typename alphabet_traits<typename alphabet_t::set_t,
00088 typename alphabet_t::value_t>::
00089 first_projection_t first_projection_alphabet_t;
00090
00092 typedef typename alphabet_traits<typename alphabet_t::set_t,
00093 typename alphabet_t::value_t>::
00094 second_projection_t second_projection_alphabet_t;
00095
00097 typedef FreeMonoid<first_projection_alphabet_t> first_monoid_t;
00098
00100 typedef FreeMonoid<second_projection_alphabet_t> second_monoid_t;
00101
00103 typedef Element<first_monoid_t,
00104 std::basic_string<typename first_projection_alphabet_t::
00105 letter_t> > first_projection_t;
00106
00108 typedef typename first_projection_t::value_t first_projection_value_t;
00109
00111 typedef Element<second_monoid_t,
00112 std::basic_string<typename second_projection_alphabet_t::
00113 letter_t> > second_projection_t;
00114
00116 typedef typename second_projection_t::value_t second_projection_value_t;
00117
00119 static first_projection_t first_projection(const first_monoid_t&,
00120 const word_t&);
00121 static first_projection_value_t first_projection(const word_value_t&);
00122
00124 static second_projection_t second_projection(const second_monoid_t&,
00125 const word_t&);
00126 static second_projection_value_t second_projection(const word_value_t&);
00127 };
00128
00132 }
00133
00137
00138
00139
00141 template<typename A>
00142 struct dynamic_traits<algebra::FreeMonoid<A> >
00143 : dynamic_traits<algebra::FreeMonoidBase<algebra::FreeMonoid<A> > >
00144 {
00146 static const bool ret = A::dynamic;
00147 };
00148
00149
00150
00151
00154 template<typename A, typename T>
00155 struct MetaElement<algebra::FreeMonoid<A>, T>
00156 : MetaElement<algebra::FreeMonoidBase<algebra::FreeMonoid<A> >, T>
00157 {};
00158
00162 template <class A>
00163 struct virtual_types<algebra::FreeMonoid<A> >
00164 : virtual_types<algebra::FreeMonoidBase<algebra::FreeMonoid<A> > >
00165 {
00167 typedef algebra::mul_kind semigroup_kind;
00168
00169 typedef A alphabet_t;
00170 };
00171
00178 enum op_choose_max_word_length_t { op_choose_max_word_length = 32 };
00179
00180 }
00181
00182 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
00183 # include <vaucanson/algebra/implementation/free_monoid/words.hxx>
00184 # endif // VCSN_USE_INTERFACE_ONLY
00185
00186 #endif // ! VCSN_ALGEBRA_IMPLEMENTATION_FREE_MONOID_WORDS_HH