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 template <typename Semiring>
00028 series_rep<Semiring, FreeMonoid<Element<AlphabetSet<int>, std::set<int> > > >::series_rep() :
00029 series_rep<Semiring, FreeMonoid<Element<AlphabetSet<char>, std::set<char> > > >()
00030 {
00031 zero = "z";
00032 }
00033
00034
00035
00036
00037
00038 template<typename Semiring, typename Monoid>
00039 Series<Semiring, Monoid>::Series(const Semiring& w, const Monoid& m)
00040 : SetSlot<Semiring,semiring_slot_tag>(w),
00041 SetSlot<Monoid,monoid_slot_tag>(m),
00042 rep_(series_rep_default<Semiring, Monoid>::get_instance())
00043 {
00044 }
00045
00046 template<typename Semiring, typename Monoid>
00047 Series<Semiring, Monoid>::Series(const Semiring& w, const Monoid& m,
00048 const series_rep<Semiring, Monoid>& sr)
00049 : SetSlot<Semiring,semiring_slot_tag>(w),
00050 SetSlot<Monoid,monoid_slot_tag>(m),
00051 rep_(boost::shared_ptr<series_rep<Semiring, Monoid> >(new series_rep<Semiring, Monoid>(sr)))
00052 {
00053 }
00054
00055
00056 template<typename Semiring, typename Monoid>
00057 Series<Semiring, Monoid>::Series(const Series& other) :
00058 SeriesBase<Series<Semiring,Monoid> >(other),
00059 SetSlot<Semiring,semiring_slot_tag>(other),
00060 SetSlot<Monoid,monoid_slot_tag>(other),
00061 rep_(other.rep_)
00062 {}
00063
00064 template<typename Semiring, typename Monoid>
00065 const Semiring& Series<Semiring, Monoid>::semiring() const
00066 {
00067 return static_cast<const SetSlot<Semiring,semiring_slot_tag>* >(this)->_structure_get();
00068 }
00069
00070 template<typename Semiring, typename Monoid>
00071 const Monoid& Series<Semiring, Monoid>::monoid() const
00072 {
00073 return static_cast<const SetSlot<Monoid,monoid_slot_tag>* >(this)->_structure_get();
00074 }
00075
00076 template<typename Semiring, typename Monoid>
00077 const boost::shared_ptr<series_rep<Semiring, Monoid> >
00078 Series<Semiring, Monoid>::representation() const
00079 {
00080 return rep_;
00081 }
00082
00083 template<typename Semiring, typename Monoid>
00084 bool Series<Semiring, Monoid>::operator==(const Series<Semiring, Monoid>& s2) const
00085 {
00086 return & monoid() == & s2.monoid() &&
00087 & semiring() == & s2.semiring() &&
00088 rep_ == s2.rep_;
00089 }
00090
00091 template <class W, class M, class NewW, class NewM>
00092 typename mute_series_traits<Series<W, M>, NewW, NewM >::ret
00093 mute_series(const Series<W, M>& s, const NewW& w, const NewM& m)
00094 {
00095 return mute_series_traits<Series<W, M>, NewW, NewM >::ret(w, m);
00096 }
00097
00098 }
00099
00100 }
00101
00102 #endif // ! VCSN_ALGEBRA_IMPLEMENTATION_SERIES_SERIES_HXX