Vaucanson  1.4.1
krat_exp_proxy.hxx
1 // krat_exp_proxy.hxx: this file is part of the Vaucanson project.
2 //
3 // Vaucanson, a generic library for finite state machines.
4 //
5 // Copyright (C) 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 
18 #ifndef VCSN_ALGEBRA_IMPLEMENTATION_SERIES_KRAT_EXP_PROXY_HXX
19 # define VCSN_ALGEBRA_IMPLEMENTATION_SERIES_KRAT_EXP_PROXY_HXX
20 
21 namespace vcsn {
22 
23  namespace algebra {
24 
25  template <class S, class T>
26  krat_exp_proxy<S, T>::krat_exp_proxy(Element<S, T> exp) :
27  self(exp)
28  {
29  }
30 
31  template <class S, class T>
32  krat_exp_virtual&
33  krat_exp_proxy<S, T>::operator=(krat_exp_virtual& exp)
34  {
35  self = (dynamic_cast<krat_exp_proxy<S, T>*> (&exp))->self;
36  return *this;
37  }
38 
39  template <class S, class T>
40  krat_exp_virtual*
41  krat_exp_proxy<S, T>::operator+(krat_exp_virtual* exp)
42  {
43  return new krat_exp_proxy<S, T>(self + (dynamic_cast<krat_exp_proxy<S, T>*> (exp))->self);
44  }
45 
46  template <class S, class T>
47  krat_exp_virtual*
48  krat_exp_proxy<S, T>::operator*(krat_exp_virtual* exp)
49  {
50  return new krat_exp_proxy<S, T>(self * (dynamic_cast<krat_exp_proxy<S, T>*> (exp))->self);
51  }
52 
53  template <class S, class T>
54  void
56  {
57  self.star();
58  }
59 
60  template <class S, class T>
61  void
62  krat_exp_proxy<S, T>::left_weight(semiring_virtual* sem)
63  {
64  self = (dynamic_cast<semiring_proxy<S, T>*> (sem))->self * self;
65  }
66 
67  template <class S, class T>
68  void
69  krat_exp_proxy<S, T>::right_weight(semiring_virtual* sem)
70  {
71  self = self * (dynamic_cast<semiring_proxy<S, T>*> (sem))->self;
72  }
73 
74  template <class S, class T>
75  semiring_proxy<S, T>::semiring_proxy(semiring_elt_t& sem) :
76  self(sem)
77  {
78  }
79 
80  template <class S, class T>
81  semiring_virtual&
82  semiring_proxy<S, T>::operator=(semiring_virtual& sem)
83  {
84  self = (dynamic_cast<semiring_proxy<S, T>*> (&sem))->self;
85  return *this;
86  }
87 
88  } // algebra
89 
90 } // vcsn
91 #endif // !VCSN_ALGEBRA_IMPLEMENTATION_SERIES_KRAT_EXP_PROXY_HXX //