
* morpho.ixx: Give names to wrapped traits, to let SWIG properly deduce the return types of wrapped functions templates. * python/max-tree.py: Reenable a previously disabled println statement. --- swilena/ChangeLog | 9 +++++++++ swilena/morpho.ixx | 22 +++++++++++----------- swilena/python/max-tree.py | 16 ++++------------ 3 files changed, 24 insertions(+), 23 deletions(-) diff --git a/swilena/ChangeLog b/swilena/ChangeLog index e183332..6778779 100644 --- a/swilena/ChangeLog +++ b/swilena/ChangeLog @@ -1,5 +1,14 @@ 2014-05-23 Roland Levillain <roland@lrde.epita.fr> + Make Swilena's max-tree.py test fully work with SWIG 2.0.7. + + * morpho.ixx: Give names to wrapped traits, to let SWIG properly + deduce the return types of wrapped functions templates. + * python/max-tree.py: Reenable a previously disabled println + statement. + +2014-05-23 Roland Levillain <roland@lrde.epita.fr> + Make Swilena compatible with SWIG 2.0.9+. * image2d.ixx, diff --git a/swilena/morpho.ixx b/swilena/morpho.ixx index 3e5a91d..8ac70a1 100644 --- a/swilena/morpho.ixx +++ b/swilena/morpho.ixx @@ -1,6 +1,6 @@ // -*- C++ -*- -// Copyright (C) 2008, 2009, 2013 EPITA Research and Development -// Laboratory (LRDE) +// Copyright (C) 2008, 2009, 2013, 2014 EPITA Research and Development +// Laboratory (LRDE). // // This file is part of Olena. // @@ -71,13 +71,13 @@ namespace mln %define instantiate_dilation(Name, I, W) // Explicit instantiation of this trait for the return type. - %template() mln::trait::concrete< I >; + %template(Name ## _concrete_trait) mln::trait::concrete< I >; %template(Name) mln::morpho::dilation< I, W >; %enddef %define instantiate_erosion(Name, I, W) // Explicit instantiation of this trait for the return type. - %template() mln::trait::concrete< I >; + %template(Name ## _concrete_trait) mln::trait::concrete< I >; %template(Name) mln::morpho::erosion< I, W >; %enddef @@ -95,13 +95,13 @@ namespace mln %define instantiate_closing(Name, I, N) // Explicit instantiation of this trait for the return type. - %template() mln::trait::concrete< I >; + %template(Name ## _concrete_trait) mln::trait::concrete< I >; %template(Name) mln::morpho::elementary::closing< I, N >; %enddef %define instantiate_opening(Name, I, N) // Explicit instantiation of this trait for the return type. - %template() mln::trait::concrete< I >; + %template(Name ## _concrete_trait) mln::trait::concrete< I >; %template(Name) mln::morpho::elementary::opening< I, N >; %enddef @@ -117,19 +117,19 @@ namespace mln %define instantiate_gradient(Name, I, W) // Explicit instantiation of this trait for the return type. - %template() mln::trait::concrete< I >; + %template(Name ## _concrete_trait) mln::trait::concrete< I >; %template(Name) mln::morpho::gradient< I, W >; %enddef %define instantiate_gradient_internal(Name, I, W) // Explicit instantiation of this trait for the return type. - %template() mln::trait::concrete< I >; + %template(Name ## _concrete_trait) mln::trait::concrete< I >; %template(Name) mln::morpho::gradient_internal< I, W >; %enddef %define instantiate_gradient_external(Name, I, W) // Explicit instantiation of this trait for the return type. - %template() mln::trait::concrete< I >; + %template(Name ## _concrete_trait) mln::trait::concrete< I >; %template(Name) mln::morpho::gradient_external< I, W >; %enddef @@ -165,7 +165,7 @@ namespace mln %define instantiate_watershed_flooding(Name, L, I, N) // Explicit instantiation of this trait for the return type. - %template() mln::trait::ch_value< I, L >; + %template(Name ## _ch_value_trait) mln::trait::ch_value< I, L >; %template(Name) mln::morpho::watershed::flooding< L, I, N >; %enddef @@ -181,7 +181,7 @@ namespace mln %define instantiate_max_tree(Name, I, N) // Explicit instantiation of this trait for the return type. - %template() mln::trait::ch_value< I, mln_psite(I) >; + %template(Name ## _ch_value_trait) mln::trait::ch_value< I, mln_psite(I) >; %template(Name) mln::morpho::tree::max< I, N >; %enddef diff --git a/swilena/python/max-tree.py b/swilena/python/max-tree.py index f537285..345d966 100644 --- a/swilena/python/max-tree.py +++ b/swilena/python/max-tree.py @@ -1,6 +1,7 @@ #! /usr/bin/env python -# Copyright (C) 2010, 2012 EPITA Research and Development Laboratory (LRDE) +# Copyright (C) 2010, 2012, 2014 EPITA Research and Development +# Laboratory (LRDE). # # This file is part of Olena. # @@ -37,16 +38,7 @@ for p, v in itertools.izip(ima.domain(), values): ima.set(p, int_u8(v)) image.println("ima =", ima) -# FIXME: The type of the (Python) object returned by this call, -# <type 'SwigPyObject'>, is wrong. The right type should be -# <class 'image2d_point2d.image2d_point2d'>, but the fact that the -# routine and the result object are located in two different -# (generated) Swilena submodules seems to confuse SWIG. A consequence -# of this issue is that `max_tree_parent' is not usable at all, hence -# the failure of the last line of this test. We should perhaps review -# Swilena's design and minimize or even completely get rid of the -# modular approach... -max_tree_parent = image.max_tree(ima, c4()); +max_tree_parent = image.max_tree(ima, c4()) # FIXME: Overloading issue: Why can't we use # @@ -54,4 +46,4 @@ max_tree_parent = image.max_tree(ima, c4()); # # ? ## 2013-04-09: Disabled, until a solution is found. -#par_image.println(max_tree_parent) +par_image.println(max_tree_parent) -- 1.7.10.4