Vaucanson  1.4.1
free_monoid.hh
1 // free_monoid.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, 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_IMPLEMENTATION_MONOID_FREE_MONOID_HH
18 # define VCSN_ALGEBRA_IMPLEMENTATION_MONOID_FREE_MONOID_HH
19 
20 # include <set>
21 
22 # include <vaucanson/algebra/concept/freemonoid_base.hh>
23 # include <vaucanson/algebra/implementation/monoid/monoid_rep.hh>
24 # include <vaucanson/misc/unique.hh>
25 # include <vaucanson/misc/usual_macros.hh>
26 
27 namespace vcsn
28 {
29  namespace algebra
30  {
34  /*--------------.
35  | FreeMonoid<A> |
36  `--------------*/
37 
39  template<typename A>
40  struct FreeMonoid
41  : FreeMonoidBase<FreeMonoid<A> >
42  {
43  // Type helpers.
44  typedef A alphabets_elt_t;
45  typedef MonoidRep<FreeMonoid<A> > monoid_rep_t;
46  typedef boost::shared_ptr<monoid_rep_t> shared_monoid_rep_t;
47 
50  FreeMonoid(const A& a);
51 
54  FreeMonoid(const A& a, monoid_rep_t mr);
55 
57  FreeMonoid(const FreeMonoid& w);
58 
60  const shared_monoid_rep_t representation() const;
61 
65  A& alphabet();
66 
68  const A& alphabet() const;
69 
70  public:
73  void set_representation(monoid_rep_t mr);
74 
75  protected:
76  shared_monoid_rep_t rep_;
77  A alph_;
78  };
79 
80  template<typename A>
81  bool operator==(const FreeMonoid<A>& a,
82  const FreeMonoid<A>& b);
83 
87  } // ! algebra
88 
92  /*-------------------------------.
93  | dynamic_traits<FreeMonoid<A> > |
94  `-------------------------------*/
96  template<typename A>
97  struct dynamic_traits<algebra::FreeMonoid<A> >
98  : dynamic_traits<algebra::FreeMonoidBase<algebra::FreeMonoid<A> > >
99  {
101  static const bool ret = A::dynamic;
102  };
103 
104  /*------------------------------.
105  | MetaElement<FreeMonoid<A>, T> |
106  `------------------------------*/
109  template<typename A, typename T>
110  struct MetaElement<algebra::FreeMonoid<A>, T>
111  : MetaElement<algebra::FreeMonoidBase<algebra::FreeMonoid<A> >, T>
112  {};
113 
117  template <class A>
118  struct virtual_types<algebra::FreeMonoid<A> >
119  : virtual_types<algebra::FreeMonoidBase<algebra::FreeMonoid<A> > >
120  {
121  typedef A alphabet_t;
122  };
123 
130  enum op_choose_max_word_length_t { op_choose_max_word_length = 32 };
131 
132 } // ! vcsn
133 
134 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
135 # include <vaucanson/algebra/implementation/monoid/free_monoid.hxx>
136 # endif // VCSN_USE_INTERFACE_ONLY
137 
138 #endif // ! VCSN_ALGEBRA_IMPLEMENTATION_MONOID_FREE_MONOID_HH