Vaucanson  1.4.1
decorated_alphabet.hh
1 // decorated_alphabet.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, 2007 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_ALPHABETS_DECORATED_ALPHABET_HH
18 # define VCSN_ALGEBRA_IMPLEMENTATION_ALPHABETS_DECORATED_ALPHABET_HH
19 
20 # include <vaucanson/algebra/implementation/alphabets/alphabets.hh>
21 
22 namespace vcsn {
23 
24  namespace algebra {
25 
29  /*------------------------.
30  | AlphabetDecorator<L, T> |
31  `------------------------*/
32 
49  template <class L, class T>
51  {
52  public:
53  typedef L letter_t;
54  typedef T alphabet_impl_t;
55  typedef typename T::const_iterator const_iterator;
56  typedef typename T::iterator iterator;
57 
59  AlphabetDecorator(alphabet_impl_t& alphabet);
61 
62  letter_t joker() const;
63  letter_t other() const;
64  void insert(L);
65  unsigned size() const;
66  iterator begin();
67  iterator end();
68  const_iterator begin() const;
69  const_iterator end() const;
70  alphabet_impl_t& alphabet();
71  const alphabet_impl_t& alphabet() const;
72 
73  private:
74  alphabet_impl_t* alphabet_;
75  letter_t joker_;
76  letter_t other_;
77  bool alphabet_owner_;
78  };
79 
80 
81  /*---------------------------------------------------------.
82  | alphabet_traits<AlphabetSet<L>, AlphabetDecorator<L, T>> |
83  `---------------------------------------------------------*/
84 
86  template<typename L, typename T>
88  {
90  typedef L letter_t;
91  };
92 
96  } // algebra
97 
101  /*-----------------------------------------------------.
102  | MetaElement<AlphabetSet<L>, AlphabetDecorator<L, T>> |
103  `-----------------------------------------------------*/
104 
110  template<typename L, typename T>
111  struct MetaElement<algebra::AlphabetSet<L>, algebra::AlphabetDecorator<L, T> >
112  : MetaElement<algebra::AlphabetSetBase<algebra::AlphabetSet<L> >,
113  algebra::AlphabetDecorator<L, T> >
114  {
116  static const bool dynamic_value =
117  MetaElement<algebra::AlphabetSet<L>,T >::dynamic_value;
118 
120  L joker() const;
121 
123  L other() const;
124  };
125 
129  namespace algebra {
130 
131  template<typename L, typename T>
132  bool op_contains(const algebra::AlphabetSet<L>& s,
134 
135  template<typename L, typename T>
136  bool op_is_finite(const algebra::AlphabetSet<L>& s,
138 
139  template<typename L, typename T>
140  bool op_contains_e(const algebra::AlphabetSet<L>& s,
142  const L& v);
143 
144  template <typename T, typename L>
147  L lhs,
148  L rhs);
149 
150  } // algebra
151 
152 } // vcsn
153 
154 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
155 # include <vaucanson/algebra/implementation/alphabets/decorated_alphabet.hxx>
156 # endif // VCSN_USE_INTERFACE_ONLY
157 
158 #endif // ! VCSN_ALGEBRA_IMPLEMENTATION_ALPHABETS_DECORATED_ALPHABET_HH