00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef VCSN_ALGEBRA_CONCEPT_FREEMONOID_PRODUCT_HH
00018 # define VCSN_ALGEBRA_CONCEPT_FREEMONOID_PRODUCT_HH
00019
00020 # include <vaucanson/algebra/concept/freemonoid_product_base.hh>
00021 # include <vaucanson/algebra/implementation/monoid/monoid_rep.hh>
00022 # include <vaucanson/algebra/implementation/series/series_rep.hh>
00023 # include <vaucanson/misc/unique.hh>
00024
00025 namespace vcsn {
00026
00027 namespace algebra {
00028
00032
00033
00034
00035
00036 template <class F, class S>
00037 struct FreeMonoidProduct;
00038
00039
00040
00041
00042
00043 template <typename F, typename S>
00044 struct monoid_rep<FreeMonoidProduct<F, S> > : monoid_rep<F>
00045 {
00047 using monoid_rep<F>::empty;
00048 using monoid_rep<F>::concat;
00049 using monoid_rep<F>::maybe_epsilon;
00050
00052 std::string open_par;
00053
00055 std::string sep;
00056
00058 std::string close_par;
00059
00060 monoid_rep();
00061
00063 monoid_rep<F> first_projection() const;
00064 monoid_rep<S> second_projection() const;
00065 };
00066
00067
00068
00069
00070
00071 template <typename Semiring, typename F, typename S>
00072 struct series_rep<Semiring, FreeMonoidProduct<F, S> > : series_rep<Semiring, F>
00073 {
00074
00075 typedef series_rep<Semiring, F> parent_t;
00076
00077 using parent_t::open_par;
00078 using parent_t::close_par;
00079 using parent_t::plus;
00080 using parent_t::times;
00081 using parent_t::star;
00082 using parent_t::zero;
00083 using parent_t::open_weight;
00084 using parent_t::close_weight;
00085 using parent_t::spaces;
00086
00088 series_rep();
00089
00091 series_rep<Semiring, F> first_projection() const;
00092 series_rep<Semiring, S> second_projection() const;
00093 };
00094
00095 template <typename F, typename S>
00096 bool operator==(boost::shared_ptr<monoid_rep<FreeMonoidProduct<F, S> > >,
00097 boost::shared_ptr<monoid_rep<FreeMonoidProduct<F, S> > >);
00098
00099
00100
00101
00102
00104 template<class F, class S>
00105 struct FreeMonoidProduct
00106 : FreeMonoidProductBase< FreeMonoidProduct<F, S> >
00107 {
00108
00109 typedef F first_monoid_t;
00110 typedef S second_monoid_t;
00111 typedef monoid_rep<FreeMonoidProduct<F, S> > monoid_rep_t;
00112 typedef boost::shared_ptr<monoid_rep_t> shared_monoid_rep_t;
00113
00115 FreeMonoidProduct(const F& a, const S& b);
00116
00118 FreeMonoidProduct(const F& a, const S& b, monoid_rep_t mr);
00119
00121 FreeMonoidProduct(const FreeMonoidProduct& w);
00122
00126 first_monoid_t& first_monoid();
00127
00128 const first_monoid_t& first_monoid() const;
00129
00130 second_monoid_t& second_monoid();
00131
00132 const second_monoid_t& second_monoid() const;
00133
00135 const shared_monoid_rep_t representation() const;
00136
00137 public:
00139 void set_representation(monoid_rep_t mr);
00140
00141 protected:
00142 first_monoid_t first_monoid_;
00143 second_monoid_t second_monoid_;
00144 shared_monoid_rep_t rep_;
00145 };
00146
00147 template<class F, class S>
00148 bool operator==(const FreeMonoidProduct<F, S>& m1,
00149 const FreeMonoidProduct<F, S>& m2);
00150
00154 }
00155
00159
00160
00161
00163 template<class F, class S>
00164 struct dynamic_traits<algebra::FreeMonoidProduct<F, S> >
00165 : dynamic_traits<algebra::FreeMonoidProductBase<algebra::FreeMonoidProduct<F, S> > >
00166 {
00168 static const bool
00169 ret = dynamic_traits<F>::ret or dynamic_traits<S>::ret;
00170 };
00171
00172
00173
00174
00176 template<class F, class S>
00177 struct representation_traits<algebra::FreeMonoidProduct<F, S> >
00178 : representation_traits<algebra::FreeMonoidProductBase<algebra::FreeMonoidProduct<F, S> > >
00179 { };
00180
00181
00182
00183
00186 template<class F, class S, typename T>
00187 struct MetaElement<algebra::FreeMonoidProduct<F, S>, T>
00188 : MetaElement<algebra::FreeMonoidProductBase<algebra::FreeMonoidProduct<F, S> >, T>
00189 {
00190 typedef F first_monoid_t;
00191 typedef S second_monoid_t;
00192 };
00193
00198 template <class F, class S>
00199 struct virtual_types<algebra::FreeMonoidProduct<F, S> >
00200 : virtual_types<algebra::FreeMonoidProductBase<algebra::FreeMonoidProduct<F, S> > >
00201 {
00202 typedef F first_monoid_t;
00203 typedef S second_monoid_t;
00204 };
00205
00206 }
00207
00208 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
00209 # include <vaucanson/algebra/concept/freemonoid_product.hxx>
00210 # endif // VCSN_USE_INTERFACE_ONLY
00211
00212
00213 #endif // ! VCSN_ALGEBRA_CONCEPT_FREEMONOID_PRODUCT_HH