- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

# free_monoid.hxx

    00001 // free_monoid.hxx: 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, 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_IMPLEMENTATION_MONOID_FREE_MONOID_HXX
    00018 # define VCSN_ALGEBRA_IMPLEMENTATION_MONOID_FREE_MONOID_HXX
    00019
    00020 # include <vaucanson/algebra/implementation/monoid/free_monoid.hh>
    00021
    00022 namespace vcsn
    00023 {
    00024   namespace algebra
    00025   {
    00026     /*--------------.
    00027     | FreeMonoid<A> |
    00028     `--------------*/
    00029
    00030     template <class A>
    00031     FreeMonoid<A>::FreeMonoid(const A& a) :
    00032         rep_(MonoidRepDefault<FreeMonoid<A> >::get_instance()),
    00033         alph_(a)
    00034     {
    00035       rep_->disambiguate(*this, rep_);
    00036     }
    00037
    00038     template <class A>
    00039     FreeMonoid<A>::FreeMonoid(const A& a, MonoidRep<FreeMonoid<A> > mr) :
    00040         rep_(boost::shared_ptr<MonoidRep<FreeMonoid<A> > >(new MonoidRep<FreeMonoid<A> > (mr))),
    00041         alph_(a)
    00042     {
    00043     }
    00044
    00045     template <class A>
    00046     FreeMonoid<A>::FreeMonoid(const FreeMonoid& w) :
    00047       FreeMonoidBase<FreeMonoid<A> >(w),
    00048       rep_(w.rep_),
    00049       alph_(w.alph_)
    00050     {
    00051     }
    00052
    00053     template <class A>
    00054     const boost::shared_ptr<MonoidRep<FreeMonoid<A> > >
    00055     FreeMonoid<A>::representation() const
    00056     {
    00057       return rep_;
    00058     }
    00059
    00060     template <class A>
    00061     void
    00062     FreeMonoid<A>::set_representation(MonoidRep<FreeMonoid<A> > mr)
    00063     {
    00064       rep_ = boost::shared_ptr<MonoidRep<FreeMonoid<A> > >(new MonoidRep<FreeMonoid<A> > (mr));
    00065     }
    00066
    00067     template <class A>
    00068     A& FreeMonoid<A>::alphabet()
    00069     {
    00070       return alph_;
    00071     }
    00072
    00073     template <class A>
    00074     const A& FreeMonoid<A>::alphabet() const
    00075     {
    00076       return alph_;
    00077     }
    00078
    00079     template <typename A>
    00080     bool
    00081     operator==(const FreeMonoid<A>& lhs,
    00082                const FreeMonoid<A>& rhs)
    00083     {
    00084       return (lhs.alphabet() == rhs.alphabet() &&
    00085               lhs.representation() == rhs.representation());
    00086     }
    00087
    00088   } // ! algebra
    00089
    00090 } // ! vcsn
    00091
    00092 #endif // ! VCSN_ALGEBRA_IMPLEMENTATION_MONOID_FREE_MONOID_HXX