00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef VCSN_ALGEBRA_CONCEPT_ALPHABETS_BASE_HH
00019 # define VCSN_ALGEBRA_CONCEPT_ALPHABETS_BASE_HH
00020
00026 # include <vaucanson/design_pattern/design_pattern.hh>
00027 # include <vaucanson/misc/container_ops.hh>
00028 # include <vaucanson/algebra/concept/letter.hh>
00029
00030 namespace vcsn {
00031
00032 namespace algebra {
00033
00037
00038
00039
00040
00052 template<class S>
00053 struct AlphabetSetBase
00054 : Structure<S>
00055 {
00056 protected:
00057
00059
00060 AlphabetSetBase();
00061 AlphabetSetBase(const AlphabetSetBase& other);
00063 };
00064
00065
00066
00067
00068
00076 template<typename S, typename T>
00077 struct alphabet_traits
00078 {
00080 typedef undefined_type letter_t;
00081
00083 static const bool dynamic_data = false;
00084 };
00085
00089 }
00090
00094
00095
00096
00097
00099 template<typename S>
00100 struct dynamic_traits<algebra::AlphabetSetBase<S> >
00101 : dynamic_traits<Structure<S> >
00102 { };
00103
00104
00105
00106
00107
00109 template<typename S>
00110 struct virtual_types<algebra::AlphabetSetBase<S> >
00111 : virtual_types<Structure<S> >
00112 { };
00113
00114
00115
00116
00117
00118
00124 template<class S, typename T>
00125 struct MetaElement<algebra::AlphabetSetBase<S>, T>
00126 : MetaElement<Structure<S>, T>
00127 {
00128
00130 typedef typename algebra::alphabet_traits<S, T>::letter_t letter_t;
00131
00133 typedef typename op_begin_traits<S, T>::const_ret_t const_iterator;
00134
00136 typedef typename op_begin_traits<S, T>::ret_t iterator;
00137
00139 void insert(const letter_t& l);
00140
00142 void insert(const std::string& lit);
00143
00145 letter_t choose() const;
00146
00148 letter_t random_letter() const;
00149
00151 size_t size() const;
00152
00154 size_t max_size() const;
00155
00157 bool letter_equality(letter_t, letter_t) const;
00158
00160 bool contains(const letter_t& l) const;
00161
00163 bool is_finite() const;
00164
00166
00167 iterator begin();
00168 const_iterator begin() const;
00170
00172
00173 iterator end();
00174 const_iterator end() const;
00176
00177 protected:
00179
00180 MetaElement();
00181 MetaElement(const MetaElement& other);
00183 };
00184
00185 namespace algebra {
00186
00188 template<typename S, typename St, typename T>
00189 St& op_rout(const algebra::AlphabetSetBase<S>& s, St& st, const T& a);
00190
00192 template <typename S, typename T, typename L>
00193 bool op_letter_equality(const algebra::AlphabetSetBase<S>& s,
00194 const T& a,
00195 L lhs,
00196 L rhs);
00197 }
00198
00202 }
00203
00204 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
00205 # include <vaucanson/algebra/concept/alphabets_base.hxx>
00206 # endif // VCSN_USE_INTERFACE_ONLY
00207
00208 #endif // ! VCSN_ALGEBRA_CONCEPT_ALPHABETS_BASE_HH