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/config/system.hh>
00021
00022 # if (not defined (VCSN_SANITY_CHECK)) or (defined (VCSN_USE_XML))
00023 # include <xercesc/dom/DOM.hpp>
00024 # include <xercesc/util/XMLString.hpp>
00025 # include <xercesc/util/PlatformUtils.hpp>
00026 # endif
00027
00028 # include <vaucanson/algebra/implementation/series/rat/nodes.hh>
00029 # include <vaucanson/design_pattern/element.hh>
00030
00031 namespace vcsn {
00032
00033 namespace rat {
00034
00036 template<typename LetterT, typename WeightT>
00037 class exp
00038 {
00039 public:
00040 typedef rat::Node<LetterT, WeightT> node_t;
00041 typedef typename rat::Node<LetterT, WeightT>::type type;
00042 typedef rat::Zero<LetterT, WeightT> n_zero_t;
00043 typedef rat::One<LetterT, WeightT> n_one_t;
00044 typedef rat::Sum<LetterT, WeightT> n_sum_t;
00045 typedef rat::Product<LetterT, WeightT> n_prod_t;
00046 typedef rat::Star<LetterT, WeightT> n_star_t;
00047 typedef rat::Constant<LetterT, WeightT> n_const_t;
00048
00049 public:
00050 typedef LetterT monoid_elt_value_t;
00051 typedef WeightT semiring_elt_value_t;
00052
00054
00055 exp();
00056 exp(node_t* p);
00057 exp(const node_t* p);
00058 exp(const exp& other);
00060
00062 ~exp();
00063
00065
00066 exp& operator = (const exp& other);
00067 exp& operator += (const exp& other);
00068 exp& operator *= (const exp& other);
00070
00072 exp& star();
00073
00075 exp& swap(exp& otether);
00076
00078 void
00079 accept(ConstNodeVisitor<monoid_elt_value_t, semiring_elt_value_t>& v)
00080 const;
00081
00083 size_t depth() const;
00084
00093 size_t star_height() const;
00094
00097 size_t length() const;
00098
00099 # if (not defined (VCSN_SANITY_CHECK)) or (defined (VCSN_USE_XML))
00100 xercesc::DOMElement* xml_tree(xercesc::DOMDocument* doc,
00101 char* node_name) const;
00102 # endif
00103
00105
00106 node_t* &base();
00107 node_t* const &base() const;
00109
00111
00112 bool operator == (const exp& other) const;
00113 bool operator != (const exp& other) const;
00114 bool operator < (const exp& other) const;
00116
00118 exp clone() const;
00119
00121
00122 static exp one();
00123 static exp zero();
00124 static exp constant(const monoid_elt_value_t& l);
00126
00128 static bool starable();
00129
00130 protected:
00132 node_t *base_;
00133 };
00134
00135 template<typename M, typename W>
00136 const exp<M, W> operator*(const exp<M, W>& lhs,
00137 const exp<M, W>& rhs);
00138
00139 template<typename M, typename W>
00140 exp<M, W> operator+(const exp<M, W>& lhs,
00141 const exp<M, W>& rhs);
00142
00143 template<typename M, typename W>
00144 exp<M, W> operator*(const W& lhs,
00145 const exp<M, W>& rhs);
00146
00147 template<typename M, typename W>
00148 exp<M, W> operator*(const exp<M, W>& lhs,
00149 const W& rhs);
00150
00151
00152
00153
00154 template<typename M, typename S, typename T>
00155 exp<M, Element<S, T> >
00156 operator*(const Element<S, T>& lhs,
00157 const exp<M, Element<S, T> >& rhs);
00158
00159 template<typename M, typename S, typename T>
00160 exp<M, Element<S, T> >
00161 operator*(const exp<M, Element<S, T> >& lhs,
00162 const Element<S, T>& rhs);
00163
00164 template<typename M, typename W>
00165 void swap(vcsn::rat::exp<M, W>& lhs,
00166 vcsn::rat::exp<M, W>& rhs);
00167
00168 }
00169
00170 }
00171
00172 # ifndef VCSN_USE_INTERFACE_ONLY
00173 # include <vaucanson/algebra/implementation/series/rat/exp.hxx>
00174 # endif // VCSN_USE_INTERFACE_ONLY
00175
00176 #endif // ! VCSN_ALGEBRA_IMPLEMENTATION_SERIES_RAT_EXP_HH