freemonoid_base.hh

00001 // freemonoid_base.hh: this file is part of the Vaucanson project.
00002 //
00003 // Vaucanson, a generic library for finite state machines.
00004 //
00005 // Copyright (C) 2001, 2002, 2003, 2004 The Vaucanson Group.
00006 //
00007 // This program is free software; you can redistribute it and/or
00008 // modify it under the terms of the GNU General Public License
00009 // as published by the Free Software Foundation; either version 2
00010 // of the License, or (at your option) any later version.
00011 //
00012 // The complete GNU General Public Licence Notice can be found as the
00013 // `COPYING' file in the root directory.
00014 //
00015 // The Vaucanson Group consists of people listed in the `AUTHORS' file.
00016 //
00017 #ifndef VCSN_ALGEBRA_CONCEPT_FREEMONOID_BASE_HH
00018 # define VCSN_ALGEBRA_CONCEPT_FREEMONOID_BASE_HH
00019 
00020 # include <vaucanson/algebra/concept/alphabets_base.hh>
00021 # include <vaucanson/algebra/concept/monoid_base.hh>
00022 # include <string>
00023 # include <list>
00024 
00025 namespace vcsn {
00026 
00027   namespace algebra {
00028 
00032     /*---------------------.
00033     | FreeMonoidBase<Self> |
00034     `---------------------*/
00035 
00044     template<class Self>
00045     struct FreeMonoidBase
00046       : MonoidBase<Self>
00047     {
00049       typedef typename virtual_types<Self>::alphabet_t  alphabet_t;
00050 
00052       typedef typename alphabet_t::letter_t                     letter_t;
00053 
00055       alphabet_t&       alphabet();
00056 
00058       const alphabet_t& alphabet() const;
00059 
00060     protected:
00062       FreeMonoidBase();
00063 
00065       FreeMonoidBase(const FreeMonoidBase& m);
00066     };
00067 
00071   } // algebra
00072 
00076   /*--------------------------------------.
00077   | dynamic_traits<FreeMonoidBase<Self> > |
00078   `--------------------------------------*/
00079 
00080   template<class Self>
00081   struct dynamic_traits<algebra::FreeMonoidBase<Self> >
00082     : dynamic_traits<algebra::MonoidBase<Self> >
00083   { };
00084 
00085   template<typename S>
00086   struct virtual_types<algebra::FreeMonoidBase<S> >
00087     : virtual_types<algebra::MonoidBase<S> >
00088   {
00089     typedef undefined_type alphabet_t;
00090   };
00091 
00092   /*-------------------------------------.
00093   | MetaElement<FreeMonoidBase<Self>, T> |
00094   `-------------------------------------*/
00095 
00097   template<class Self, typename T>
00098   struct MetaElement<algebra::FreeMonoidBase<Self>, T>
00099     : MetaElement<algebra::MonoidBase<Self>, T>
00100   {
00102     typedef typename op_begin_traits<Self, T>::ret_t    iterator;
00103 
00105     typedef typename
00106     op_begin_traits<Self, T>::const_ret_t               const_iterator;
00107 
00109     typedef typename op_rbegin_traits<Self, T>::ret_t   reverse_iterator;
00110 
00112     typedef typename
00113     op_rbegin_traits<Self, T>::const_ret_t              const_reverse_iterator;
00114 
00116     size_t                    length() const;
00117 
00119     void                      mirror();
00120 
00122     iterator                    begin();
00123 
00125     const_iterator              begin() const;
00126 
00128     reverse_iterator            rbegin();
00129 
00131     const_reverse_iterator      rbegin() const;
00132 
00134     iterator                    end();
00135 
00137     const_iterator              end() const;
00138 
00140     reverse_iterator            rend();
00141 
00143     const_reverse_iterator      rend() const;
00144 
00145   protected:
00147     MetaElement();
00148 
00150     MetaElement(const MetaElement& other);
00151   };
00152 
00154   template<typename S, typename T>
00155   Element<S, T>
00156   mirror(const Element<S, T>& e);
00157 
00159   template <typename S, typename T, typename CharContainer>
00160   bool
00161   parse_word(Element<S, T>& dest,
00162              const std::string& s,
00163              typename std::string::const_iterator& i,
00164              const CharContainer& escaped = CharContainer ());
00165 
00169   template <typename S, typename T, typename CharContainer>
00170   bool op_parse(const algebra::FreeMonoidBase<S>& s, T& v,
00171                 const std::string&,
00172                 typename std::string::const_iterator&,
00173                 const CharContainer& escaped);
00174 
00175   template<typename Self, typename T>
00176   void op_in_mirror(const algebra::FreeMonoidBase<Self>& s, T& v);
00177 
00178   template<typename Self, typename T>
00179   bool op_contains(const algebra::FreeMonoidBase<Self>& s, const T& v);
00180 
00181   template<typename Self, typename St, typename T>
00182   St& op_rout(const algebra::FreeMonoidBase<Self>& s, St& st, const T& v);
00183 
00184 } // vcsn
00185 
00186 # ifndef VCSN_USE_INTERFACE_ONLY
00187 #  include <vaucanson/algebra/concept/freemonoid_base.hxx>
00188 # endif // VCSN_USE_INTERFACE_ONLY
00189 
00190 #endif // ! VCSN_ALGEBRA_CONCEPT_FREEMONOID_BASE_HH

Generated on Sat Jul 29 17:12:59 2006 for Vaucanson by  doxygen 1.4.6