Vaucanson 1.4
|
00001 // kinds.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, 2006 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_AUTOMATA_CONCEPT_KINDS_HH 00018 # define VCSN_AUTOMATA_CONCEPT_KINDS_HH 00019 00020 # include <vaucanson/config/system.hh> 00021 # include <iterator> 00022 # include <vaucanson/misc/contract.hh> 00023 # include <algorithm> 00024 00025 # include <vaucanson/algebra/concept/series_base.hh> 00026 # include <vaucanson/design_pattern/design_pattern.hh> 00027 # include <vaucanson/automata/concept/handlers.hh> 00028 00029 namespace vcsn { 00030 00031 template < 00032 typename Kind, 00033 typename Self, 00034 typename Series, 00035 typename SeriesT, 00036 typename LabelT 00037 > 00038 class AutoKind {}; 00039 00040 namespace delta_kind { 00041 00042 struct transitions 00043 {}; 00044 00045 struct states 00046 {}; 00047 00048 } // delta_kind 00049 00050 00051 struct labels_are_series 00052 {}; 00053 00054 template < 00055 typename Series, 00056 typename MonoidElt, 00057 typename SemiringElt, 00058 typename L 00059 > 00060 struct ls_delta_letter_query 00061 { 00062 ls_delta_letter_query(const Series& s, const L& l); 00063 00064 template<typename Label> 00065 bool operator()(const Label& label) const; 00066 00067 protected: 00068 SetSlot<Series> s_; 00069 typename MonoidElt::value_t l_; 00070 }; 00071 00072 /*--------------------------------. 00073 | AutoKind<labels_are_series ...> | 00074 `--------------------------------*/ 00076 00082 template < 00083 typename Self, 00084 typename Series, 00085 typename SeriesT, 00086 typename LabelT 00087 > 00088 class AutoKind<labels_are_series, Self, Series, SeriesT, LabelT> 00089 { 00090 protected: 00091 typedef typename Self::hstate_t hstate_t; 00092 typedef typename Self::htransition_t htransition_t; 00093 typedef Element<Series, SeriesT> series_set_elt_t; 00094 typedef typename Series::monoid_t monoid_t; 00095 typedef typename series_set_elt_t::monoid_elt_t monoid_elt_t; 00096 typedef typename Series::semiring_t semiring_t; 00097 typedef typename series_set_elt_t::semiring_elt_t semiring_elt_t; 00098 00099 public: 00100 00101 series_set_elt_t series_of(htransition_t e) const; 00102 00103 const SeriesT& series_value_of(htransition_t e) const; 00104 00105 bool is_spontaneous(htransition_t e) const; 00106 00107 template<typename L> 00108 L letter_of(SELECTOR(L), htransition_t e) const; 00109 00110 monoid_elt_t word_of(htransition_t e) const; 00111 00112 const typename monoid_elt_t::value_t& word_value_of(htransition_t e) const; 00113 00114 template<typename S> 00115 htransition_t add_series_transition(hstate_t from, hstate_t to, 00116 const S& e); 00117 00118 htransition_t add_spontaneous(hstate_t from, hstate_t to); 00119 00120 template<typename L> 00121 htransition_t add_letter_transition(hstate_t from, hstate_t to, 00122 const L& l); 00123 00124 protected: 00125 Self& auto_self(); 00126 const Self& auto_self() const; 00127 }; 00128 00129 } 00130 00131 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB 00132 # include <vaucanson/automata/concept/kinds.hxx> 00133 #endif // VCSN_USE_INTERFACE_ONLY 00134 00135 00136 #endif // ! VCSN_AUTOMATA_CONCEPT_KINDS_HH