00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef VCSN_ALGEBRA_IMPLEMENTATION_MONOID_FREE_MONOID_HXX
00018 # define VCSN_ALGEBRA_IMPLEMENTATION_MONOID_FREE_MONOID_HXX
00019
00020 # include <vaucanson/algebra/implementation/monoid/free_monoid.hh>
00021
00022 namespace vcsn
00023 {
00024 namespace algebra
00025 {
00026
00027
00028
00029
00030 template <class A>
00031 FreeMonoid<A>::FreeMonoid(const A& a) :
00032 rep_(MonoidRepDefault<FreeMonoid<A> >::get_instance()),
00033 alph_(a)
00034 {
00035 rep_->disambiguate(*this, rep_);
00036 }
00037
00038 template <class A>
00039 FreeMonoid<A>::FreeMonoid(const A& a, MonoidRep<FreeMonoid<A> > mr) :
00040 rep_(boost::shared_ptr<MonoidRep<FreeMonoid<A> > >(new MonoidRep<FreeMonoid<A> > (mr))),
00041 alph_(a)
00042 {
00043 }
00044
00045 template <class A>
00046 FreeMonoid<A>::FreeMonoid(const FreeMonoid& w) :
00047 FreeMonoidBase<FreeMonoid<A> >(w),
00048 rep_(w.rep_),
00049 alph_(w.alph_)
00050 {
00051 }
00052
00053 template <class A>
00054 const boost::shared_ptr<MonoidRep<FreeMonoid<A> > >
00055 FreeMonoid<A>::representation() const
00056 {
00057 return rep_;
00058 }
00059
00060 template <class A>
00061 void
00062 FreeMonoid<A>::set_representation(MonoidRep<FreeMonoid<A> > mr)
00063 {
00064 rep_ = boost::shared_ptr<MonoidRep<FreeMonoid<A> > >(new MonoidRep<FreeMonoid<A> > (mr));
00065 }
00066
00067 template <class A>
00068 A& FreeMonoid<A>::alphabet()
00069 {
00070 return alph_;
00071 }
00072
00073 template <class A>
00074 const A& FreeMonoid<A>::alphabet() const
00075 {
00076 return alph_;
00077 }
00078
00079 template <typename A>
00080 bool
00081 operator==(const FreeMonoid<A>& lhs,
00082 const FreeMonoid<A>& rhs)
00083 {
00084 return (lhs.alphabet() == rhs.alphabet() &&
00085 lhs.representation() == rhs.representation());
00086 }
00087
00088 }
00089
00090 }
00091
00092 #endif // ! VCSN_ALGEBRA_IMPLEMENTATION_MONOID_FREE_MONOID_HXX