Vaucanson  1.4.1
freemonoid_base.hh
1 // freemonoid_base.hh: this file is part of the Vaucanson project.
2 //
3 // Vaucanson, a generic library for finite state machines.
4 //
5 // Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007, 2008 The
6 // Vaucanson Group.
7 //
8 // This program is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU General Public License
10 // as published by the Free Software Foundation; either version 2
11 // of the License, or (at your option) any later version.
12 //
13 // The complete GNU General Public Licence Notice can be found as the
14 // `COPYING' file in the root directory.
15 //
16 // The Vaucanson Group consists of people listed in the `AUTHORS' file.
17 //
18 #ifndef VCSN_ALGEBRA_CONCEPT_FREEMONOID_BASE_HH
19 # define VCSN_ALGEBRA_CONCEPT_FREEMONOID_BASE_HH
20 
22 # include <vaucanson/algebra/concept/monoid_base.hh>
23 # include <string>
24 # include <list>
25 
26 namespace vcsn {
27 
28  namespace algebra {
29 
33  /*---------------------.
34  | FreeMonoidBase<Self> |
35  `---------------------*/
36 
45  template<class Self>
47  : MonoidBase<Self>
48  {
50  typedef typename virtual_types<Self>::alphabet_t alphabet_t;
51 
53  typedef typename alphabet_t::letter_t letter_t;
54 
57 
59  const alphabet_t& alphabet() const;
60 
61  protected:
64 
67  };
68 
72  } // algebra
73 
77  /*--------------------------------------.
78  | dynamic_traits<FreeMonoidBase<Self> > |
79  `--------------------------------------*/
80 
81  template<class Self>
82  struct dynamic_traits<algebra::FreeMonoidBase<Self> >
83  : dynamic_traits<algebra::MonoidBase<Self> >
84  { };
85 
86  template<typename S>
87  struct virtual_types<algebra::FreeMonoidBase<S> >
88  : virtual_types<algebra::MonoidBase<S> >
89  {
90  typedef undefined_type alphabet_t;
91  };
92 
93  /*-------------------------------------.
94  | MetaElement<FreeMonoidBase<Self>, T> |
95  `-------------------------------------*/
96 
98  template<class Self, typename T>
99  struct MetaElement<algebra::FreeMonoidBase<Self>, T>
100  : MetaElement<algebra::MonoidBase<Self>, T>
101  {
103  typedef typename op_begin_traits<Self, T>::ret_t iterator;
104 
106  typedef typename
107  op_begin_traits<Self, T>::const_ret_t const_iterator;
108 
110  typedef typename op_rbegin_traits<Self, T>::ret_t reverse_iterator;
111 
113  typedef typename
114  op_rbegin_traits<Self, T>::const_ret_t const_reverse_iterator;
115 
117  size_t length() const;
118 
120  void mirror();
121 
123  iterator begin();
124 
126  const_iterator begin() const;
127 
129  reverse_iterator rbegin();
130 
132  const_reverse_iterator rbegin() const;
133 
135  iterator end();
136 
138  const_iterator end() const;
139 
141  reverse_iterator rend();
142 
144  const_reverse_iterator rend() const;
145 
146  protected:
148  MetaElement();
149 
151  MetaElement(const MetaElement& other);
152  };
153 
155  template<typename S, typename T>
157  mirror(const Element<S, T>& e);
158 
164  template <typename S, typename T>
165  std::pair<bool, int>
167  const std::string& s);
168 
172  namespace algebra {
173 
174  template <typename S, typename T>
175  std::pair<bool, int>
176  op_parse(const algebra::FreeMonoidBase<S>& s, T& v,
177  const std::string&);
178 
179  template<typename Self, typename T>
180  void op_in_mirror(const algebra::FreeMonoidBase<Self>& s, T& v);
181 
182  template<typename Self, typename T>
183  bool op_contains(const algebra::FreeMonoidBase<Self>& s, const T& v);
184 
185  template<typename Self, typename St, typename T>
186  St& op_rout(const algebra::FreeMonoidBase<Self>& s, St& st, const T& v);
187 
188  } // ! algebra
189 
190 } // ! vcsn
191 
192 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
193 # include <vaucanson/algebra/concept/freemonoid_base.hxx>
194 # endif // ! VCSN_USE_INTERFACE_ONLY
195 
196 #endif // ! VCSN_ALGEBRA_CONCEPT_FREEMONOID_BASE_HH