00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef VCSN_ALGEBRA_IMPLEMENTATION_SERIES_SERIES_HH
00018 # define VCSN_ALGEBRA_IMPLEMENTATION_SERIES_SERIES_HH
00019
00020 # include <vaucanson/algebra/concept/series_base.hh>
00021 # include <vaucanson/algebra/implementation/monoid/free_monoid.hh>
00022 # include <vaucanson/algebra/implementation/series/series_rep.hh>
00023 # include <vaucanson/design_pattern/slots.hh>
00024
00025
00026 namespace vcsn
00027 {
00028 namespace algebra
00029 {
00030
00031
00032
00033
00034 template <typename Semiring, typename Monoid>
00035 struct Series;
00036
00037
00038
00039
00040
00041
00042 template <typename Semiring>
00043 struct series_rep<Semiring, FreeMonoid<Element<AlphabetSet<int>, std::set<int> > > >
00044 : series_rep<Semiring, FreeMonoid<Element<AlphabetSet<char>, std::set<char> > > >
00045 {
00046
00047 typedef series_rep<Semiring, FreeMonoid<Element<AlphabetSet<char>,
00048 std::set<char> > > > parent_t;
00049
00050 using parent_t::open_par;
00051 using parent_t::close_par;
00052 using parent_t::plus;
00053 using parent_t::times;
00054 using parent_t::star;
00055 using parent_t::zero;
00056 using parent_t::open_weight;
00057 using parent_t::close_weight;
00058 using parent_t::spaces;
00059
00060 series_rep();
00061 };
00062
00063
00064
00065
00066
00067 struct semiring_slot_tag {};
00068 struct monoid_slot_tag {};
00069
00072 template<typename Semiring, typename Monoid>
00073 struct Series
00074 : SeriesBase<Series<Semiring, Monoid> >,
00075 private SetSlot<Semiring, semiring_slot_tag>,
00076 private SetSlot<Monoid, monoid_slot_tag>
00077 {
00078 typedef series_rep<Semiring, Monoid> series_rep_t;
00079 typedef boost::shared_ptr<series_rep_t> shared_series_rep_t;
00080
00081 Series(const Semiring& w, const Monoid& m);
00082 Series(const Semiring& w, const Monoid& m, const series_rep_t& sr);
00083 Series(const Series& other);
00084
00085 const Semiring& semiring() const;
00086
00087 const Monoid& monoid() const;
00088
00089 const shared_series_rep_t representation() const;
00090
00091 bool operator==(const Series<Semiring, Monoid>&) const;
00092
00093 protected:
00094 const shared_series_rep_t rep_;
00095 };
00096
00097 template <class W, class M, class NewW, class NewM>
00098 struct mute_series_traits<Series<W, M>, NewW, NewM >
00099 {
00100 typedef Series<NewW, NewM> ret;
00101 };
00102
00103 template <class W, class M, class NewW, class NewM>
00104 typename mute_series_traits<Series<W, M>, NewW, NewM >::ret
00105 mute_series(const Series<W, M>& s, const NewW& w, const NewM& m);
00106
00107 }
00108
00109
00110
00111
00112
00114 template <class W, class M, class T>
00115 struct MetaElement<algebra::Series<W, M>, T> :
00116 public MetaElement<algebra::SeriesBase<algebra::Series<W, M> >, T>
00117 { };
00118
00119
00120
00121
00122
00124 template<typename W, typename M>
00125 struct dynamic_traits<algebra::Series<W, M> >
00126 : dynamic_traits<algebra::SeriesBase<algebra::Series<W, M> > >
00127 {
00128 static const bool ret =
00129 dynamic_traits<W>::ret || dynamic_traits<M>::ret;
00130
00131 };
00132
00133
00134
00135
00136
00138 template<typename W, typename M>
00139 struct virtual_types<algebra::Series<W, M> >
00140 : virtual_types<algebra::SeriesBase<algebra::Series<W, M> > >
00141 {
00142 typedef W semiring_t;
00143 typedef M monoid_t;
00144 };
00145
00146 }
00147
00148
00149 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
00150 # include <vaucanson/algebra/implementation/series/series.hxx>
00151 #endif // VCSN_USE_INTERFACE_ONLY
00152
00153
00154 #endif // ! VCSN_ALGEBRA_IMPLEMENTATION_SERIES_SERIES_HH