Vaucanson  1.4.1
series.hh
1 // series.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_SERIES_SERIES_HH
18 # define VCSN_ALGEBRA_IMPLEMENTATION_SERIES_SERIES_HH
19 
20 # include <vaucanson/algebra/concept/series_base.hh>
21 # include <vaucanson/algebra/implementation/series/series_rep.hh>
23 
24 
25 namespace vcsn
26 {
27  namespace algebra
28  {
29  /*-------------------------.
30  | Series<Semiring, Monoid> |
31  `-------------------------*/
32 
33  struct semiring_slot_tag {};
34  struct monoid_slot_tag {};
35 
38  template<typename Semiring, typename Monoid>
39  struct Series
40  : SeriesBase<Series<Semiring, Monoid> >,
41  private SetSlot<Semiring, semiring_slot_tag>,
42  private SetSlot<Monoid, monoid_slot_tag>
43  {
44  typedef SeriesRep<Semiring, Monoid> series_rep_t;
45  typedef boost::shared_ptr<series_rep_t> shared_series_rep_t;
46 
47  Series(const Semiring& w, const Monoid& m);
48  Series(const Semiring& w, const Monoid& m, const series_rep_t& sr);
49  Series(const Series& other);
50 
51  const Semiring& semiring() const;
52 
53  const Monoid& monoid() const;
54 
55  const shared_series_rep_t representation() const;
56 
57  bool operator==(const Series<Semiring, Monoid>&) const;
58 
59  protected:
60  shared_series_rep_t rep_;
61  };
62 
63  template <class W, class M, class NewW, class NewM>
64  struct mute_series_traits<Series<W, M>, NewW, NewM >
65  {
66  typedef Series<NewW, NewM> ret;
67  };
68 
69  template <class W, class M, class NewW, class NewM>
70  typename mute_series_traits<Series<W, M>, NewW, NewM >::ret
71  mute_series(const Series<W, M>& s, const NewW& w, const NewM& m);
72 
73  } // algebra
74 
75  /*-----------------------------.
76  | MetaElement<Series<W, M>, T> |
77  `-----------------------------*/
78 
80  template <class W, class M, class T>
81  struct MetaElement<algebra::Series<W, M>, T> :
82  public MetaElement<algebra::SeriesBase<algebra::Series<W, M> >, T>
83  { };
84 
85  /*-----------------------------.
86  | dynamic_traits<Series<W, M>> |
87  `-----------------------------*/
88 
90  template<typename W, typename M>
91  struct dynamic_traits<algebra::Series<W, M> >
92  : dynamic_traits<algebra::SeriesBase<algebra::Series<W, M> > >
93  {
94  static const bool ret =
95  dynamic_traits<W>::ret || dynamic_traits<M>::ret;
96 
97  };
98 
99  /*----------------------------.
100  | virtual_types<Series<W, N>> |
101  `----------------------------*/
102 
104  template<typename W, typename M>
105  struct virtual_types<algebra::Series<W, M> >
106  : virtual_types<algebra::SeriesBase<algebra::Series<W, M> > >
107  {
108  typedef W semiring_t;
109  typedef M monoid_t;
110  };
111 
112 } // vcsn
113 
114 
115 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
116 # include <vaucanson/algebra/implementation/series/series.hxx>
117 #endif // VCSN_USE_INTERFACE_ONLY
118 
119 
120 #endif // ! VCSN_ALGEBRA_IMPLEMENTATION_SERIES_SERIES_HH