- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

# 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, 2007 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   namespace algebra {
    00130
    00131     template<typename L, typename T>
    00132     bool op_contains(const algebra::AlphabetSet<L>& s,
    00133                      const algebra::AlphabetDecorator<L, T>& a);
    00134
    00135     template<typename L, typename T>
    00136     bool op_is_finite(const algebra::AlphabetSet<L>& s,
    00137                       const algebra::AlphabetDecorator<L, T>& a);
    00138
    00139     template<typename L, typename T>
    00140     bool op_contains_e(const algebra::AlphabetSet<L>& s,
    00141                        const algebra::AlphabetDecorator<L, T>& a,
    00142                        const L& v);
    00143
    00144     template <typename T, typename L>
    00145     bool op_letter_equality(const algebra::AlphabetSet<L>& s,
    00146                                    const algebra::AlphabetDecorator<L, T>& a,
    00147                                    L lhs,
    00148                                    L rhs);
    00149
    00150   } // algebra
    00151
    00152 } // vcsn
    00153
    00154 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
    00155 #  include <vaucanson/algebra/implementation/alphabets/decorated_alphabet.hxx>
    00156 # endif // VCSN_USE_INTERFACE_ONLY
    00157
    00158 #endif // ! VCSN_ALGEBRA_IMPLEMENTATION_ALPHABETS_DECORATED_ALPHABET_HH