Vaucanson 1.4
freemonoid_product_base.hh
00001 // freemonoid_product_base.hh: this file is part of the Vaucanson project.
00002 //
00003 // Vaucanson, a generic library for finite state machines.
00004 //
00005 // Copyright (C) 2004, 2005, 2006, 2008 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_FREEMONOID_PRODUCT_BASE_HH
00018 # define VCSN_ALGEBRA_CONCEPT_FREEMONOID_PRODUCT_BASE_HH
00019 
00020 # include <vaucanson/algebra/concept/alphabets_base.hh>
00021 # include <vaucanson/algebra/concept/monoid_base.hh>
00022 # include <string>
00023 # include <list>
00024 
00025 namespace vcsn {
00026 
00027   namespace algebra {
00028 
00032     /*----------------------------.
00033     | FreeMonoidProductBase<Self> |
00034     `----------------------------*/
00035 
00044     template<class Self>
00045     struct FreeMonoidProductBase
00046       : MonoidBase<Self>
00047     {
00049       typedef typename virtual_types<Self>::first_monoid_t first_monoid_t;
00050 
00052       typedef typename virtual_types<Self>::second_monoid_t second_monoid_t;
00053 
00054       // FIXME
00055       typedef undefined_type alphabet_t;
00056       typedef undefined_type letter_t;
00057 
00059       first_monoid_t&   first_monoid();
00060 
00062       const first_monoid_t& first_monoid() const;
00063 
00065       second_monoid_t& second_monoid();
00066 
00068       const second_monoid_t& second_monoid() const;
00069 
00070     protected:
00072       FreeMonoidProductBase();
00073 
00075       FreeMonoidProductBase(const FreeMonoidProductBase& m);
00076     };
00077 
00081   } // algebra
00082 
00086   /*-------------------------------------------.
00087   | dynamic_traits<FreeMonoidProductBase<Self> |
00088   `-------------------------------------------*/
00089 
00090   template<class Self>
00091   struct dynamic_traits<algebra::FreeMonoidProductBase<Self> >
00092     : dynamic_traits<algebra::MonoidBase<Self> >
00093   { };
00094 
00095   /*------------------------------------------.
00096   | virtual_types<FreeMonoidProductBase<Self> |
00097   `------------------------------------------*/
00098 
00099   template<typename S>
00100   struct virtual_types<algebra::FreeMonoidProductBase<S> >
00101     : virtual_types<algebra::MonoidBase<S> >
00102   {
00103     typedef undefined_type first_monoid_t;
00104     typedef undefined_type second_monoid_t;
00105   };
00106 
00107 
00108   /*--------------------------------------------.
00109   | MetaElement<FreeMonoidProductBase<Self>, T> |
00110   `--------------------------------------------*/
00111 
00113   template<class Self, typename T>
00114   struct MetaElement<algebra::FreeMonoidProductBase<Self>, T>
00115     : MetaElement<algebra::MonoidBase<Self>, T>
00116   {
00117     typedef typename virtual_types<Self>::first_monoid_t first_monoid_t;
00118     typedef typename virtual_types<Self>::second_monoid_t second_monoid_t;
00119 
00120     typedef typename T::first_type              first_monoid_elt_value_t;
00121     typedef typename T::second_type             second_monoid_elt_value_t;
00122 
00123     typedef Element<first_monoid_t, first_monoid_elt_value_t>
00124                                                 first_monoid_elt_t;
00125     typedef Element<second_monoid_t, second_monoid_elt_value_t>
00126                                                 second_monoid_elt_t;
00127 
00129     first_monoid_elt_t& first();
00130 
00132     const first_monoid_elt_t& first() const;
00133 
00135     second_monoid_elt_t& second();
00136 
00138     const second_monoid_elt_t& second() const;
00139 
00141     void mirror();
00142 
00144     template <class Ftor>
00145     typename Ftor::result_type  length(Ftor f);
00146 
00147   protected:
00149     MetaElement();
00150 
00152     MetaElement(const MetaElement& other);
00153   };
00154 
00158   // FIXME: it should more closely follow freemonoid_base.
00159   namespace algebra
00160   {
00161     template<typename Self, typename St, typename T>
00162     St&
00163     op_rout(const FreeMonoidProductBase<Self>& s, St& st, const T& v);
00164 
00165   } // ! algebra
00166 
00167 } // ! vcsn
00168 
00169 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
00170 #  include <vaucanson/algebra/concept/freemonoid_product_base.hxx>
00171 # endif // VCSN_USE_INTERFACE_ONLY
00172 
00173 #endif // ! VCSN_ALGEBRA_CONCEPT_FREEMONOID_PRODUCT_BASE_HH