00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef VCSN_ALGEBRA_IMPLEMENTATION_FREE_MONOID_TOOLS_HH
00018 # define VCSN_ALGEBRA_IMPLEMENTATION_FREE_MONOID_TOOLS_HH
00019
00020 # include <vaucanson/algebra/concept/freemonoid_base.hh>
00021 # include <string>
00022 # include <list>
00023
00024 namespace vcsn {
00025
00026 namespace algebra {
00027
00028 template <typename L>
00029 struct list_or_string
00030 {
00031 typedef std::list<L> ret;
00032 };
00033
00034 template <>
00035 struct list_or_string<char>
00036 {
00037 typedef std::string ret;
00038 };
00039
00040 template <>
00041 struct list_or_string<wchar_t>
00042 {
00043 typedef std::basic_string<wchar_t> ret;
00044 };
00045
00046 template <typename A, typename B>
00047 struct list_or_string<std::pair<A,B> >
00048 {
00049 typedef std::basic_string<std::pair<A,B> > ret;
00050 };
00051
00052 template<typename A>
00053 const std::list<typename A::letter_t>&
00054 identity_value(SELECTOR(algebra::FreeMonoidBase<A>),
00055 SELECTOR(std::list<typename A::letter_t>));
00056
00057 template<typename A>
00058 std::list<typename A::letter_t>
00059 op_convert(SELECTOR(algebra::FreeMonoidBase<A>),
00060 SELECTOR(std::list<typename A::letter_t>),
00061 const typename A::letter_t& c);
00062
00063 template <typename A>
00064 void
00065 op_in_mul(const algebra::FreeMonoidBase<A>& s,
00066 std::list<typename A::letter_t>& dst,
00067 const std::list<typename A::letter_t>& src);
00068
00069 template <typename A>
00070 std::list<typename A::letter_t>
00071 op_mul(const algebra::FreeMonoidBase<A>& s,
00072 const std::list<typename A::letter_t>& a,
00073 const std::list<typename A::letter_t>& b);
00074
00075 }
00076
00077 }
00078
00080 #define USE_LETTERS(X...) \
00081 typedef X Letter; \
00082 typedef vcsn::algebra::AlphabetSet< Letter > Alphabets; \
00083 typedef vcsn::Element<Alphabets, std::set< Letter > > Alphabet; \
00084 typedef vcsn::algebra::AlphabetDecorator< Letter , std::set< Letter > > DAlphabetImpl; \
00085 typedef vcsn::Element<Alphabets, DAlphabetImpl> DAlphabet; \
00086 typedef vcsn::algebra::FreeMonoid<Alphabet> Words; \
00087 typedef vcsn::algebra::list_or_string< Letter >::ret WordValue; \
00088 typedef vcsn::Element<Words, WordValue> Word;
00089
00090 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
00091 # include <vaucanson/algebra/implementation/free_monoid/tools.hxx>
00092 #endif // VCSN_USE_INTERFACE_ONLY
00093
00094 #endif // ! VCSN_ALGEBRA_IMPLEMENTATION_FREE_MONOID_TOOLS_HH