Vaucanson 1.4
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, 2006, 2007, 2008, 2010 The Vaucanson
00006 // Group.
00007 //
00008 // This program is free software; you can redistribute it and/or
00009 // modify it under the terms of the GNU General Public License
00010 // as published by the Free Software Foundation; either version 2
00011 // of the License, or (at your option) any later version.
00012 //
00013 // The complete GNU General Public Licence Notice can be found as the
00014 // `COPYING' file in the root directory.
00015 //
00016 // The Vaucanson Group consists of people listed in the `AUTHORS' file.
00017 //
00018 #ifndef VCSN_ALGEBRA_CONCEPT_MONOID_BASE_HH
00019 # define VCSN_ALGEBRA_CONCEPT_MONOID_BASE_HH
00020 
00021 # include <vaucanson/algebra/concept/semigroup_base.hh>
00022 
00023 namespace vcsn {
00024 
00025   namespace algebra {
00026 
00030     /*-----------------.
00031     | MonoidBase<Self> |
00032     `-----------------*/
00033 
00040     template<class Self>
00041     struct MonoidBase : SemigroupBase<Self>
00042     {
00044       template<typename T>
00045       Element<Self, T> identity(SELECTOR(T)) const;
00046 
00048       template<typename T>
00049       Element<Self, T> zero(SELECTOR(T)) const;
00050 
00051     protected:
00053       MonoidBase();
00054 
00056       MonoidBase(const MonoidBase& other);
00057     };
00058 
00059     template <class T>
00060     struct identity_as
00061     {
00062       template <class S>
00063       static
00064       Element<S, T> of(const S& s);
00065     };
00066 
00067     template <class T>
00068     struct zero_as
00069     {
00070       template <class S>
00071       static
00072       Element<S, T> of(const S& s);
00073     };
00074 
00075     /*------------.
00076     | word_traits |
00077     `------------*/
00078 
00084     template <typename S, typename T>
00085     struct word_traits
00086     {
00088       typedef undefined_type alphabet_t;
00089 
00091       typedef undefined_type word_t;
00092 
00094       typedef undefined_type first_monoid_t;
00095 
00097       typedef undefined_type second_monoid_t;
00098 
00100       typedef undefined_type first_projection_t;
00101 
00103       typedef undefined_type second_projection_t;
00104     };
00105 
00109   } // algebra
00110    
00114   /*----------------------------------.
00115   | dynamic_traits<MonoidBase<Self> > |
00116   `----------------------------------*/
00117 
00118   template<class Self>
00119   struct dynamic_traits<algebra::MonoidBase<Self> >
00120     : dynamic_traits<algebra::SemigroupBase<Self> >
00121   { };
00122 
00123   template<typename S>
00124   struct virtual_types<algebra::MonoidBase<S> >
00125     : virtual_types<algebra::SemigroupBase<S> >
00126   { };
00127 
00128   /*---------------------------------.
00129   | MetaElement<MonoidBase<Self>, T> |
00130   `---------------------------------*/
00131 
00133   template<class Self, typename T>
00134   struct MetaElement<algebra::MonoidBase<Self>, T>
00135     : MetaElement<algebra::SemigroupBase<Self>, T>
00136   {
00137   protected:
00139     MetaElement();
00140 
00142     MetaElement(const MetaElement& other);
00143   };
00144 
00148   namespace algebra {
00149 
00150     template<typename T, typename Self>
00151     T op_default(SELECTOR(algebra::MonoidBase<Self>), SELECTOR(T));
00152 
00153   } // algebra
00154 
00155 } // vcsn
00156 
00157 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
00158 #  include <vaucanson/algebra/concept/monoid_base.hxx>
00159 # endif // VCSN_USE_INTERFACE_ONLY
00160 
00161 #endif // ! VCSN_ALGEBRA_CONCEPT_MONOID_BASE_HH