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_PW_IMAGE_HH
00027 # define MLN_PW_IMAGE_HH
00028 
00032 
00033 # include <mln/pw/internal/image_base.hh>
00034 # include <mln/core/concept/function.hh>
00035 # include <mln/value/set.hh>
00036 
00037 
00038 namespace mln
00039 {
00040 
00041   
00042   namespace pw { template <typename F, typename S> class image; }
00043 
00044 
00045   
00046 
00047   namespace trait
00048   {
00049 
00050     template <typename F, typename S>
00051     struct image_< pw::image<F,S> >
00052       : pw_image_<F,S, pw::image<F,S> >
00053     {
00054     };
00055 
00056   } 
00057 
00058 
00059   namespace internal
00060   {
00061 
00063     template <typename F, typename S>
00064     struct data< mln::pw::image<F,S> >
00065     {
00066       data(const F& f, const S& ps);
00067       F f_;
00068       S domain_;
00069     };
00070 
00071   } 
00072 
00073 
00076   template <typename F, typename S>
00077   pw::image<F,S>
00078   operator | (const Function_v2v<F>& f, const Site_Set<S>& ps);
00079 
00080 
00081   namespace pw
00082   {
00083 
00090     
00091     template <typename F, typename S>
00092     class image :
00093       public pw::internal::image_base< F, S, image<F,S> >
00094     {
00095       typedef pw::internal::image_base< F, S, image<F,S> > super_;
00096 
00097     public:
00099       typedef image< tag::function_<F>, tag::domain_<S> > skeleton;
00100 
00102       image();
00103 
00105       image(const Function_v2v<F>& f, const Site_Set<S>& ps);
00106 
00107     };
00108 
00109   } 
00110 
00111 
00113 
00114   template <typename F, typename S, typename E, typename J>
00115   void init_(tag::image_t, pw::image<F,S>& target, const Image<J>& model);
00116 
00117 
00118 # ifndef MLN_INCLUDE_ONLY
00119 
00121 
00122   template <typename F, typename S, typename E, typename J>
00123   void init_(tag::image_t, pw::image<F,S>& target, const Image<J>& model)
00124   {
00125     F f;
00126     init_(tag::function, f, exact(model));
00127     S s;
00128     init_(tag::domain, s, exact(model));
00129     target.init_(f, s);
00130   }
00131 
00132 
00133   
00134 
00135   template <typename F, typename S>
00136   inline
00137   pw::image<F,S>
00138   operator | (const Function_v2v<F>& f, const Site_Set<S>& ps)
00139   {
00140     pw::image<F,S> tmp(f, ps);
00141     return tmp;
00142   }
00143 
00144 
00145   
00146 
00147   namespace internal
00148   {
00149 
00150     template <typename F, typename S>
00151     inline
00152     data< mln::pw::image<F,S> >::data(const F& f, const S& ps)
00153       : f_(f),
00154       domain_(ps)
00155     {
00156     }
00157 
00158   } 
00159 
00160 
00161 
00162   
00163 
00164   namespace pw
00165   {
00166 
00167     template <typename F, typename S>
00168     inline
00169     image<F,S>::image()
00170     {
00171     }
00172 
00173     template <typename F, typename S>
00174     inline
00175     image<F,S>::image(const Function_v2v<F>& f, const Site_Set<S>& ps)
00176     {
00177       this->data_ = new mln::internal::data< image<F,S> >(exact(f), exact(ps));
00178     }
00179 
00180 
00181   } 
00182 
00183 # endif // ! MLN_INCLUDE_ONLY
00184 
00185 } 
00186 
00187 
00188 #endif // ! MLN_PW_IMAGE_HH