Vaucanson  1.4.1
monoid_base.hh
1 // monoid_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, 2006, 2007, 2008, 2010 The Vaucanson
6 // 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_MONOID_BASE_HH
19 # define VCSN_ALGEBRA_CONCEPT_MONOID_BASE_HH
20 
21 # include <vaucanson/algebra/concept/semigroup_base.hh>
22 
23 namespace vcsn {
24 
25  namespace algebra {
26 
30  /*-----------------.
31  | MonoidBase<Self> |
32  `-----------------*/
33 
40  template<class Self>
41  struct MonoidBase : SemigroupBase<Self>
42  {
44  template<typename T>
46 
48  template<typename T>
49  Element<Self, T> zero(SELECTOR(T)) const;
50 
51  protected:
53  MonoidBase();
54 
56  MonoidBase(const MonoidBase& other);
57  };
58 
59  template <class T>
60  struct identity_as
61  {
62  template <class S>
63  static
64  Element<S, T> of(const S& s);
65  };
66 
67  template <class T>
68  struct zero_as
69  {
70  template <class S>
71  static
72  Element<S, T> of(const S& s);
73  };
74 
75  /*------------.
76  | word_traits |
77  `------------*/
78 
84  template <typename S, typename T>
85  struct word_traits
86  {
88  typedef undefined_type alphabet_t;
89 
91  typedef undefined_type word_t;
92 
94  typedef undefined_type first_monoid_t;
95 
97  typedef undefined_type second_monoid_t;
98 
100  typedef undefined_type first_projection_t;
101 
103  typedef undefined_type second_projection_t;
104  };
105 
109  } // algebra
110 
114  /*----------------------------------.
115  | dynamic_traits<MonoidBase<Self> > |
116  `----------------------------------*/
117 
118  template<class Self>
119  struct dynamic_traits<algebra::MonoidBase<Self> >
120  : dynamic_traits<algebra::SemigroupBase<Self> >
121  { };
122 
123  template<typename S>
124  struct virtual_types<algebra::MonoidBase<S> >
125  : virtual_types<algebra::SemigroupBase<S> >
126  { };
127 
128  /*---------------------------------.
129  | MetaElement<MonoidBase<Self>, T> |
130  `---------------------------------*/
131 
133  template<class Self, typename T>
134  struct MetaElement<algebra::MonoidBase<Self>, T>
135  : MetaElement<algebra::SemigroupBase<Self>, T>
136  {
137  protected:
139  MetaElement();
140 
142  MetaElement(const MetaElement& other);
143  };
144 
148  namespace algebra {
149 
150  template<typename T, typename Self>
151  T op_default(SELECTOR(algebra::MonoidBase<Self>), SELECTOR(T));
152 
153  } // algebra
154 
155 } // vcsn
156 
157 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
158 # include <vaucanson/algebra/concept/monoid_base.hxx>
159 # endif // VCSN_USE_INTERFACE_ONLY
160 
161 #endif // ! VCSN_ALGEBRA_CONCEPT_MONOID_BASE_HH