Commit 63d66e39 authored by Roland Levillain's avatar Roland Levillain
Browse files

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.
parent 72913431
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> 2014-05-23 Roland Levillain <roland@lrde.epita.fr>
Make Swilena compatible with SWIG 2.0.9+. Make Swilena compatible with SWIG 2.0.9+.
......
// -*- C++ -*- // -*- C++ -*-
// Copyright (C) 2008, 2009, 2013 EPITA Research and Development // Copyright (C) 2008, 2009, 2013, 2014 EPITA Research and Development
// Laboratory (LRDE) // Laboratory (LRDE).
// //
// This file is part of Olena. // This file is part of Olena.
// //
...@@ -71,13 +71,13 @@ namespace mln ...@@ -71,13 +71,13 @@ namespace mln
%define instantiate_dilation(Name, I, W) %define instantiate_dilation(Name, I, W)
// Explicit instantiation of this trait for the return type. // 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 >; %template(Name) mln::morpho::dilation< I, W >;
%enddef %enddef
%define instantiate_erosion(Name, I, W) %define instantiate_erosion(Name, I, W)
// Explicit instantiation of this trait for the return type. // 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 >; %template(Name) mln::morpho::erosion< I, W >;
%enddef %enddef
...@@ -95,13 +95,13 @@ namespace mln ...@@ -95,13 +95,13 @@ namespace mln
%define instantiate_closing(Name, I, N) %define instantiate_closing(Name, I, N)
// Explicit instantiation of this trait for the return type. // 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 >; %template(Name) mln::morpho::elementary::closing< I, N >;
%enddef %enddef
%define instantiate_opening(Name, I, N) %define instantiate_opening(Name, I, N)
// Explicit instantiation of this trait for the return type. // 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 >; %template(Name) mln::morpho::elementary::opening< I, N >;
%enddef %enddef
...@@ -117,19 +117,19 @@ namespace mln ...@@ -117,19 +117,19 @@ namespace mln
%define instantiate_gradient(Name, I, W) %define instantiate_gradient(Name, I, W)
// Explicit instantiation of this trait for the return type. // 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 >; %template(Name) mln::morpho::gradient< I, W >;
%enddef %enddef
%define instantiate_gradient_internal(Name, I, W) %define instantiate_gradient_internal(Name, I, W)
// Explicit instantiation of this trait for the return type. // 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 >; %template(Name) mln::morpho::gradient_internal< I, W >;
%enddef %enddef
%define instantiate_gradient_external(Name, I, W) %define instantiate_gradient_external(Name, I, W)
// Explicit instantiation of this trait for the return type. // 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 >; %template(Name) mln::morpho::gradient_external< I, W >;
%enddef %enddef
...@@ -165,7 +165,7 @@ namespace mln ...@@ -165,7 +165,7 @@ namespace mln
%define instantiate_watershed_flooding(Name, L, I, N) %define instantiate_watershed_flooding(Name, L, I, N)
// Explicit instantiation of this trait for the return type. // 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 >; %template(Name) mln::morpho::watershed::flooding< L, I, N >;
%enddef %enddef
...@@ -181,7 +181,7 @@ namespace mln ...@@ -181,7 +181,7 @@ namespace mln
%define instantiate_max_tree(Name, I, N) %define instantiate_max_tree(Name, I, N)
// Explicit instantiation of this trait for the return type. // 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 >; %template(Name) mln::morpho::tree::max< I, N >;
%enddef %enddef
......
#! /usr/bin/env python #! /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. # This file is part of Olena.
# #
...@@ -37,16 +38,7 @@ for p, v in itertools.izip(ima.domain(), values): ...@@ -37,16 +38,7 @@ for p, v in itertools.izip(ima.domain(), values):
ima.set(p, int_u8(v)) ima.set(p, int_u8(v))
image.println("ima =", ima) image.println("ima =", ima)
# FIXME: The type of the (Python) object returned by this call, max_tree_parent = image.max_tree(ima, c4())
# <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());
# FIXME: Overloading issue: Why can't we use # FIXME: Overloading issue: Why can't we use
# #
...@@ -54,4 +46,4 @@ max_tree_parent = image.max_tree(ima, c4()); ...@@ -54,4 +46,4 @@ max_tree_parent = image.max_tree(ima, c4());
# #
# ? # ?
## 2013-04-09: Disabled, until a solution is found. ## 2013-04-09: Disabled, until a solution is found.
#par_image.println(max_tree_parent) par_image.println(max_tree_parent)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment