Vaucanson  1.4.1
freemonoid_product_base.hh
1 // freemonoid_product_base.hh: this file is part of the Vaucanson project.
2 //
3 // Vaucanson, a generic library for finite state machines.
4 //
5 // Copyright (C) 2004, 2005, 2006, 2008 The Vaucanson Group.
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License
9 // as published by the Free Software Foundation; either version 2
10 // of the License, or (at your option) any later version.
11 //
12 // The complete GNU General Public Licence Notice can be found as the
13 // `COPYING' file in the root directory.
14 //
15 // The Vaucanson Group consists of people listed in the `AUTHORS' file.
16 //
17 #ifndef VCSN_ALGEBRA_CONCEPT_FREEMONOID_PRODUCT_BASE_HH
18 # define VCSN_ALGEBRA_CONCEPT_FREEMONOID_PRODUCT_BASE_HH
19 
21 # include <vaucanson/algebra/concept/monoid_base.hh>
22 # include <string>
23 # include <list>
24 
25 namespace vcsn {
26 
27  namespace algebra {
28 
32  /*----------------------------.
33  | FreeMonoidProductBase<Self> |
34  `----------------------------*/
35 
44  template<class Self>
46  : MonoidBase<Self>
47  {
49  typedef typename virtual_types<Self>::first_monoid_t first_monoid_t;
50 
52  typedef typename virtual_types<Self>::second_monoid_t second_monoid_t;
53 
54  // FIXME
55  typedef undefined_type alphabet_t;
56  typedef undefined_type letter_t;
57 
60 
62  const first_monoid_t& first_monoid() const;
63 
66 
68  const second_monoid_t& second_monoid() const;
69 
70  protected:
73 
76  };
77 
81  } // algebra
82 
86  /*-------------------------------------------.
87  | dynamic_traits<FreeMonoidProductBase<Self> |
88  `-------------------------------------------*/
89 
90  template<class Self>
91  struct dynamic_traits<algebra::FreeMonoidProductBase<Self> >
92  : dynamic_traits<algebra::MonoidBase<Self> >
93  { };
94 
95  /*------------------------------------------.
96  | virtual_types<FreeMonoidProductBase<Self> |
97  `------------------------------------------*/
98 
99  template<typename S>
100  struct virtual_types<algebra::FreeMonoidProductBase<S> >
101  : virtual_types<algebra::MonoidBase<S> >
102  {
103  typedef undefined_type first_monoid_t;
104  typedef undefined_type second_monoid_t;
105  };
106 
107 
108  /*--------------------------------------------.
109  | MetaElement<FreeMonoidProductBase<Self>, T> |
110  `--------------------------------------------*/
111 
113  template<class Self, typename T>
114  struct MetaElement<algebra::FreeMonoidProductBase<Self>, T>
115  : MetaElement<algebra::MonoidBase<Self>, T>
116  {
117  typedef typename virtual_types<Self>::first_monoid_t first_monoid_t;
118  typedef typename virtual_types<Self>::second_monoid_t second_monoid_t;
119 
120  typedef typename T::first_type first_monoid_elt_value_t;
121  typedef typename T::second_type second_monoid_elt_value_t;
122 
127 
129  first_monoid_elt_t& first();
130 
132  const first_monoid_elt_t& first() const;
133 
135  second_monoid_elt_t& second();
136 
138  const second_monoid_elt_t& second() const;
139 
141  void mirror();
142 
144  template <class Ftor>
145  typename Ftor::result_type length(Ftor f);
146 
147  protected:
149  MetaElement();
150 
152  MetaElement(const MetaElement& other);
153  };
154 
158  // FIXME: it should more closely follow freemonoid_base.
159  namespace algebra
160  {
161  template<typename Self, typename St, typename T>
162  St&
163  op_rout(const FreeMonoidProductBase<Self>& s, St& st, const T& v);
164 
165  } // ! algebra
166 
167 } // ! vcsn
168 
169 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
170 # include <vaucanson/algebra/concept/freemonoid_product_base.hxx>
171 # endif // VCSN_USE_INTERFACE_ONLY
172 
173 #endif // ! VCSN_ALGEBRA_CONCEPT_FREEMONOID_PRODUCT_BASE_HH