alphabets_base.hh

Go to the documentation of this file.
00001 // alphabets_base.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_CONCEPT_ALPHABETS_BASE_HH
00018 # define VCSN_ALGEBRA_CONCEPT_ALPHABETS_BASE_HH
00019 
00025 # include <vaucanson/design_pattern/design_pattern.hh>
00026 # include <vaucanson/misc/container_ops.hh>
00027 
00028 namespace vcsn {
00029 
00030   namespace algebra {
00031 
00035     /*----------------------.
00036     | AlphabetSetBase<Self> |
00037     `----------------------*/
00038 
00050     template<class S>
00051     struct AlphabetSetBase
00052       : Structure<S>
00053     {
00054     protected:
00055 
00057 
00058       AlphabetSetBase();
00059       AlphabetSetBase(const AlphabetSetBase& other);
00061     };
00062 
00063     /*----------------.
00064     | alphabet_traits |
00065     `----------------*/
00066 
00074     template<typename S, typename T>
00075     struct alphabet_traits
00076     {
00078       typedef undefined_type    letter_t;
00079 
00081       static const bool dynamic_data = false;
00082     };
00083 
00087   } // algebra
00088 
00092   /*---------------.
00093   | dynamic_traits |
00094   `---------------*/
00095 
00097   template<typename S>
00098   struct dynamic_traits<algebra::AlphabetSetBase<S> >
00099     : dynamic_traits<Structure<S> >
00100   { };
00101 
00102   /*--------------.
00103   | virtual_types |
00104   `--------------*/
00105 
00107   template<typename S>
00108   struct virtual_types<algebra::AlphabetSetBase<S> >
00109     : virtual_types<Structure<S> >
00110   { };
00111 
00112 
00113   /*--------------------------------------.
00114   | MetaElement<AlphabetSetBase<Self>, T> |
00115   `--------------------------------------*/
00116 
00122   template<class S, typename T>
00123   struct MetaElement<algebra::AlphabetSetBase<S>, T>
00124     : MetaElement<Structure<S>, T>
00125   {
00126 
00128     typedef typename algebra::alphabet_traits<S, T>::letter_t letter_t;
00129 
00131     typedef typename op_begin_traits<S, T>::const_ret_t const_iterator;
00132 
00134     typedef typename op_begin_traits<S, T>::ret_t iterator;
00135 
00137     void insert(const letter_t& l);
00138 
00140     letter_t choose() const;
00141 
00143     letter_t    random_letter() const;
00144 
00146     size_t size()                      const;
00147 
00149     size_t max_size()                   const;
00150 
00152     bool letter_equality(letter_t, letter_t) const;
00153 
00155     bool contains(const letter_t& l) const;
00156 
00158     bool is_finite() const;
00159 
00161 
00162     iterator begin();
00163     const_iterator begin() const;
00165 
00167 
00168     iterator end();
00169     const_iterator end() const;
00171 
00172   protected:
00174 
00175     MetaElement();
00176     MetaElement(const MetaElement& other);
00178   };
00179 
00181   template<typename S, typename St, typename T>
00182   St& op_rout(const algebra::AlphabetSetBase<S>& s, St& st, const T& a);
00183 
00185   template <typename S, typename T, typename L>
00186   bool op_letter_equality(const algebra::AlphabetSetBase<S>& s,
00187                           const T& a,
00188                           L lhs,
00189                           L rhs);
00190 
00194 } // vcsn
00195 
00196 # ifndef VCSN_USE_INTERFACE_ONLY
00197 #  include <vaucanson/algebra/concept/alphabets_base.hxx>
00198 # endif // VCSN_USE_INTERFACE_ONLY
00199 
00200 #endif // ! VCSN_ALGEBRA_CONCEPT_ALPHABETS_BASE_HH

Generated on Sat Jul 29 17:12:58 2006 for Vaucanson by  doxygen 1.4.6