00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
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 
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 
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   } 
00088 
00092   
00093 
00094 
00095 
00097   template<typename S>
00098   struct dynamic_traits<algebra::AlphabetSetBase<S> >
00099     : dynamic_traits<Structure<S> >
00100   { };
00101 
00102   
00103 
00104 
00105 
00107   template<typename S>
00108   struct virtual_types<algebra::AlphabetSetBase<S> >
00109     : virtual_types<Structure<S> >
00110   { };
00111 
00112 
00113   
00114 
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 } 
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