• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Classes
  • Files
  • File List

ch_piter.hh

00001 // Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
00002 //
00003 // This file is part of Olena.
00004 //
00005 // Olena is free software: you can redistribute it and/or modify it under
00006 // the terms of the GNU General Public License as published by the Free
00007 // Software Foundation, version 2 of the License.
00008 //
00009 // Olena is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 // General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU General Public License
00015 // along with Olena.  If not, see <http://www.gnu.org/licenses/>.
00016 //
00017 // As a special exception, you may use this file as part of a free
00018 // software project without restriction.  Specifically, if other files
00019 // instantiate templates or use macros or inline functions from this
00020 // file, or you compile this file and link it with other files to produce
00021 // an executable, this file does not by itself cause the resulting
00022 // executable to be covered by the GNU General Public License.  This
00023 // exception does not however invalidate any other reasons why the
00024 // executable file might be covered by the GNU General Public License.
00025 
00026 #ifndef MLN_CORE_IMAGE_CH_PITER_HH
00027 # define MLN_CORE_IMAGE_CH_PITER_HH
00028 
00035 # include <mln/core/internal/image_identity.hh>
00036 
00037 
00038 
00039 namespace mln
00040 {
00041 
00042   // Forward declaration.
00043   template <typename I, typename Fwd> struct ch_piter_image;
00044 
00045 
00046   namespace internal
00047   {
00048 
00050     template <typename I, typename Fwd>
00051     struct data< ch_piter_image<I,Fwd> >
00052     {
00053       data(I& ima);
00054       I ima_;
00055     };
00056 
00057   } // end of namespace mln::internal
00058 
00059 
00060   namespace trait
00061   {
00062 
00063     template <typename I, typename Fwd>
00064     struct image_< ch_piter_image<I,Fwd> > : image_< I > // Same as I except...
00065     {
00066       // ...theis change.
00067       typedef trait::image::category::identity_morpher category;
00068     };
00069 
00070   } // end of namespace mln::trait
00071 
00072 
00073 
00074   // FIXME: Doc!
00075 
00076   template <typename I, typename Fwd>
00077   class ch_piter_image : public internal::image_identity< I,
00078                                                           mln_domain(I),
00079                                                           ch_piter_image<I,Fwd> >
00080   {
00081   public:
00082 
00084     typedef ch_piter_image< tag::image_<I>, Fwd > skeleton;
00085 
00086     typedef Fwd fwd_piter;
00087     typedef Fwd bkd_piter; // FIXME
00088     typedef fwd_piter piter;
00089 
00090     ch_piter_image();
00091     ch_piter_image(I& ima);
00092 
00093     // Deferred initialization.
00094     void init_(I& ima);
00095   };
00096 
00097 
00098 
00099   template <typename Fwd, typename I>
00100   ch_piter_image<I,Fwd>
00101   ch_piter(Image<I>& ima);
00102 
00103 
00104 
00105 # ifndef MLN_INCLUDE_ONLY
00106 
00107 
00108   // internal::data< ch_piter_image<I,S> >
00109 
00110   namespace internal
00111   {
00112 
00113     template <typename I, typename Fwd>
00114     inline
00115     data< ch_piter_image<I,Fwd> >::data(I& ima)
00116       : ima_(ima)
00117     {
00118     }
00119 
00120   } // end of namespace mln::internal
00121 
00122 
00123   // ch_piter_image<I,Fwd>
00124 
00125   template <typename I, typename Fwd>
00126   inline
00127   ch_piter_image<I,Fwd>::ch_piter_image()
00128   {
00129   }
00130 
00131   template <typename I, typename Fwd>
00132   inline
00133   ch_piter_image<I,Fwd>::ch_piter_image(I& ima)
00134   {
00135     mln_precondition(ima.is_valid());
00136     init_(ima);
00137   }
00138 
00139   template <typename I, typename Fwd>
00140   inline
00141   void
00142   ch_piter_image<I,Fwd>::init_(I& ima)
00143   {
00144     mln_precondition(ima.is_valid());
00145     this->data_ = new internal::data< ch_piter_image<I,Fwd> >(ima);
00146   }
00147 
00148 
00149   // ch_piter
00150 
00151   template <typename Fwd, typename I>
00152   inline
00153   ch_piter_image<I,Fwd>
00154   ch_piter(Image<I>& ima)
00155   {
00156     ch_piter_image<I,Fwd> tmp(exact(ima));
00157     return tmp;
00158   }
00159 
00160 # endif // ! MLN_INCLUDE_ONLY
00161 
00162 } // end of namespace mln
00163 
00164 
00165 #endif // ! MLN_CORE_IMAGE_CH_PITER_HH

Generated on Tue Oct 4 2011 15:23:34 for Milena (Olena) by  doxygen 1.7.1