00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef VCSN_MISC_HASH_HH_
00019 # define VCSN_MISC_HASH_HH_
00020
00021 # include <cstddef>
00022 # include <vaucanson/algebra/implementation/series/polynoms.hh>
00023 # include <vaucanson/algebra/implementation/series/rat/exp.hh>
00024 # include <vaucanson/automata/concept/handlers.hh>
00025 # include <boost/functional/hash/hash.hpp>
00026 # include <boost/shared_ptr.hpp>
00027
00028 namespace vcsn
00029 {
00030 namespace misc
00031 {
00032 template <typename T>
00033 struct hash_label;
00034
00035 template <>
00036 struct hash_label<char>
00037 {
00038 std::size_t operator() (const char) const;
00039 };
00040
00041 template <>
00042 struct hash_label<int>
00043 {
00044 std::size_t operator() (const int) const;
00045 };
00046
00047 template <typename Word, typename Weight>
00048 struct hash_label<algebra::polynom<Word, Weight> >
00049 {
00050 std::size_t operator() (const algebra::polynom<Word, Weight>& l) const;
00051 };
00052
00053 template <typename Weight, typename T, typename U>
00054 struct hash_label<algebra::polynom<std::pair<T, U>, Weight> >
00055 {
00056 std::size_t operator() (const algebra::polynom<std::pair<T, U>, Weight>& l) const;
00057 };
00058
00059 template <typename Word, typename Word2, typename WeightT>
00060 struct hash_label<algebra::polynom<Word, rat::exp<Word2, WeightT> > >
00061 {
00062 std::size_t operator() (const algebra::polynom<Word, rat::exp<Word2, WeightT> >& l) const;
00063 std::size_t operator() (const rat::exp<Word2, WeightT>& l) const;
00064 };
00065
00066 #if 0
00067 template <typename Word, typename LetterT, typename WeightT>
00068 struct hash_label<algebra::polynom<Word, rat::exp<LetterT, WeightT> > >
00069 {
00070 std::size_t operator() (const algebra::polynom<Word, rat::exp<LetterT, WeightT> >& l) const;
00071 };
00072 #endif
00073
00074
00075
00076
00077
00078
00079
00080
00081 template <typename Word, typename Weight>
00082 struct hash_label<rat::exp<Word, Weight> >
00083 {
00084 std::size_t operator() (const rat::exp<Word, Weight>& l) const;
00085 };
00086
00087 template <typename T>
00088 struct hash_handler;
00089
00090 template <typename Kind, typename Type>
00091 struct hash_handler<handler<Kind, Type> >
00092 {
00093 std::size_t operator() (const handler<Kind, Type>& h) const;
00094 };
00095
00096 template<>
00097 struct hash_handler<char>
00098 {
00099 std::size_t operator() (const char h) const;
00100 };
00101
00102 struct hash_state_handler
00103 {
00104 inline std::size_t operator() (const handler<state_h, std::size_t*>& h) const
00105 {
00106 return ::boost::hash_value (reinterpret_cast<std::size_t>(h.value()));
00107 }
00108
00109 inline std::size_t operator() (const boost::shared_ptr<std::size_t>& h) const
00110 {
00111 return ::boost::hash_value (reinterpret_cast<std::size_t>(h.get()));
00112 }
00113
00114 inline std::size_t operator() (const std::size_t* h) const
00115 {
00116 return ::boost::hash_value (reinterpret_cast<std::size_t>(h));
00117 }
00118 };
00119
00120 }
00121 }
00122
00123 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
00124 # include <vaucanson/misc/hash.hxx>
00125 # endif // ! VCSN_USE_INTERFACE_ONLY || VCSN_USE_LIB
00126
00127 #endif // ! VCSN_MISC_HASH_HH_ //