00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef VCSN_ALGEBRA_IMPLEMENTATION_SERIES_RAT_EXP_HH
00018 # define VCSN_ALGEBRA_IMPLEMENTATION_SERIES_RAT_EXP_HH
00019
00020 # include <vaucanson/algebra/implementation/series/rat/nodes.hh>
00021 # include <vaucanson/design_pattern/element.hh>
00022
00023 namespace vcsn {
00024
00025 namespace rat {
00026
00028 template<typename LetterT, typename WeightT>
00029 class exp
00030 {
00031 public:
00032 typedef rat::Node<LetterT, WeightT> node_t;
00033 typedef typename rat::Node<LetterT, WeightT>::type type;
00034 typedef rat::Zero<LetterT, WeightT> n_zero_t;
00035 typedef rat::One<LetterT, WeightT> n_one_t;
00036 typedef rat::Sum<LetterT, WeightT> n_sum_t;
00037 typedef rat::Product<LetterT, WeightT> n_prod_t;
00038 typedef rat::Star<LetterT, WeightT> n_star_t;
00039 typedef rat::Constant<LetterT, WeightT> n_const_t;
00040
00041 public:
00042 typedef LetterT monoid_elt_value_t;
00043 typedef WeightT semiring_elt_value_t;
00044
00046
00047 exp();
00048 exp(node_t* p);
00049 exp(const node_t* p);
00050 exp(const exp& other);
00052
00054 ~exp();
00055
00057
00058 exp& operator = (const exp& other);
00059 exp& operator += (const exp& other);
00060 exp& operator *= (const exp& other);
00062
00064 exp& star();
00065
00067 exp& swap(exp& otether);
00068
00070 void
00071 accept(ConstNodeVisitor<monoid_elt_value_t, semiring_elt_value_t>& v)
00072 const;
00073
00075 size_t depth() const;
00076
00085 size_t star_height() const;
00086
00089 size_t length() const;
00090
00092
00093 node_t* &base();
00094 node_t* const &base() const;
00096
00098
00099 bool operator == (const exp& other) const;
00100 bool operator != (const exp& other) const;
00101 bool operator < (const exp& other) const;
00103
00105 exp clone() const;
00106
00108
00109 static exp one();
00110 static exp zero();
00111 static exp constant(const monoid_elt_value_t& l);
00113
00115 static bool starable();
00116
00117 protected:
00119 node_t *base_;
00120 };
00121
00122 template<typename M, typename W>
00123 const exp<M, W> operator*(const exp<M, W>& lhs,
00124 const exp<M, W>& rhs);
00125
00126 template<typename M, typename W>
00127 exp<M, W> operator+(const exp<M, W>& lhs,
00128 const exp<M, W>& rhs);
00129
00130 template<typename M, typename W>
00131 exp<M, W> operator*(const W& lhs,
00132 const exp<M, W>& rhs);
00133
00134 template<typename M, typename W>
00135 exp<M, W> operator*(const exp<M, W>& lhs,
00136 const W& rhs);
00137
00138
00139
00140
00141 template<typename M, typename S, typename T>
00142 exp<M, Element<S, T> >
00143 operator*(const Element<S, T>& lhs,
00144 const exp<M, Element<S, T> >& rhs);
00145
00146 template<typename M, typename S, typename T>
00147 exp<M, Element<S, T> >
00148 operator*(const exp<M, Element<S, T> >& lhs,
00149 const Element<S, T>& rhs);
00150
00151 template<typename M, typename W>
00152 void swap(vcsn::rat::exp<M, W>& lhs,
00153 vcsn::rat::exp<M, W>& rhs);
00154
00155 }
00156
00157 }
00158
00159 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
00160 # include <vaucanson/algebra/implementation/series/rat/exp.hxx>
00161 # endif // VCSN_USE_INTERFACE_ONLY
00162
00163 #endif // ! VCSN_ALGEBRA_IMPLEMENTATION_SERIES_RAT_EXP_HH