Vaucanson 1.4
|
00001 // composition_cover.hxx: this file is part of the Vaucanson project. 00002 // 00003 // Vaucanson, a generic library for finite state machines. 00004 // 00005 // Copyright (C) 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_ALGORITHMS_COMPOSITION_COVER_HXX 00018 # define VCSN_ALGORITHMS_COMPOSITION_COVER_HXX 00019 00031 # include <vaucanson/algorithms/internal/outsplitting.hh> 00032 # include <vaucanson/algorithms/composition_cover.hh> 00033 # include <vaucanson/algebra/concept/freemonoid_product.hh> 00034 # include <vaucanson/automata/concept/automata.hh> 00035 00036 00037 namespace vcsn { 00038 00039 template <typename S, typename M1, typename M2, typename Auto_t> 00040 void 00041 do_composition_cover (const AutomataBase<S>&, 00042 const algebra::FreeMonoidProduct<M1, M2>&, 00043 const Auto_t& fmp, 00044 Auto_t& ret) 00045 { 00046 BENCH_TASK_SCOPED("composition_cover"); 00047 AUTOMATON_TYPES(Auto_t); 00048 ret = splitting::outsplitting (fmp); 00049 } 00050 00051 00052 template <typename S, typename M1, typename M2, typename Auto_t> 00053 void 00054 do_composition_co_cover (const AutomataBase<S>&, 00055 const algebra::FreeMonoidProduct<M1, M2>&, 00056 const Auto_t& fmp, 00057 Auto_t& ret) 00058 { 00059 BENCH_TASK_SCOPED("composition_co_cover"); 00060 AUTOMATON_TYPES(Auto_t); 00061 ret = splitting::insplitting (fmp); 00062 } 00063 00064 00065 00067 00068 template <typename S, typename T> 00069 Element<S, T> 00070 composition_cover (const Element<S, T>& fmp) 00071 { 00072 typedef Element<S, T> auto_t; 00073 AUTOMATON_TYPES(auto_t); 00074 00075 auto_t ret (fmp.structure()); 00076 00077 do_composition_cover (fmp.structure(), 00078 fmp.structure().series().monoid(), 00079 fmp, 00080 ret); 00081 return ret; 00082 } 00083 00084 00085 template <typename S, typename T> 00086 void 00087 composition_cover (const Element<S, T>& fmp, 00088 Element<S, T>& ret) 00089 { 00090 typedef Element<S, T> auto_t; 00091 AUTOMATON_TYPES(auto_t); 00092 00093 for_all_states (s, ret) 00094 ret.del_states (*s); 00095 do_composition_cover (fmp.structure(), 00096 fmp.structure().series().monoid(), 00097 fmp, 00098 ret); 00099 } 00100 00101 00103 00104 template <typename S, typename T> 00105 Element<S, T> 00106 composition_co_cover (const Element<S, T>& fmp) 00107 { 00108 typedef Element<S, T> auto_t; 00109 AUTOMATON_TYPES(auto_t); 00110 00111 automaton_t ret(fmp.structure()); 00112 00113 do_composition_co_cover (fmp.structure(), 00114 fmp.structure().series().monoid(), 00115 fmp, 00116 ret); 00117 return ret; 00118 } 00119 00120 00121 template <typename S, typename T> 00122 void 00123 composition_co_cover (const Element<S, T>& fmp, 00124 Element<S, T>& ret) 00125 { 00126 typedef Element<S, T> auto_t; 00127 AUTOMATON_TYPES(auto_t); 00128 00129 for_all_states (s, ret) 00130 ret.del_states (*s); 00131 do_composition_cover (fmp.structure(), 00132 fmp.structure().series().monoid(), 00133 fmp, 00134 ret); 00135 } 00136 00137 } 00138 00139 #endif // ! VCSN_ALGORITHMS_COMPOSITION_COVER_HXX