* rgb.ixx: New file.
* Makefile.am (meta_wrappers): Add rgb.ixx.
* python/Makefile.am (rgb_ixx_deps): New variable.
---
swilena/ChangeLog | 8 ++
swilena/Makefile.am | 6 +-
swilena/python/Makefile.am | 1 +
swilena/rgb.ixx | 155 ++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 168 insertions(+), 2 deletions(-)
create mode 100644 swilena/rgb.ixx
diff --git a/swilena/ChangeLog b/swilena/ChangeLog
index 0860765..7d670b3 100644
--- a/swilena/ChangeLog
+++ b/swilena/ChangeLog
@@ -1,5 +1,13 @@
2010-02-08 Roland Levillain <roland(a)lrde.epita.fr>
+ Add a Swilena meta-wrapper for mln::value::rgb<n>.
+
+ * rgb.ixx: New file.
+ * Makefile.am (meta_wrappers): Add rgb.ixx.
+ * python/Makefile.am (rgb_ixx_deps): New variable.
+
+2010-02-08 Roland Levillain <roland(a)lrde.epita.fr>
+
Improve dependency management in Swilena/Python.
* python/Makefile.am (int_u_ixx_deps, box_ixx_deps)
diff --git a/swilena/Makefile.am b/swilena/Makefile.am
index 109fb2e..ea221a3 100644
--- a/swilena/Makefile.am
+++ b/swilena/Makefile.am
@@ -1,4 +1,5 @@
-# Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE).
+# Copyright (C) 2008, 2009, 2010 EPITA Research and Development
+# Laboratory (LRDE).
#
# This file is part of Olena.
#
@@ -32,7 +33,8 @@ meta_wrappers = \
morpho.ixx \
pgm.ixx \
println.ixx \
- python-utils.ixx
+ python-utils.ixx \
+ rgb.ixx
# Wrappers (generating actual modules).
wrappers = \
diff --git a/swilena/python/Makefile.am b/swilena/python/Makefile.am
index f6a834c..8f7faa9 100644
--- a/swilena/python/Makefile.am
+++ b/swilena/python/Makefile.am
@@ -197,6 +197,7 @@ nodist_python_PYTHON += dynamic_image2d.py
# Dependencies pulled by the meta wrapper (.ixx) files.
int_u_ixx_deps = $(top_srcdir)/swilena/python-utils.ixx
+rgb_ixx_deps = $(top_srcdir)/swilena/python-utils.ixx
box_ixx_deps = $(top_srcdir)/swilena/coord.ixx
diff --git a/swilena/rgb.ixx b/swilena/rgb.ixx
new file mode 100644
index 0000000..c5607f3
--- /dev/null
+++ b/swilena/rgb.ixx
@@ -0,0 +1,155 @@
+// -*- C++ -*-
+// Copyright (C) 2010 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+/// \file rgb.i
+/// \brief A wrapper of mln::value::rgb.
+
+%module rgb
+
+%{
+#include "mln/value/rgb.hh"
+%}
+
+// FIXME: Wrap mln::rgb by hand, for Milena macros disturb swig.
+// Annotate the original source code instead?
+namespace mln
+{
+
+ namespace value
+ {
+
+ /*! \brief Unsigned integer value class.
+ *
+ * The parameter is \c n the number of encoding bits.
+ */
+ template <unsigned n>
+ struct rgb
+ :
+ public Vectorial< rgb<n> >
+ ,
+ public internal::value_like_< algebra::vec< 3, int_u<n> >, // Equivalent.
+ algebra::vec< 3, int_u<n> >, // Encoding.
+ algebra::vec< 3, int >, // Interoperation.
+ rgb<n> > // Exact.
+ {
+ public:
+
+ typedef int_u<n> red_t;
+ typedef int_u<n> green_t;
+ typedef int_u<n> blue_t;
+
+ /// Acces to red/green/blue component.
+ /// \{
+ mln::value::int_u<n> red() const;
+ mln::value::int_u<n>& red();
+
+ mln::value::int_u<n> green() const;
+ mln::value::int_u<n>& green();
+
+ mln::value::int_u<n> blue() const;
+ mln::value::int_u<n>& blue();
+
+ mln::value::int_u<n> comp(unsigned k);
+ mln::value::int_u<n>& comp(unsigned k);
+ /// \}
+
+ /// Constructor without argument.
+ rgb<n>();
+
+ /// Constructor from component values.
+ rgb<n>(int r, int g, int b);
+
+ /// Constructor from a algebra::vec.
+ rgb<n>(const mln::algebra::vec<3, int>& rhs);
+ rgb<n>(const mln::algebra::vec<3, unsigned>& rhs);
+ rgb<n>(const mln::algebra::vec<3, mln::value::int_u<n> >& rhs);
+ rgb<n>(const mln::algebra::vec<3, float>& rhs);
+
+ // Conversion to the interoperation type.
+ operator mln::algebra::vec<3, int>() const;
+ // Conversion to the sum type.
+ operator mln::algebra::vec<3, float>() const;
+
+ /// Constructors with literals.
+ /// \{
+ rgb<n>(const mln::literal::white_t&);
+ rgb<n>(const mln::literal::black_t&);
+
+ rgb<n>(const mln::literal::light_gray_t&);
+ rgb<n>(const mln::literal::medium_gray_t&);
+ rgb<n>(const mln::literal::dark_gray_t&);
+
+ rgb<n>(const mln::literal::red_t&);
+ rgb<n>(const mln::literal::blue_t&);
+ rgb<n>(const mln::literal::green_t&);
+ rgb<n>(const mln::literal::brown_t&);
+ rgb<n>(const mln::literal::lime_t&);
+ rgb<n>(const mln::literal::orange_t&);
+ rgb<n>(const mln::literal::pink_t&);
+ rgb<n>(const mln::literal::purple_t&);
+ rgb<n>(const mln::literal::teal_t&);
+ rgb<n>(const mln::literal::violet_t&);
+ rgb<n>(const mln::literal::cyan_t&);
+ rgb<n>(const mln::literal::magenta_t&);
+ rgb<n>(const mln::literal::yellow_t&);
+ rgb<n>(const mln::literal::olive_t&);
+ /// \}
+
+ /// Assignment.
+ rgb<n>& operator=(const rgb<n>& rhs);
+
+ /// Zero value.
+ static const rgb<n> zero;
+ };
+
+
+ /*! \brief Print an unsigned integer \p i into the output stream \p ostr.
+ *
+ * \param[in,out] ostr An output stream.
+ * \param[in] i An unsigned integer.
+ *
+ * \return The modified output stream \p ostr.
+ */
+ template <unsigned n>
+ std::ostream& operator<<(std::ostream& ostr, const rgb<n>& i);
+
+ // FIXME: Doc!
+ template <unsigned n>
+ std::istream& operator>>(std::istream& istr, rgb<n>& i);
+
+ } // end of namespace mln::value
+
+} // end of namespace mln
+
+
+/*--------------------------------.
+| Conversion helpers for Python. |
+`--------------------------------*/
+
+#if SWIGPYTHON
+%include python-utils.ixx
+generate__str__(mln::value::rgb)
+#endif // !SWIGPYTHON
--
1.5.6.5
* Makefile.am: Here.
* python/Makefile.am: Likewise.
(python_PYTHON): Move data.py...
(EXTRA_DIST): ...here.
---
swilena/ChangeLog | 9 +++++++++
swilena/Makefile.am | 3 ---
swilena/python/Makefile.am | 13 ++++++-------
3 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/swilena/ChangeLog b/swilena/ChangeLog
index efa4e9b..3232f15 100644
--- a/swilena/ChangeLog
+++ b/swilena/ChangeLog
@@ -1,3 +1,12 @@
+2009-10-27 Roland Levillain <roland(a)lrde.epita.fr>
+
+ Clean up Swilena Makefiles.
+
+ * Makefile.am: Here.
+ * python/Makefile.am: Likewise.
+ (python_PYTHON): Move data.py...
+ (EXTRA_DIST): ...here.
+
2009-09-12 Roland Levillain <roland(a)lrde.epita.fr>
* neighb2d.i: Aesthetic changes.
diff --git a/swilena/Makefile.am b/swilena/Makefile.am
index c6fd023..109fb2e 100644
--- a/swilena/Makefile.am
+++ b/swilena/Makefile.am
@@ -14,9 +14,6 @@
# You should have received a copy of the GNU General Public License
# along with Olena. If not, see <http://www.gnu.org/licenses/>.
-
-## Process this file through Automake to produce Makefile.in.
-
SUBDIRS = python
# Meta-wrappers (templates), not generating a module, but factoring
diff --git a/swilena/python/Makefile.am b/swilena/python/Makefile.am
index aec8a05..0ad96da 100644
--- a/swilena/python/Makefile.am
+++ b/swilena/python/Makefile.am
@@ -13,9 +13,7 @@
#
# You should have received a copy of the GNU General Public License
# along with Olena. If not, see <http://www.gnu.org/licenses/>.
-#
-## Process this file through Automake to produce Makefile.in.
## ------------------ ##
## Generic material. ##
@@ -28,11 +26,11 @@ AM_CPPFLAGS = -I$(PYTHONINC) -I$(top_srcdir)/milena
TOOLS_CXXFLAGS = @TOOLS_CXXFLAGS@
AM_CXXFLAGS = $(TOOLS_CXXFLAGS)
AM_SWIGFLAGS = -Wall -c++ -python -I$(top_srcdir)/milena
-## We build modules, not plain libs.
+# We build modules, not plain libs.
AM_LDFLAGS = -avoid-version -module -shared
-## Run Swig to create the C++ wrapper files, the Python interface
-## files, and the dependency Makefile snippets.
+# Run Swig to create the C++ wrapper files, the Python interface
+# files, and the dependency Makefile snippets.
%-wrap.cc %.py: $(top_srcdir)/swilena/%.i
if $(SWIG) $(AM_SWIGFLAGS) $(SWIGFLAGS) -MD -MF "$(DEPDIR)/$*-wrap.Tcc" -o $@ $<; then \
mv -f "$(DEPDIR)/$*-wrap.Tcc" "$(DEPDIR)/$*-wrap.Pcc";\
@@ -45,8 +43,9 @@ AM_LDFLAGS = -avoid-version -module -shared
python_PYTHON = ltihooks.py
# swilena.py: The whole Swilena suite.
python_PYTHON += swilena.py
+
# data.py: Access to the data of the distribution (images, meshes, etc.)
-python_PYTHON += data.py
+EXTRA_DIST = data.py
## ----------------- ##
@@ -218,7 +217,7 @@ $(TESTS): $(srcdir)/run.stamp
# The dependency is on `run.in' and not `run', since `run' is
# regenerated at distribution time, and voids the time stamps (which
# we don't want!).
-EXTRA_DIST = $(srcdir)/run.stamp
+EXTRA_DIST += $(srcdir)/run.stamp
$(srcdir)/run.stamp: $(RUN_IN)
@rm -f $@
@rm -f $@.tmp
--
1.5.6.5