monoid_base.hh

00001 // monoid_base.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 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_CONCEPT_MONOID_BASE_HH
00018 # define VCSN_ALGEBRA_CONCEPT_MONOID_BASE_HH
00019 
00020 # include <vaucanson/algebra/concept/semigroup_base.hh>
00021 
00022 namespace vcsn {
00023 
00024   namespace algebra {
00025 
00029     /*-----------------.
00030     | MonoidBase<Self> |
00031     `-----------------*/
00032 
00039     template<class Self>
00040     struct MonoidBase : SemigroupBase<Self>
00041     {
00043       template<typename T>
00044       Element<Self, T> identity(SELECTOR(T)) const;
00045 
00047       template<typename T>
00048       Element<Self, T> zero(SELECTOR(T)) const;
00049 
00050     protected:
00052       MonoidBase();
00053 
00055       MonoidBase(const MonoidBase& other);
00056     };
00057 
00058     template <class T>
00059     struct identity_as
00060     {
00061       template <class S>
00062       static
00063       Element<S, T> of(const S& s);
00064     };
00065 
00066     template <class T>
00067     struct zero_as
00068     {
00069       template <class S>
00070       static
00071       Element<S, T> of(const S& s);
00072     };
00073 
00077   } // algebra
00078    
00082   /*----------------------------------.
00083   | dynamic_traits<MonoidBase<Self> > |
00084   `----------------------------------*/
00085 
00086   template<class Self>
00087   struct dynamic_traits<algebra::MonoidBase<Self> >
00088     : dynamic_traits<algebra::SemigroupBase<Self> >
00089   { };
00090 
00091   template<typename S>
00092   struct virtual_types<algebra::MonoidBase<S> >
00093     : virtual_types<algebra::SemigroupBase<S> >
00094   { };
00095 
00096   /*---------------------------------.
00097   | MetaElement<MonoidBase<Self>, T> |
00098   `---------------------------------*/
00099 
00101   template<class Self, typename T>
00102   struct MetaElement<algebra::MonoidBase<Self>, T>
00103     : MetaElement<algebra::SemigroupBase<Self>, T>
00104   {
00105   protected:
00107     MetaElement();
00108 
00110     MetaElement(const MetaElement& other);
00111   };
00112 
00116   template<typename T, typename Self>
00117   T op_default(SELECTOR(algebra::MonoidBase<Self>), SELECTOR(T));
00118 
00119 } // vcsn
00120 
00121 # ifndef VCSN_USE_INTERFACE_ONLY
00122 #  include <vaucanson/algebra/concept/monoid_base.hxx>
00123 # endif // VCSN_USE_INTERFACE_ONLY
00124 
00125 #endif // ! VCSN_ALGEBRA_CONCEPT_MONOID_BASE_HH

Generated on Fri Jul 28 12:18:49 2006 for Vaucanson by  doxygen 1.4.6