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 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 template<typename S> 00096 struct virtual_types<algebra::FreeMonoidProductBase<S> > 00097 : virtual_types<algebra::MonoidBase<S> > 00098 { 00099 typedef undefined_type first_monoid_t; 00100 typedef undefined_type second_monoid_t; 00101 }; 00102 00103 00104 /*--------------------------------------------. 00105 | MetaElement<FreeMonoidProductBase<Self>, T> | 00106 `--------------------------------------------*/ 00107 00109 template<class Self, typename T> 00110 struct MetaElement<algebra::FreeMonoidProductBase<Self>, T> 00111 : MetaElement<algebra::MonoidBase<Self>, T> 00112 { 00113 typedef typename virtual_types<Self>::first_monoid_t first_monoid_t; 00114 typedef typename virtual_types<Self>::second_monoid_t second_monoid_t; 00115 00116 typedef typename T::first_type first_monoid_elt_value_t; 00117 typedef typename T::second_type second_monoid_elt_value_t; 00118 00119 typedef Element<first_monoid_t, first_monoid_elt_value_t> 00120 first_monoid_elt_t; 00121 typedef Element<second_monoid_t, second_monoid_elt_value_t> 00122 second_monoid_elt_t; 00123 00125 first_monoid_elt_t& first(); 00126 00128 const first_monoid_elt_t& first() const; 00129 00131 second_monoid_elt_t& second(); 00132 00134 const second_monoid_elt_t& second() const; 00135 00137 void mirror(); 00138 00140 template <class Ftor> 00141 typename Ftor::result_type length(Ftor f); 00142 00143 protected: 00145 MetaElement(); 00146 00148 MetaElement(const MetaElement& other); 00149 }; 00150 00151 00152 } // vcsn 00153 00154 # ifndef VCSN_USE_INTERFACE_ONLY 00155 # include <vaucanson/algebra/concept/freemonoid_product_base.hxx> 00156 # endif // VCSN_USE_INTERFACE_ONLY 00157 00158 #endif // ! VCSN_ALGEBRA_CONCEPT_FREEMONOID_PRODUCT_BASE_HH