[PATCH 05/27] Wrap mln::box as box.ixx to factor dependent types.

* box.ixx: New. * Makefile.am (meta_wrappers): Add box.ixx. --- swilena/ChangeLog | 7 +++++ swilena/Makefile.am | 1 + swilena/box.ixx | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 81 insertions(+), 0 deletions(-) create mode 100644 swilena/box.ixx diff --git a/swilena/ChangeLog b/swilena/ChangeLog index 6de45fa..07f35a2 100644 --- a/swilena/ChangeLog +++ b/swilena/ChangeLog @@ -1,5 +1,12 @@ 2009-06-01 Roland Levillain <roland@lrde.epita.fr> + Wrap mln::box as box.ixx to factor dependent types. + + * box.ixx: New. + * Makefile.am (meta_wrappers): Add box.ixx. + +2009-06-01 Roland Levillain <roland@lrde.epita.fr> + Introduce a variadic version of mln_coord in Swilena. * coord.ixx: New. diff --git a/swilena/Makefile.am b/swilena/Makefile.am index 2922542..69dc4cf 100644 --- a/swilena/Makefile.am +++ b/swilena/Makefile.am @@ -5,6 +5,7 @@ SUBDIRS = python # Meta-wrappers (templates), not generating a module, but factoring # common parts. meta_wrappers = \ + box.ixx \ box_piter.ixx \ ch_value.ixx \ concat.ixx \ diff --git a/swilena/box.ixx b/swilena/box.ixx new file mode 100644 index 0000000..98cb9fc --- /dev/null +++ b/swilena/box.ixx @@ -0,0 +1,73 @@ +// -*- C++ -*- +// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE) +// +// This file is part of the Olena Library. This library is free +// software; you can redistribute it and/or modify it under the terms +// of the GNU General Public License version 2 as published by the +// Free Software Foundation. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this library; see the file COPYING. If not, write to +// the Free Software Foundation, 51 Franklin Street, Fifth Floor, +// Boston, MA 02111-1307, USA. +// +// As a special exception, you may use this file as part of a free +// software library without restriction. Specifically, if other files +// instantiate templates or use macros or inline functions from this +// file, or you compile this file and link it with other files to +// produce an executable, this file does not by itself cause the +// resulting executable to be covered by the GNU General Public +// License. +// reasons why the executable file might be covered by the GNU General +// Public License. + +/// \file box.ixx +/// \brief A wrapper of mln::box<P>. + +%{ +#include "mln/core/site_set/box.hh" +%} + +%include "mln/core/macros.hh"; +%include "mln/metal/is_unqualif.hh"; + +%include "mln/core/site_set/box.hh"; + +%include "coord.ixx" + +/** Instantiate an mln::box<P> type. + + The variadic argument ``P...'' is used to allow template type + names having commas (e.g. mln::point<grid::square, def::coord) as + argument. */ +%define instantiate_box(Name, P...) +/* Swig tries to wrap everything by default; prevent it from wrapping + methods that may be invalid (1D and 3D ctors for an mln::box2d). + Anyway, as Python does not automatically convert `int's to + `short's, these these ctors taking `mln::def::coord's are not + really useful. */ +%ignore mln::box< P >::box(swl_coord(P)); +%ignore mln::box< P >::box(swl_coord(P), swl_coord(P)); +%ignore mln::box< P >::box(swl_coord(P), swl_coord(P), swl_coord(P)); + +// Python interface. +#if SWIGPYTHON +%extend mln::box< P > +{ + mln::box_fwd_piter_< P > + __iter__() const + { + mln::box_fwd_piter_< P > p(*$self); + p.start(); + return p; + } +} +#endif // !SWIGPYTHON + +%template(Name) mln::box< P >; +%enddef // !instantiate_box -- 1.6.1.2
participants (1)
-
Roland Levillain