00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef VCSN_ALGEBRA_IMPLEMENTATION_SERIES_SERIES_HXX
00018 # define VCSN_ALGEBRA_IMPLEMENTATION_SERIES_SERIES_HXX
00019
00020 # include <vaucanson/algebra/implementation/series/series.hh>
00021 # include <vaucanson/misc/unique.hh>
00022
00023 namespace vcsn
00024 {
00025 namespace algebra
00026 {
00027
00028
00029
00030
00031 template<typename Semiring, typename Monoid>
00032 Series<Semiring, Monoid>::Series(const Semiring& w, const Monoid& m)
00033 : SetSlot<Semiring,semiring_slot_tag>(w),
00034 SetSlot<Monoid,monoid_slot_tag>(m),
00035 rep_(SeriesRepDefault<Semiring, Monoid>::get_instance())
00036 {
00037 rep_->disambiguate((*this).monoid(), rep_);
00038 }
00039
00040 template<typename Semiring, typename Monoid>
00041 Series<Semiring, Monoid>::Series(const Semiring& w, const Monoid& m,
00042 const SeriesRep<Semiring, Monoid>& sr)
00043 : SetSlot<Semiring,semiring_slot_tag>(w),
00044 SetSlot<Monoid,monoid_slot_tag>(m),
00045 rep_(boost::shared_ptr<SeriesRep<Semiring, Monoid> >(new SeriesRep<Semiring, Monoid>(sr)))
00046 {
00047 }
00048
00049
00050 template<typename Semiring, typename Monoid>
00051 Series<Semiring, Monoid>::Series(const Series& other) :
00052 SeriesBase<Series<Semiring,Monoid> >(other),
00053 SetSlot<Semiring,semiring_slot_tag>(other),
00054 SetSlot<Monoid,monoid_slot_tag>(other),
00055 rep_(other.rep_)
00056 {}
00057
00058 template<typename Semiring, typename Monoid>
00059 const Semiring& Series<Semiring, Monoid>::semiring() const
00060 {
00061 return static_cast<const SetSlot<Semiring,semiring_slot_tag>* >(this)->_structure_get();
00062 }
00063
00064 template<typename Semiring, typename Monoid>
00065 const Monoid& Series<Semiring, Monoid>::monoid() const
00066 {
00067 return static_cast<const SetSlot<Monoid,monoid_slot_tag>* >(this)->_structure_get();
00068 }
00069
00070 template<typename Semiring, typename Monoid>
00071 const boost::shared_ptr<SeriesRep<Semiring, Monoid> >
00072 Series<Semiring, Monoid>::representation() const
00073 {
00074 return rep_;
00075 }
00076
00077 template<typename Semiring, typename Monoid>
00078 bool Series<Semiring, Monoid>::operator==(const Series<Semiring, Monoid>& s2) const
00079 {
00080 return & monoid() == & s2.monoid() &&
00081 & semiring() == & s2.semiring() &&
00082 rep_ == s2.rep_;
00083 }
00084
00085 template <class W, class M, class NewW, class NewM>
00086 typename mute_series_traits<Series<W, M>, NewW, NewM >::ret
00087 mute_series(const Series<W, M>& s, const NewW& w, const NewM& m)
00088 {
00089 return mute_series_traits<Series<W, M>, NewW, NewM >::ret(w, m);
00090 }
00091
00092 }
00093
00094 }
00095
00096 #endif // ! VCSN_ALGEBRA_IMPLEMENTATION_SERIES_SERIES_HXX