00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
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   
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   } 
00058 
00059 
00060   namespace trait
00061   {
00062 
00063     template <typename I, typename Fwd>
00064     struct image_< ch_piter_image<I,Fwd> > : image_< I > 
00065     {
00066       
00067       typedef trait::image::category::identity_morpher category;
00068     };
00069 
00070   } 
00071 
00072 
00073 
00074   
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; 
00088     typedef fwd_piter piter;
00089 
00090     ch_piter_image();
00091     ch_piter_image(I& ima);
00092 
00093     
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   
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   } 
00121 
00122 
00123   
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   
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 } 
00163 
00164 
00165 #endif // ! MLN_CORE_IMAGE_CH_PITER_HH