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_FUN_P2B_HAS_HH
00027 # define MLN_FUN_P2B_HAS_HH
00028 
00032 
00033 
00034 # include <mln/core/concept/image.hh>
00035 # include <mln/core/concept/function.hh>
00036 # include <mln/metal/const.hh>
00037 # include <mln/metal/unconst.hh>
00038 
00039 
00040 namespace mln
00041 {
00042 
00043   namespace fun
00044   {
00045 
00046     namespace p2b
00047     {
00048 
00049       
00050 
00051       template <typename I>
00052       struct has
00053 
00054         : public Function_v2b< has<I> >,
00055           private mlc_is_a(I, Image)::check_t
00056       {
00058         typedef bool result;
00059 
00061         bool operator()(const mln_psite(I)& p) const;
00062 
00063 
00065         has();
00066 
00068         has(mlc_const(I)& ima);
00069 
00070 
00072         has(const has<I>& rhs);
00073 
00075         has<I>& operator=(const has<I>& rhs);
00076 
00077       private:
00078         mlc_const(I) ima_;
00079         typedef Function_v2b< has<I> > super_;
00080       };
00081 
00082 
00083 # ifndef MLN_INCLUDE_ONLY
00084 
00085       template <typename I>
00086       inline
00087       bool
00088       has<I>::operator()(const mln_psite(I)& p) const
00089       {
00090         return ima_.has(p);
00091       }
00092 
00093       template <typename I>
00094       inline
00095       has<I>::has()
00096         : ima_()
00097       {
00098       }
00099 
00100       template <typename I>
00101       inline
00102       has<I>::has(mlc_const(I)& ima)
00103         : ima_(ima)
00104       {
00105       }
00106 
00107       template <typename I>
00108       inline
00109       has<I>::has(const has<I>& rhs)
00110         : Function_v2v< has<I> >(), 
00111           super_(),
00112           ima_(rhs.ima_)
00113       {
00114       }
00115 
00116       template <typename I>
00117       inline
00118       has<I>&
00119       has<I>::operator=(const has<I>& rhs)
00120       {
00121         if (&rhs == this)
00122           return *this;
00123         const_cast<mlc_unconst(I)&>(this->ima_) = rhs.ima_;
00124         return *this;
00125       }
00126 
00127 # endif // ! MLN_INCLUDE_ONLY
00128 
00129     } 
00130 
00131   } 
00132 
00133 } 
00134 
00135 
00136 #endif // ! MLN_FUN_P2B_HAS_HH