00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef VCSN_ALGEBRA_IMPLEMENTATION_MONOID_FREE_MONOID_HH
00018 # define VCSN_ALGEBRA_IMPLEMENTATION_MONOID_FREE_MONOID_HH
00019
00020 # include <set>
00021
00022 # include <vaucanson/algebra/concept/freemonoid_base.hh>
00023 # include <vaucanson/algebra/implementation/monoid/monoid_rep.hh>
00024 # include <vaucanson/algebra/implementation/alphabets/alphabet_set.hh>
00025 # include <vaucanson/misc/unique.hh>
00026 # include <vaucanson/misc/usual_macros.hh>
00027
00028 namespace vcsn
00029 {
00030 namespace algebra
00031 {
00035
00036
00037
00038
00039 template <typename A>
00040 struct FreeMonoid;
00041
00042
00043
00044
00045
00046
00047 template <>
00048 struct monoid_rep<FreeMonoid<Element<AlphabetSet<int>, std::set<int> > > >
00049 : monoid_rep<FreeMonoid<Element<AlphabetSet<char>, std::set<char> > > >
00050 {
00051
00052 typedef monoid_rep<FreeMonoid<Element<AlphabetSet<char>,
00053 std::set<char> > > > parent_t;
00054
00056 using parent_t::empty;
00057 using parent_t::concat;
00058 using parent_t::maybe_epsilon;
00059
00060 monoid_rep();
00061 };
00062
00063
00064
00065
00066
00068 template<typename A>
00069 struct FreeMonoid
00070 : FreeMonoidBase<FreeMonoid<A> >
00071 {
00072
00073 typedef A alphabets_elt_t;
00074 typedef monoid_rep<FreeMonoid<A> > monoid_rep_t;
00075 typedef boost::shared_ptr<monoid_rep_t> shared_monoid_rep_t;
00076
00079 FreeMonoid(const A& a);
00080
00083 FreeMonoid(const A& a, monoid_rep_t mr);
00084
00086 FreeMonoid(const FreeMonoid& w);
00087
00089 const shared_monoid_rep_t representation() const;
00090
00094 A& alphabet();
00095
00097 const A& alphabet() const;
00098
00099 public:
00102 void set_representation(monoid_rep_t mr);
00103
00104 protected:
00105 shared_monoid_rep_t rep_;
00106 A alph_;
00107 };
00108
00109 template<typename A>
00110 bool operator==(const FreeMonoid<A>& a,
00111 const FreeMonoid<A>& b);
00112
00116 }
00117
00121
00122
00123
00125 template<typename A>
00126 struct dynamic_traits<algebra::FreeMonoid<A> >
00127 : dynamic_traits<algebra::FreeMonoidBase<algebra::FreeMonoid<A> > >
00128 {
00130 static const bool ret = A::dynamic;
00131 };
00132
00133
00134
00135
00138 template<typename A, typename T>
00139 struct MetaElement<algebra::FreeMonoid<A>, T>
00140 : MetaElement<algebra::FreeMonoidBase<algebra::FreeMonoid<A> >, T>
00141 {};
00142
00146 template <class A>
00147 struct virtual_types<algebra::FreeMonoid<A> >
00148 : virtual_types<algebra::FreeMonoidBase<algebra::FreeMonoid<A> > >
00149 {
00150 typedef A alphabet_t;
00151 };
00152
00159 enum op_choose_max_word_length_t { op_choose_max_word_length = 32 };
00160
00161 }
00162
00163 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
00164 # include <vaucanson/algebra/implementation/monoid/free_monoid.hxx>
00165 # endif // VCSN_USE_INTERFACE_ONLY
00166
00167 #endif // ! VCSN_ALGEBRA_IMPLEMENTATION_MONOID_FREE_MONOID_HH