Vaucanson 1.4
|
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, 2005, 2007, 2008 The 00006 // Vaucanson Group. 00007 // 00008 // This program is free software; you can redistribute it and/or 00009 // modify it under the terms of the GNU General Public License 00010 // as published by the Free Software Foundation; either version 2 00011 // of the License, or (at your option) any later version. 00012 // 00013 // The complete GNU General Public Licence Notice can be found as the 00014 // `COPYING' file in the root directory. 00015 // 00016 // The Vaucanson Group consists of people listed in the `AUTHORS' file. 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 | FreeMonoidBase<Self> | 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 } // algebra 00073 00077 /*--------------------------------------. 00078 | dynamic_traits<FreeMonoidBase<Self> > | 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 | MetaElement<FreeMonoidBase<Self>, T> | 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 00164 template <typename S, typename T> 00165 std::pair<bool, int> 00166 parse_word(Element<S, T>& dest, 00167 const std::string& s); 00168 00172 namespace algebra { 00173 00174 template <typename S, typename T> 00175 std::pair<bool, int> 00176 op_parse(const algebra::FreeMonoidBase<S>& s, T& v, 00177 const std::string&); 00178 00179 template<typename Self, typename T> 00180 void op_in_mirror(const algebra::FreeMonoidBase<Self>& s, T& v); 00181 00182 template<typename Self, typename T> 00183 bool op_contains(const algebra::FreeMonoidBase<Self>& s, const T& v); 00184 00185 template<typename Self, typename St, typename T> 00186 St& op_rout(const algebra::FreeMonoidBase<Self>& s, St& st, const T& v); 00187 00188 } // ! algebra 00189 00190 } // ! vcsn 00191 00192 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB 00193 # include <vaucanson/algebra/concept/freemonoid_base.hxx> 00194 # endif // ! VCSN_USE_INTERFACE_ONLY 00195 00196 #endif // ! VCSN_ALGEBRA_CONCEPT_FREEMONOID_BASE_HH