
+#ifndef ITER_MORPHER_HH +# define ITER_MORPHER_HH
OLN_MORPHER_ITER_MORPHER
+ + namespace morpher { + + template <class SrcType, class IterType, class Exact> + struct iter_morpher + : public abstract::generic_morpher< SrcType, SrcType, iter_morpher<SrcType, IterType, Exact> >
Pas de comantaires. Exemple de code si possible :) Ne manque-il pas exact_vt? (Si c'est le cas, il en manque plus d'un).
+ typedef IterType iter_type;
Pas de commantaires.
+ typedef abstract::generic_morpher< SrcType, SrcType, iter_morpher<SrcType, IterType, Exact> > super_type;
80 colonnes?
+ + /// Construct the iter morpher with an image \a ima.
Il me semble que Damien écrit ima_.
+ /*! + ** \brief Empty constructor. + ** + ** Needed by mlc_hierarchy::any_with_diamond. + */ + iter_morpher() {}
Je dis peut-être une bêtise, mais ça me semble dangereux en public.
+ /*! Perform a shallow copy from the decorated image of \a rhs + ** to the current decorated image. The points will be shared + ** by the two images. + */ + self_type& + assign(self_type& rhs) + { + oln_iter_type(SrcType) it(rhs); + + for_all(it) + this->at(it) = rhs[it]; + return this->exact(); + }
+ /// The specialized version for `const' declared images.
`const' images.
+ template <class SrcType, class IterType, class Exact> + struct iter_morpher<const SrcType, IterType, Exact> + : public abstract::generic_morpher< SrcType, SrcType, iter_morpher<const SrcType, IterType, Exact> >
Je ne prends pas le temps de comprendre pourquoi cette classe. Merci d'ajouter un exemple de code. Mm remarque que la première classe (commantaire, vt...).
+ ** \brief Instantiate a temporary read-only iter morpher. + ** + ** The image will be viewed according to its iterator type. + ** For example, the foo function will print the size of the picture + ** (the bkd_iter_type is used transparently). + ** + ** \code + ** #include <oln/morpher/iter_morpher.hh> + ** #include <oln/basics2d.hh> + ** #include <ntg/all.hh> + ** template <class E> + ** void foo(const oln::abstract::image<E>& img) + ** { + ** oln_iter_type(oln::abstract::image<E>) it(img);
oln_fwd_iter.
+ ** for_all(it) + ** { + ** std::cout << it.row() << " " << it.col() << std::endl;
std::cout << it;
+ ** break;
pas break
+ ** }
std::cout << std::endl;
+ ** } + ** int main() + ** {
+ ** const oln::image2d<ntg::rgb_8> imc = oln::load(IMG_IN "lena.ppm");
ntg::int_u8 [...] test-cmap.pgm (petite image).
+ ** assert(imc.has_impl()); + ** foo(oln::morpher::iter_morph<oln_bkd_iter_type_(oln::image2d<ntg::rgb_8>)>(imc));
Ici tu colles le résultat (pas visible dans la doc). Merci d'ajouter le tout dans les tests.
+ ** } + ** \endcode
Sinon, ça donne envie de l'utiliser :) -- Niels