decorated_alphabet.hh

00001 // decorated_alphabet.hh: this file is part of the Vaucanson project.
00002 //
00003 // Vaucanson, a generic library for finite state machines.
00004 //
00005 // Copyright (C) 2001, 2002, 2003, 2004, 2005 The Vaucanson Group.
00006 //
00007 // This program is free software; you can redistribute it and/or
00008 // modify it under the terms of the GNU General Public License
00009 // as published by the Free Software Foundation; either version 2
00010 // of the License, or (at your option) any later version.
00011 //
00012 // The complete GNU General Public Licence Notice can be found as the
00013 // `COPYING' file in the root directory.
00014 //
00015 // The Vaucanson Group consists of people listed in the `AUTHORS' file.
00016 //
00017 #ifndef VCSN_ALGEBRA_IMPLEMENTATION_ALPHABETS_DECORATED_ALPHABET_HH
00018 # define VCSN_ALGEBRA_IMPLEMENTATION_ALPHABETS_DECORATED_ALPHABET_HH
00019 
00020 # include <vaucanson/algebra/implementation/alphabets/alphabets.hh>
00021 
00022 namespace vcsn {
00023 
00024   namespace algebra {
00025 
00029     /*------------------------.
00030     | AlphabetDecorator<L, T> |
00031     `------------------------*/
00032 
00049     template <class L, class T>
00050     class AlphabetDecorator
00051     {
00052     public:
00053       typedef L         letter_t;
00054       typedef T         alphabet_impl_t;
00055       typedef typename T::const_iterator const_iterator;
00056       typedef typename T::iterator iterator;
00057 
00058       AlphabetDecorator();
00059       AlphabetDecorator(alphabet_impl_t& alphabet);
00060       ~AlphabetDecorator();
00061 
00062       letter_t joker() const;
00063       letter_t other() const;
00064       void insert(L);
00065       unsigned size() const;
00066       iterator begin();
00067       iterator end();
00068       const_iterator begin() const;
00069       const_iterator end() const;
00070       alphabet_impl_t& alphabet();
00071       const alphabet_impl_t& alphabet() const;
00072 
00073     private:
00074       alphabet_impl_t* alphabet_;
00075       letter_t         joker_;
00076       letter_t         other_;
00077       bool             alphabet_owner_;
00078     };
00079 
00080 
00081     /*---------------------------------------------------------.
00082     | alphabet_traits<AlphabetSet<L>, AlphabetDecorator<L, T>> |
00083     `---------------------------------------------------------*/
00084 
00086     template<typename L, typename T>
00087     struct alphabet_traits<AlphabetSet<L>, AlphabetDecorator<L, T> >
00088     {
00090       typedef L                 letter_t;
00091     };
00092 
00096   } // algebra
00097 
00101   /*-----------------------------------------------------.
00102   | MetaElement<AlphabetSet<L>, AlphabetDecorator<L, T>> |
00103   `-----------------------------------------------------*/
00104 
00110   template<typename L, typename T>
00111   struct MetaElement<algebra::AlphabetSet<L>, algebra::AlphabetDecorator<L, T> >
00112     : MetaElement<algebra::AlphabetSetBase<algebra::AlphabetSet<L> >,
00113                   algebra::AlphabetDecorator<L, T> >
00114   {
00116     static const bool dynamic_value =
00117     MetaElement<algebra::AlphabetSet<L>,T >::dynamic_value;
00118 
00120     L   joker() const;
00121 
00123     L   other() const;
00124   };
00125 
00129   template<typename L, typename T>
00130   bool op_contains(const algebra::AlphabetSet<L>& s,
00131                    const algebra::AlphabetDecorator<L, T>& a);
00132 
00133   template<typename L, typename T>
00134   bool op_is_finite(const algebra::AlphabetSet<L>& s,
00135                     const algebra::AlphabetDecorator<L, T>& a);
00136 
00137   template<typename L, typename T>
00138   bool op_contains_e(const algebra::AlphabetSet<L>& s,
00139                      const algebra::AlphabetDecorator<L, T>& a,
00140                      const L& v);
00141 
00142   template <typename T, typename L>
00143   bool op_letter_equality(const algebra::AlphabetSet<L>& s,
00144                                  const algebra::AlphabetDecorator<L, T>& a,
00145                                  L lhs,
00146                                  L rhs);
00147 
00148 
00149 } // vcsn
00150 
00151 # ifndef VCSN_USE_INTERFACE_ONLY
00152 #  include <vaucanson/algebra/implementation/alphabets/decorated_alphabet.hxx>
00153 # endif // VCSN_USE_INTERFACE_ONLY
00154 
00155 #endif // ! VCSN_ALGEBRA_IMPLEMENTATION_ALPHABETS_DECORATED_ALPHABET_HH

Generated on Fri Jul 28 12:18:30 2006 for Vaucanson by  doxygen 1.4.6