structure.hxx

00001 // structure.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 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_DESIGN_PATTERN_STRUCTURE_HXX
00018 # define VCSN_DESIGN_PATTERN_STRUCTURE_HXX
00019 
00020 # include <vaucanson/design_pattern/structure.hh>
00021 
00022 namespace vcsn {
00023 
00024   /*-----------------------------------.
00025   | Delegations for Structure::contain |
00026   `-----------------------------------*/
00027 
00028   template <typename S>
00029   template <typename T>
00030   bool
00031   Structure<S>::contains(const Element<S, T>& elt) const
00032   {
00033     return op_contains(self(), elt.value());
00034   }
00035 
00036   template <typename S>
00037   template <typename T>
00038   bool
00039   Structure<S>::contains(const T& elt_value) const
00040   {
00041     return op_contains(self(), elt_value);
00042   }
00043 
00044   template <typename S>
00045   template <typename OtherS, typename T>
00046   bool
00047   Structure<S>::contains(const Element<OtherS, T>& other) const
00048   {
00049     return false;
00050   }
00051 
00052   /*---------------------------------.
00053   | Delegation for Structure::choose |
00054   `---------------------------------*/
00055 
00056   template <class S>
00057   template <class T>
00058   Element<S, T>
00059   Structure<S>::choose(SELECTOR(T)) const
00060   {
00061     return op_choose(self(), SELECT(T));
00062   }
00063 
00064   /*-------------------------.
00065   | Static inheritance stuff |
00066   `-------------------------*/
00067 
00068   template <typename S>
00069   S&
00070   Structure<S>::self()
00071   {
00072     return static_cast<self_t&>(*this);
00073   }
00074 
00075   template <typename S>
00076   const S&
00077   Structure<S>::self() const
00078   {
00079     return static_cast<const self_t&>(*this);
00080   }
00081 
00082 
00083   /*-----------------------.
00084   | Protected constructors |
00085   `-----------------------*/
00086 
00087   template <typename S>
00088   Structure<S>::Structure()
00089     : utility::unique::unifiable()
00090   {}
00091 
00092   template <typename S>
00093   Structure<S>::Structure(const Structure& other)
00094     : utility::unique::unifiable(other)
00095   {}
00096 
00097 
00098   /*--------------------.
00099   | Default Comparison  |
00100   `--------------------*/
00101 
00102   template<typename S>
00103   bool operator != (const vcsn::Structure<S>& a,
00104                     const vcsn::Structure<S>& b)
00105   { return not (a.self() == b.self()); }
00106 
00107 } // vcsn
00108 
00109 #endif // ! VCSN_DESIGN_PATTERN_STRUCTURE_HXX

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