environments.hh

00001 // Copyright (C)  2004  EPITA Research and Development Laboratory
00002 //
00003 // This file is part of the Olena Library.  This library is free
00004 // software; you can redistribute it and/or modify it under the terms
00005 // of the GNU General Public License version 2 as published by the
00006 // Free Software Foundation.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU General Public License
00014 // along with this library; see the file COPYING.  If not, write to
00015 // the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00016 // Boston, MA 02110-1301, USA.
00017 //
00018 // As a special exception, you may use this file as part of a free
00019 // software library without restriction.  Specifically, if other files
00020 // instantiate templates or use macros or inline functions from this
00021 // file, or you compile this file and link it with other files to
00022 // produce an executable, this file does not by itself cause the
00023 // resulting executable to be covered by the GNU General Public
00024 // License.  This exception does not however invalidate any other
00025 // reasons why the executable file might be covered by the GNU General
00026 // Public License.
00027 
00028 #ifndef OLN_MORPHO_ENVIRONMENTS_HH
00029 # define OLN_MORPHO_ENVIRONMENTS_HH
00030 # include <oln/basics.hh>
00031 # include <mlc/type.hh>
00032 
00033 namespace oln
00034 {
00035   namespace morpho
00036   {
00039     namespace env
00040     {
00043       namespace abstract
00044       {
00048         template <class Exact>
00049         struct env: public mlc_hierarchy::any<Exact>
00050         {
00051         };
00052       } // !abstract
00053 
00059       struct NullEnv: public abstract::env<NullEnv>
00060       {
00061       };
00062 
00068       template <class I>
00069       struct OtherImageEnv: public abstract::env<OtherImageEnv<I> >
00070       {
00071         typedef oln::abstract::image<I> im_type;
00072 
00073         OtherImageEnv(const oln::abstract::image<I> &im): im_(im)
00074         {};
00075 
00076         const im_type   &getImage() const
00077         {
00078           return im_;
00079         }
00080 
00081       protected:
00082         const im_type   &im_;
00083       };
00084 
00090       template <class I>
00091       struct ParentEnv: public abstract::env<ParentEnv<I> >
00092       {
00093         typedef oln::abstract::image<I> im_type;
00094 
00095         ParentEnv(const oln::abstract::image<I> &im): im_(im)
00096         {};
00097 
00098         const im_type   &getParent() const
00099         {
00100           return im_;
00101         }
00102 
00103       protected:
00104         const im_type   &im_;
00105       };
00106 
00107     }
00108   }
00109 }
00110 #endif // !OLN_MORPHO_ENVIRONMENTS_HH

Generated on Tue Feb 20 20:18:52 2007 for Olena by  doxygen 1.5.1