realtime.hxx

00001 // realtime.hxx: 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 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_REALTIME_HXX
00018 # define VCSN_ALGORITHMS_REALTIME_HXX
00019 
00020 # include <vaucanson/algorithms/realtime.hh>
00021 
00022 # include <vaucanson/algorithms/forward_realtime.hh>
00023 # include <vaucanson/algorithms/backward_realtime.hh>
00024 
00025 namespace vcsn {
00026 
00027   /*------------.
00028   | is_realtime |
00029   `------------*/
00030   template <class A_, typename Auto_>
00031   bool
00032   do_is_realtime(const AutomataBase<A_>&,
00033                  const Auto_&              a)
00034   {
00035     for (typename Auto_::transition_iterator e = a.transitions().begin();
00036          e != a.transitions().end();
00037          ++e)
00038       if (a.series_of(*e) ==
00039           a.structure().series().
00040           identity(SELECT(typename Auto_::series_set_elt_value_t)))
00041         return false;
00042     return true;
00043   }
00044 
00045 
00046   /*--------------.
00047   | realtime_here |
00048   `--------------*/
00049 
00050   template<typename Auto_, typename A_>
00051   void
00052   do_realtime_here(const AutomataBase<A_>&,
00053                    Auto_& a,
00054                    realtime_type type = forward)
00055   {
00056     if (type == forward)
00057       return forward_realtime_here(a);
00058     else
00059       return backward_realtime_here(a);
00060   }
00061 
00062 
00063   template<typename A, typename T>
00064   void
00065   realtime_here(Element<A, T>& a, realtime_type type)
00066   {
00067     return do_realtime_here(a.structure(), a, type);
00068   }
00069 
00070   /*---------.
00071   | realtime |
00072   `---------*/
00073 
00074   template<typename Auto_, typename A_>
00075   Auto_
00076   do_realtime(const AutomataBase<A_>&,
00077               const Auto_& a,
00078               realtime_type type = forward)
00079   {
00080     if (type == forward)
00081       return forward_realtime(a);
00082     else
00083       return backward_realtime(a);
00084   }
00085 
00086   template<typename A, typename T>
00087   Element<A, T>
00088   realtime(const Element<A, T>& a, realtime_type type)
00089   {
00090     return do_realtime(a.structure(), a, type);
00091   }
00092 
00093 } // vcsn
00094 
00095 #endif // ! VCSN_ALGORITHMS_REALTIME_HXX

Generated on Sat Jul 29 17:13:10 2006 for Vaucanson by  doxygen 1.4.6