olena-2.0-13-g8d55a9e * mln/tag/init.hh (tag::data_t): New tag type. (tag::data): New tag. * mln/core/image/imorph/decorated_image.hh (init_(tag::data_t, D&, const decorated_image<I, D>&)) (init_(tag::data_t, D&, const decorated_image<I, D2>&)) (init_(tag::image_t, decorated_image<I, D>&, const J&)): New functions.

--- milena/ChangeLog | 12 ++++++++++ milena/mln/core/image/imorph/decorated_image.hh | 26 +++++++++++++++++++++++ milena/mln/tag/init.hh | 3 ++ 3 files changed, 41 insertions(+), 0 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index 21db4fd..84c70af 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,3 +1,15 @@ +2011-11-24 Roland Levillain <roland@lrde.epita.fr> + + Fix the initialization of mln::decorated_image. + + * mln/tag/init.hh (tag::data_t): New tag type. + (tag::data): New tag. + * mln/core/image/imorph/decorated_image.hh + (init_(tag::data_t, D&, const decorated_image<I,D>&)) + (init_(tag::data_t, D&, const decorated_image<I,D2>&)) + (init_(tag::image_t, decorated_image<I,D>&, const J&)): + New functions. + 2011-11-18 Roland Levillain <roland@lrde.epita.fr> Simplify some apps/morpher programs using mln::make::box2d. diff --git a/milena/mln/core/image/imorph/decorated_image.hh b/milena/mln/core/image/imorph/decorated_image.hh index 181cbcd..39f2c9d 100644 --- a/milena/mln/core/image/imorph/decorated_image.hh +++ b/milena/mln/core/image/imorph/decorated_image.hh @@ -140,6 +140,32 @@ namespace mln # ifndef MLN_INCLUDE_ONLY + // init_. + + template <typename I, typename D> + void init_(tag::data_t, D& d, const decorated_image<I,D>& model) + { + d = model.decoration(); + } + + // Initializing a decoration with a model of another type. + template <typename I, typename D, typename D2> + void init_(tag::data_t, D& /* d */, const decorated_image<I,D2>& /* model */) + { + // FIXME: No initialization, really? + } + + template <typename I, typename D, typename J> + void init_(tag::image_t, decorated_image<I,D>& target, const J& model) + { + I ima; + init_(tag::image, ima, exact(model)); + D d; + init_(tag::data, d, exact(model)); + target.init_(ima, d); + } + + namespace internal { diff --git a/milena/mln/tag/init.hh b/milena/mln/tag/init.hh index c1db35c..7d94337 100644 --- a/milena/mln/tag/init.hh +++ b/milena/mln/tag/init.hh @@ -40,6 +40,7 @@ namespace mln struct bbox_t {}; struct border_t {}; + struct data_t {}; struct domain_t {}; struct extension_t {}; struct function_t {}; @@ -47,6 +48,7 @@ namespace mln extern bbox_t bbox; extern border_t border; + extern data_t data; extern domain_t domain; extern extension_t extension; extern function_t function; @@ -58,6 +60,7 @@ namespace mln bbox_t bbox; border_t border; + data_t data; domain_t domain; extension_t extension; function_t function; -- 1.7.2.5
participants (1)
-
Roland Levillain