tools.hxx

00001 // tools.hxx: this file is part of the Vaucanson project.
00002 //
00003 // Vaucanson, a generic library for finite state machines.
00004 //
00005 // Copyright (C) 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_ALGEBRA_IMPLEMENTATION_FREE_MONOID_TOOLS_HXX
00018 # define VCSN_ALGEBRA_IMPLEMENTATION_FREE_MONOID_TOOLS_HXX
00019 
00020 # include <vaucanson/algebra/implementation/free_monoid/tools.hh>
00021 
00022 namespace vcsn
00023 {
00024 
00025   template<typename A>
00026   const std::list<typename A::letter_t>&
00027   identity_value(SELECTOR(algebra::FreeMonoidBase<A>),
00028                  SELECTOR(std::list<typename A::letter_t>))
00029   {
00030     static const std::list<typename A::letter_t> instance;
00031     return instance;
00032   }
00033 
00034   template<typename A>
00035   std::list<typename A::letter_t>
00036   op_convert(SELECTOR(algebra::FreeMonoidBase<A>),
00037              SELECTOR(std::list<typename A::letter_t>),
00038              const typename A::letter_t& c)
00039   {
00040     std::list<typename A::letter_t> l;
00041     l.push_back(c);
00042     return l;
00043   }
00044 
00045   template <typename A>
00046   void
00047   op_in_mul(const algebra::FreeMonoidBase<A>& s,
00048             std::list<typename A::letter_t>& dst,
00049             const std::list<typename A::letter_t>& src)
00050   {
00051     typedef typename std::list<typename A::letter_t>::const_iterator it_t;
00052     for (it_t i = src.begin();
00053          i != src.end();
00054          i++)
00055       dst.push_back(*i);
00056   }
00057 
00058   template <typename A>
00059   std::list<typename A::letter_t>
00060   op_mul(const algebra::FreeMonoidBase<A>& s,
00061          const std::list<typename A::letter_t>& a,
00062          const std::list<typename A::letter_t>& b)
00063   {
00064     typedef typename std::list<typename A::letter_t>::const_iterator it_t;
00065     std::list<typename A::letter_t> ret(a);
00066     op_in_mul(s, ret, b);
00067     return ret;
00068   }
00069 
00070 } // vcsn
00071 
00072 #endif // ! VCSN_ALGEBRA_IMPLEMENTATION_FREE_MONOID_TOOLS_HXX

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