00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 #ifndef VCSN_ALGEBRA_CONCEPT_FREEMONOID_BASE_HH
00019 # define VCSN_ALGEBRA_CONCEPT_FREEMONOID_BASE_HH
00020 
00021 # include <vaucanson/algebra/concept/alphabets_base.hh>
00022 # include <vaucanson/algebra/concept/monoid_base.hh>
00023 # include <string>
00024 # include <list>
00025 
00026 namespace vcsn {
00027 
00028   namespace algebra {
00029 
00033     
00034 
00035 
00036 
00045     template<class Self>
00046     struct FreeMonoidBase
00047       : MonoidBase<Self>
00048     {
00050       typedef typename virtual_types<Self>::alphabet_t  alphabet_t;
00051 
00053       typedef typename alphabet_t::letter_t                     letter_t;
00054 
00056       alphabet_t&       alphabet();
00057 
00059       const alphabet_t& alphabet() const;
00060 
00061     protected:
00063       FreeMonoidBase();
00064 
00066       FreeMonoidBase(const FreeMonoidBase& m);
00067     };
00068 
00072   } 
00073 
00077   
00078 
00079 
00080 
00081   template<class Self>
00082   struct dynamic_traits<algebra::FreeMonoidBase<Self> >
00083     : dynamic_traits<algebra::MonoidBase<Self> >
00084   { };
00085 
00086   template<typename S>
00087   struct virtual_types<algebra::FreeMonoidBase<S> >
00088     : virtual_types<algebra::MonoidBase<S> >
00089   {
00090     typedef undefined_type alphabet_t;
00091   };
00092 
00093   
00094 
00095 
00096 
00098   template<class Self, typename T>
00099   struct MetaElement<algebra::FreeMonoidBase<Self>, T>
00100     : MetaElement<algebra::MonoidBase<Self>, T>
00101   {
00103     typedef typename op_begin_traits<Self, T>::ret_t    iterator;
00104 
00106     typedef typename
00107     op_begin_traits<Self, T>::const_ret_t               const_iterator;
00108 
00110     typedef typename op_rbegin_traits<Self, T>::ret_t   reverse_iterator;
00111 
00113     typedef typename
00114     op_rbegin_traits<Self, T>::const_ret_t              const_reverse_iterator;
00115 
00117     size_t                    length() const;
00118 
00120     void                      mirror();
00121 
00123     iterator                    begin();
00124 
00126     const_iterator              begin() const;
00127 
00129     reverse_iterator            rbegin();
00130 
00132     const_reverse_iterator      rbegin() const;
00133 
00135     iterator                    end();
00136 
00138     const_iterator              end() const;
00139 
00141     reverse_iterator            rend();
00142 
00144     const_reverse_iterator      rend() const;
00145 
00146   protected:
00148     MetaElement();
00149 
00151     MetaElement(const MetaElement& other);
00152   };
00153 
00155   template<typename S, typename T>
00156   Element<S, T>
00157   mirror(const Element<S, T>& e);
00158 
00160   template <typename S, typename T, typename CharContainer>
00161   bool
00162   parse_word(Element<S, T>& dest,
00163              const std::string& s,
00164              typename std::string::const_iterator& i,
00165              const CharContainer& escaped = CharContainer ());
00166 
00170   namespace algebra {
00171 
00172     template <typename S, typename T, typename CharContainer>
00173     bool op_parse(const algebra::FreeMonoidBase<S>& s, T& v,
00174                   const std::string&,
00175                   typename std::string::const_iterator&,
00176                   const CharContainer& escaped);
00177 
00178     template<typename Self, typename T>
00179     void op_in_mirror(const algebra::FreeMonoidBase<Self>& s, T& v);
00180 
00181     template<typename Self, typename T>
00182     bool op_contains(const algebra::FreeMonoidBase<Self>& s, const T& v);
00183 
00184     template<typename Self, typename St, typename T>
00185     St& op_rout(const algebra::FreeMonoidBase<Self>& s, St& st, const T& v);
00186 
00187   } 
00188 
00189 } 
00190 
00191 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
00192 #  include <vaucanson/algebra/concept/freemonoid_base.hxx>
00193 # endif // ! VCSN_USE_INTERFACE_ONLY
00194 
00195 #endif // ! VCSN_ALGEBRA_CONCEPT_FREEMONOID_BASE_HH