Vaucanson 1.4
|
00001 // suffix.hxx: this file is part of the Vaucanson project. 00002 // 00003 // Vaucanson, a generic library for finite state machines. 00004 // 00005 // Copyright (C) 2011 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_SUFFIX_HXX 00018 # define VCSN_ALGORITHMS_SUFFIX_HXX 00019 00020 # include <vaucanson/algorithms/suffix.hh> 00021 00022 # include <vaucanson/automata/concept/automata_base.hh> 00023 # include <vaucanson/algorithms/realtime.hh> 00024 # include <vaucanson/automata/implementation/transpose_view.hh> 00025 # include <vaucanson/misc/usual_macros.hh> 00026 # include <vaucanson/algorithms/is_trim.hh> 00027 00028 namespace vcsn { 00029 00030 /*--------------. 00031 | suffix_here | 00032 `--------------*/ 00033 00034 template<typename A, typename AI> 00035 void 00036 suffix_here (Element<A, AI>& a) 00037 { 00038 precondition(is_realtime(a)); 00039 precondition(is_trim(a)); 00040 00041 typedef Element<A, AI> automaton_t; 00042 AUTOMATON_TYPES (automaton_t); 00043 00044 for_all_states (i, a) 00045 a.set_initial (*i); 00046 } 00047 00048 /*---------. 00049 | suffix | 00050 `---------*/ 00051 00052 template<typename A, typename AI> 00053 Element<A, AI> 00054 suffix (const Element<A, AI>& a) 00055 { 00056 Element<A, AI> res (a); 00057 suffix_here (res); 00058 return (res); 00059 } 00060 00061 } // vcsn 00062 00063 #endif // !VCSN_ALGORITHMS_SUFFIX_HXX