Matthieu Garrigues wrote:
> URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
>
> ChangeLog:
> 2007-10-08 Matthieu Garrigues <garrigues(a)lrde.epita.fr>
>
> Update on hexa images, create value_interop test.
> * mln/core/hexa.hh,
> * tests/hexa.cc: Update.
> ...
tegucigalpa% g++-4.1 -I.. hexa.cc
hexa.cc: In function 'int main()':
hexa.cc:54: error: 'struct main()::I' has no member named 'box'
hexa.cc:59: error: expected `;' before '}' token
A test can fail to compile but *not* for such a reason!
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-10-08 Matthieu Garrigues <garrigues(a)lrde.epita.fr>
Update on hexa images, create value_interop test.
* mln/core/hexa.hh,
* tests/hexa.cc: Update.
* tests/value_int_u.cc: Remove.
* tests/value_interop.cc: New.
---
mln/core/hexa.hh | 17 +++++++-
tests/hexa.cc | 13 ++++++
tests/value_interop.cc | 104 +++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 133 insertions(+), 1 deletion(-)
Index: trunk/milena/tests/value_int_u.cc (deleted)
===================================================================
Index: trunk/milena/tests/value_interop.cc
===================================================================
--- trunk/milena/tests/value_interop.cc (revision 0)
+++ trunk/milena/tests/value_interop.cc (revision 1273)
@@ -0,0 +1,104 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// 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. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/*! \file tests/value_interop.cc
+ *
+ * \brief Tests interoperability on mln::value::*.
+ */
+
+#include <mln/value/int_u8.hh>
+#include <mln/value/int_s8.hh>
+#include <mln/value/int_u16.hh>
+#include <mln/value/float01_8.hh>
+
+int main()
+{
+ using namespace mln;
+ using value::int_u8;
+ using value::int_s8;
+ using value::int_u16;
+ using value::float01_8;
+
+ {
+ // Operations on int_u<n>
+ int_u8 i = 128;
+ int_u16 j = 42;
+ int_s8 k = 42;
+ float01_8 x;
+
+ (j = j + i) = i + j;
+ assert(j == (128 + 42));
+
+ (k = j - i) = i - j;
+ assert(k == (-42));
+
+ j = 2;
+ (j = j * i) = i * j;
+ assert(j == (2 * 128));
+
+ (x = (j / i) / ((j / i) + 0.1))
+ = (i / j) / ((i / j) + 0.1);
+
+// std::cout << i + i << std::endl;
+// float01_8 f = i / 200.5;
+// std::cout << x << std::endl;
+ }
+
+ {
+ // Operations on int_u<n> and int / float
+ int_u16 j = 42;
+ int_s8 k = 42;
+ float x;
+
+ // int
+ (k = j - 123) = 123 - j;
+ (j = j + 123) = 123 + j;
+ (j = j * 4) = 4 * j;
+
+ (j = j / 4) = 4 / j;
+
+ // float
+ x = (j / 4.5 * 3.4 + 3.5 - 5.6) / 0.0234;
+ }
+
+
+ {
+ // Operations on int_u<n> and float01_8
+ int_u16 j = 42;
+ float01_8 x = 0.456;
+
+ x = x / j;
+ assert(x < 0 && x < 1);
+
+ x = x * j;
+ assert(x < 0 && x < 1);
+
+ x = x * j;
+ assert(x < 0 && x < 1);
+
+ }
+}
Index: trunk/milena/tests/hexa.cc
===================================================================
--- trunk/milena/tests/hexa.cc (revision 1272)
+++ trunk/milena/tests/hexa.cc (revision 1273)
@@ -34,6 +34,8 @@
#include <mln/core/hexa.hh>
#include <mln/value/int_u8.hh>
+#include <mln/trait/image/print.hh>
+
int main()
{
@@ -44,4 +46,15 @@
I ima(3,3);
hexa< I > h(ima);
+
+ trait::image::print(h, std::cout);
+
+
+ // FIXME : to put into debug::println
+ box_<point2d>::fwd_piter p(ima.box());
+
+ for_all(p)
+ {
+ p
+ }
}
Index: trunk/milena/mln/core/hexa.hh
===================================================================
--- trunk/milena/mln/core/hexa.hh (revision 1272)
+++ trunk/milena/mln/core/hexa.hh (revision 1273)
@@ -73,7 +73,7 @@
typedef trait::image::category::domain_morpher category;
- typedef trait::image::border::none border; // no more accessible border
+ typedef mln_trait_image_border(I) border; // have a border only if I does.
typedef mln_trait_image_io_from_(I) io; // un-write when I const
@@ -90,6 +90,21 @@
*
* The parameter \c I is the type of the base image. This image class
* which handles hexagonal grid.
+ *
+ * Ex :
+ * -------------------
+ * XX| | | | | | |XX
+ * ---------------------
+ * XX| | | | | | |XX
+ * ---------------------
+ * XX| | | | | | |XX
+ * ---------------------
+ * XX| | | | | | |XX
+ * ---------------------
+ * XX| | | | | | |XX
+ * -------------------
+ *
+ *
*/
template <typename I>
struct hexa : public internal::image_domain_morpher_< I, mln_pset(I), hexa<I> >
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-10-08 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
Move color_sub from sandbox into color_pretty in a new folder : display.
* display/color_pretty.hh: New.
* display: New folder for display.
---
color_pretty.hh | 97 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 97 insertions(+)
Index: trunk/milena/mln/display/color_pretty.hh
===================================================================
--- trunk/milena/mln/display/color_pretty.hh (revision 0)
+++ trunk/milena/mln/display/color_pretty.hh (revision 1271)
@@ -0,0 +1,97 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// 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. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_DISPLAY_COLOR_PRETTY_HH
+# define MLN_DISPLAY_COLOR_PRETTY_HH
+
+/*! \file mln/display/color_pretty.hh
+ *
+ * \brief Create a pretty image, which display its content
+ * with red value for non-defined point site.
+ */
+
+# include <mln/trait/image_from_mesh.hh>
+# include <mln/core/image_if_value.hh>
+# include <mln/core/image2d_b.hh>
+# include <mln/value/rgb8.hh>
+# include <mln/level/fill.hh>
+# include <mln/level/paste.hh>
+
+
+namespace mln
+{
+
+ namespace display
+ {
+
+ template <typename I>
+ typename trait::image_from_mesh < mln_mesh(I), value::rgb8 >::ret
+ color_pretty(const Image<I>& input_);
+
+# ifndef MLN_INCLUDE_ONLY
+
+ namespace impl
+ {
+
+ template <typename I>
+ typename trait::image_from_mesh < mln_mesh(I), value::rgb8 >::ret
+ color_pretty(const Image<I>& input_)
+ {
+ const I& input = exact (input_);
+
+ image2d_b<value::rgb8> output(input.domain().bbox());
+ level::fill(output, value::rgb8(255, 0, 0));
+
+// /// FIXME by :
+// level::paste(input, output);
+ {
+ mln_piter(I) p(input.domain());
+
+ for_all(p)
+ output(p) = value::rgb8(input(p));
+ }
+ return output;
+ }
+
+ } // end of namespace mln::display::impl
+
+ /// Facade.
+ template <typename I>
+ typename trait::image_from_mesh < mln_mesh(I), value::rgb8 >::ret
+ color_pretty(const Image<I>& input_)
+ {
+ return impl::color_pretty(input_);
+ }
+
+# endif // !MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::display
+
+} // end of namespace mln
+
+
+#endif // ! MLN_DISPLAY_COLOR_PRETTY_HH
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-10-08 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
Add test for color pretty.
* color_pretty.cc: New test for color pretty.
Update
* chamfer.cc: Update.
---
color_pretty.cc | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 71 insertions(+)
Index: trunk/milena/tests/chamfer.cc
===================================================================
Index: trunk/milena/tests/color_pretty.cc
===================================================================
--- trunk/milena/tests/color_pretty.cc (revision 0)
+++ trunk/milena/tests/color_pretty.cc (revision 1270)
@@ -0,0 +1,71 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// 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. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/*! \file tests/sub_image.cc
+ *
+ * \brief Tests on mln::sub_image.
+ */
+
+# include <mln/core/image2d_b.hh>
+# include <mln/io/pbm/load.hh>
+# include <mln/make/win_chamfer.hh>
+# include <mln/geom/chamfer.hh>
+# include <mln/value/rgb8.hh>
+# include <mln/core/sub_image.hh>
+# include <mln/core/image_if_value.hh>
+# include <mln/core/inplace.hh>
+# include <mln/core/w_window2d_int.hh>
+# include <mln/display/color_pretty.hh>
+# include <mln/io/ppm/save.hh>
+
+
+int main()
+{
+ using namespace mln;
+
+ unsigned max = 51;
+
+
+ image2d_b<bool> input = io::pbm::load("../img/toto.pbm");
+
+ // Create a weighted windows :
+ // 0 2 0
+ // 2 p 2
+ // 0 2 0
+ const w_window2d_int& w_win = win_chamfer::mk_chamfer_3x3_int<2, 0> ();
+
+ // Call chamfer for a distance image.
+ image2d_b<unsigned> tmp = geom::chamfer(input, w_win, max);
+
+ // Call color_pretty for sub_image.
+ image2d_b<value::rgb8> out = display::color_pretty(inplace (tmp | 4));
+
+ // Save output image from color in out.ppm.
+ io::ppm::save(out, "out.ppm");
+
+ std::cout << "out.ppm generate" << std::endl;
+}
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-10-08 Matthieu Garrigues <garrigues(a)lrde.epita.fr>
Add hexa images.
* mln/core/box2d_h.hh: New.
* mln/core/dpoint2d_h.hh: New.
* mln/core/hexa.hh: New.
* mln/core/point2d_h.hh: New.
* mln/make/box2d_h.hh: New.
* mln/make/dpoint2d_h.hh: New.
* mln/make/point2d_h.hh: New.
* tests/hexa.cc: New, Fixme : write more tests.
---
mln/core/box2d_h.hh | 58 ++++++++++++
mln/core/dpoint2d_h.hh | 68 ++++++++++++++
mln/core/hexa.hh | 230 +++++++++++++++++++++++++++++++++++++++++++++++++
mln/core/point2d_h.hh | 56 +++++++++++
mln/make/box2d_h.hh | 101 +++++++++++++++++++++
mln/make/dpoint2d_h.hh | 72 +++++++++++++++
mln/make/point2d_h.hh | 72 +++++++++++++++
tests/hexa.cc | 47 ++++++++++
8 files changed, 704 insertions(+)
Index: trunk/milena/tests/hexa.cc
===================================================================
--- trunk/milena/tests/hexa.cc (revision 0)
+++ trunk/milena/tests/hexa.cc (revision 1269)
@@ -0,0 +1,47 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// 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. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/*! \file tests/hexa.cc
+ *
+ * \brief Tests on mln::hexa
+ */
+
+#include <mln/core/image2d_b.hh>
+#include <mln/core/hexa.hh>
+
+#include <mln/value/int_u8.hh>
+
+int main()
+{
+ using namespace mln;
+ using typename value::int_u8;
+
+ typedef image2d_b<int_u8> I;
+
+ I ima(3,3);
+ hexa< I > h(ima);
+}
Index: trunk/milena/mln/core/hexa.hh
===================================================================
--- trunk/milena/mln/core/hexa.hh (revision 0)
+++ trunk/milena/mln/core/hexa.hh (revision 1269)
@@ -0,0 +1,230 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// 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. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+
+#ifndef MLN_CORE_HEXA_HH
+# define MLN_CORE_HEXA_HH
+
+
+/*! \file mln/core/hexa.hh
+ *
+ * \brief Definition of the mln::hexa class.
+ */
+
+# include <mln/core/internal/image_domain_morpher.hh>
+# include <mln/core/point2d_h.hh>
+
+
+namespace mln
+{
+ // Fwd decl.
+ template <typename I> class hexa;
+
+
+ namespace internal
+ {
+
+ template <typename I>
+ struct data_< hexa<I> >
+ {
+ data_(I& ima);
+
+ I ima_;
+ };
+
+ } // end of namespace mln::internal
+
+
+ namespace trait
+ {
+
+ template <typename I>
+ struct image_< hexa<I> > : default_image_morpher_< I, mln_value(I),
+ hexa<I> >
+ {
+ // private:
+ // typedef mln_trait_image_data(I) I_data_;
+ // typedef mlc_equal(I_data_, trait::data::linear) I_data_are_linear_;
+ // public:
+
+ typedef trait::image::category::domain_morpher category;
+
+ typedef trait::image::border::none border; // no more accessible border
+
+ typedef mln_trait_image_io_from_(I) io; // un-write when I const
+
+ typedef mln_trait_image_data_from_(I) data;
+ // typedef mlc_if( I_data_are_linear_,
+ // trait::data::stored, // if linear then just stored
+ // I_data_ ) data; // otherwise like I
+ };
+
+ } // end of namespace mln::trait
+
+
+ /*! \brief hexagonal image class.
+ *
+ * The parameter \c I is the type of the base image. This image class
+ * which handles hexagonal grid.
+ */
+ template <typename I>
+ struct hexa : public internal::image_domain_morpher_< I, mln_pset(I), hexa<I> >
+ {
+ /// Skeleton.
+ typedef hexa< tag::image_<I> > skeleton;
+
+ /// Value associated type.
+ typedef mln_value(I) value;
+
+ /// Lvalue associated type.
+ typedef mln_value(I) lvalue;
+
+ /// Return type of read-only access.
+ typedef mln_rvalue(I) rvalue;
+
+ /// Point site type
+ typedef point2d_h psite;
+
+ /// Constructor without argument.
+ hexa();
+
+ /// Constructor with an base image.
+ hexa(I& ima);
+
+ /// Initialization.
+ void init_(I& ima);
+
+ /// Give the definition domain.
+ const mln_pset(I)& domain() const;
+
+ /// Test if \p p belongs to the image domain.
+ bool has(const psite& p) const;
+ bool owns_(const psite& p) const;
+
+ /// Read-only access of pixel value at hexa point site \p p.
+ rvalue operator()(const point2d_h& p) const;
+
+ /// Read-write access of pixel value at hexa point site \p p.
+ value operator()(const point2d_h& p);
+ };
+
+ template <typename I, typename J>
+ void init_(tag::image_t, hexa<I>& target, const J& model);
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ // init_
+
+ template <typename I, typename J>
+ void init_(tag::image_t, hexa<I>& target, const J& model)
+ {
+ I ima;
+ init_(tag::image, ima, model);
+ target.init_(ima);
+ }
+
+
+
+ // internal::data_< hexa<I> >
+
+ namespace internal
+ {
+
+ template <typename I>
+ data_< hexa<I> >::data_(I& ima)
+ : ima_(ima)
+ {
+ }
+
+ } // end of namespace mln::internal
+
+
+ template <typename I>
+ void
+ hexa<I>::init_(I& ima)
+ {
+ mln_precondition(! this->has_data());
+ this->data_ = new internal::data_< hexa<I> >(ima);
+ }
+
+
+
+ template <typename I>
+ hexa<I>::hexa()
+ {
+ }
+
+
+ template <typename I>
+ hexa<I>::hexa(I& ima)
+ {
+ this->init_(ima);
+ }
+
+ template <typename I>
+ typename hexa<I>::rvalue
+ hexa<I>::operator()(const point2d_h& p) const
+ {
+ return this->data_->ima_(make::point2d(p[0] / 2, p[1] / 2));
+ }
+
+ template <typename I>
+ typename hexa<I>::value
+ hexa<I>::operator()(const point2d_h& p)
+ {
+ return this->data_->ima_(make::point2d(p[0] / 2, p[1] / 2));
+ }
+
+ template <typename I>
+ const mln_pset(I)&
+ hexa<I>::domain() const
+ {
+ return this->data_->ima_.domain();
+ }
+
+ template <typename I>
+ bool
+ hexa<I>::has(const psite& p) const
+ {
+ return this->data_->ima_.has(make::point2d(p[0] / 2, p[1] / 2));
+ }
+
+
+ template <typename I>
+ bool
+ hexa<I>::owns_(const psite& p) const
+ {
+ return this->has(p);
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+} // end of namespace mln
+
+
+#endif // ! MLN_CORE_HEXA_HH
Index: trunk/milena/mln/core/dpoint2d_h.hh
===================================================================
--- trunk/milena/mln/core/dpoint2d_h.hh (revision 0)
+++ trunk/milena/mln/core/dpoint2d_h.hh (revision 1269)
@@ -0,0 +1,68 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// 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. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_CORE_DPOINT2D_H_HH
+# define MLN_CORE_DPOINT2D_H_HH
+
+/*! \file mln/core/dpoint2d_h.hh
+ *
+ * \brief Definition of the mln::dpoint2d_h alias and of its
+ * construction routine.
+ */
+
+# include <mln/core/dpoint.hh>
+
+
+namespace mln
+{
+
+ /*! \brief Type alias for a delta-point defined on the 2D square
+ * grid with integer coordinates.
+ */
+ typedef dpoint_<grid::hexa, int> dpoint2d_h;
+
+
+} // end of namespace mln
+
+
+# include <mln/make/dpoint2d_h.hh>
+# include <mln/core/point2d_h.hh>
+
+
+namespace mln
+{
+
+ // FIXME: Doc!
+ const dpoint2d_h up_h = make::dpoint2d_h( -1, 0 );
+ const dpoint2d_h down_h = make::dpoint2d_h( +1, 0 );
+ const dpoint2d_h left_h = make::dpoint2d_h( 0, -1 );
+ const dpoint2d_h right_h = make::dpoint2d_h( 0, +1 );
+
+} // end of namespace mln
+
+
+#endif // ! MLN_CORE_DPOINT2D_H_HH
Index: trunk/milena/mln/core/box2d_h.hh
===================================================================
--- trunk/milena/mln/core/box2d_h.hh (revision 0)
+++ trunk/milena/mln/core/box2d_h.hh (revision 1269)
@@ -0,0 +1,58 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// 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. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_CORE_BOX2D_HH
+# define MLN_CORE_BOX2D_HH
+
+/*! \file mln/core/box2d.hh
+ *
+ * \brief Definition of the mln::box2d alias and of construction
+ * routines.
+ */
+
+# include <mln/core/box.hh>
+# include <mln/core/point2d_h.hh>
+
+
+namespace mln
+{
+
+ /*! \brief Type alias for a box defined on the 2D square grid with
+ * integer coordinates.
+ *
+ * \see mln::win::rectangle2d.
+ */
+ typedef box_<point2d_h> box2d_h;
+
+
+} // end of namespace mln
+
+
+# include <mln/make/box2d_h.hh>
+
+
+#endif // ! MLN_CORE_BOX2D_HH
Index: trunk/milena/mln/core/point2d_h.hh
===================================================================
--- trunk/milena/mln/core/point2d_h.hh (revision 0)
+++ trunk/milena/mln/core/point2d_h.hh (revision 1269)
@@ -0,0 +1,56 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// 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. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_CORE_POINT2D_H_HH
+# define MLN_CORE_POINT2D_H_HH
+
+/*! \file mln/core/point2d_h.hh
+ *
+ * \brief Definition of the mln::point2d_h alias and of its construction
+ * routine.
+ */
+
+# include <mln/core/point.hh>
+
+
+namespace mln
+{
+
+ /*! \brief Type alias for a point defined on the 2D square grid with
+ * integer coordinates.
+ */
+ typedef point_<grid::hexa, int> point2d_h;
+
+
+} // end of namespace mln
+
+
+# include <mln/make/point2d_h.hh>
+# include <mln/core/dpoint2d_h.hh>
+
+
+#endif // ! MLN_CORE_POINT2D_H_HH
Index: trunk/milena/mln/make/box2d_h.hh
===================================================================
--- trunk/milena/mln/make/box2d_h.hh (revision 0)
+++ trunk/milena/mln/make/box2d_h.hh (revision 1269)
@@ -0,0 +1,101 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// 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. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_MAKE_BOX2D_H_HH
+# define MLN_MAKE_BOX2D_H_HH
+
+/*! \file mln/make/box2d_h.hh
+ *
+ * \brief Routines to construct an mln::box2d_h.
+ */
+
+# include <mln/core/box2d_h.hh>
+# include <mln/make/point2d_h.hh>
+
+
+namespace mln
+{
+
+ namespace make
+ {
+
+ /*! \brief Create an mln::box2d_h.
+ *
+ * \param[in] nrows Number of rows.
+ * \param[in] ncols Number of columns.
+ *
+ * \pre \p nrows != 0 and \p ncols != 0.
+ *
+ * \return A 2D_H box.
+ */
+ mln::box2d_h box2d_h(unsigned nrows, unsigned ncols);
+
+
+ /*! \brief Create an mln::box2d_h.
+ *
+ * \overload
+ *
+ * \param[in] min_row Index of the top most row.
+ * \param[in] min_col Index of the left most column.
+ * \param[in] max_row Index of the botton most row.
+ * \param[in] max_col Index of the right most column.
+ *
+ * \pre \p max_row >= \p min_row and \p max_col >= \p min_col.
+ *
+ * \return A 2D_H box.
+ */
+ mln::box2d_h box2d_h(int min_row, int min_col,
+ int max_row, int max_col);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ mln::box2d_h box2d_h(unsigned nrows, unsigned ncols)
+ {
+ mln_precondition(nrows != 0 && ncols != 0);
+ mln::box2d_h tmp(make::point2d_h(0, 0),
+ make::point2d_h(nrows - 1, ncols - 1));
+ return tmp;
+ }
+
+ mln::box2d_h box2d_h(int min_row, int min_col,
+ int max_row, int max_col)
+ {
+ mln_precondition(max_row >= min_row && max_col >= min_col);
+ mln::box2d_h tmp(make::point2d_h(min_row, min_col),
+ make::point2d_h(max_row, max_col));
+ return tmp;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::make
+
+} // end of namespace mln
+
+
+#endif // ! MLN_MAKE_BOX2D_H_HH
Index: trunk/milena/mln/make/point2d_h.hh
===================================================================
--- trunk/milena/mln/make/point2d_h.hh (revision 0)
+++ trunk/milena/mln/make/point2d_h.hh (revision 1269)
@@ -0,0 +1,72 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// 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. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_MAKE_POINT2D_H_HH
+# define MLN_MAKE_POINT2D_H_HH
+
+/*! \file mln/make/point2d_h.hh
+ *
+ * \brief Routine to construct an mln::point2d_h.
+ */
+
+# include <mln/core/point2d_h.hh>
+
+
+namespace mln
+{
+
+ namespace make
+ {
+
+ /*! \brief Create an mln::point2d_h.
+ *
+ * \param[in] row Row coordinate.
+ * \param[in] col Column coordinate.
+ *
+ * \return A 2D point.
+ */
+ mln::point2d_h point2d_h(int row, int col);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ mln::point2d_h point2d_h(int row, int col)
+ {
+ mln::point2d_h tmp;
+ tmp[0] = row;
+ tmp[1] = col;
+ return tmp;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::make
+
+} // end of namespace mln
+
+
+#endif // ! MLN_MAKE_POINT2D_H_HH
Index: trunk/milena/mln/make/dpoint2d_h.hh
===================================================================
--- trunk/milena/mln/make/dpoint2d_h.hh (revision 0)
+++ trunk/milena/mln/make/dpoint2d_h.hh (revision 1269)
@@ -0,0 +1,72 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// 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. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_MAKE_DPOINT2D_H_HH
+# define MLN_MAKE_DPOINT2D_H_HH
+
+/*! \file mln/make/dpoint2d_h.hh
+ *
+ * \brief Routine to construct an mln::dpoint2d_h.
+ */
+
+# include <mln/core/dpoint2d_h.hh>
+
+
+namespace mln
+{
+
+ namespace make
+ {
+
+ /*! \brief Create an mln::dpoint2d_h.
+ *
+ * \param[in] row Row coordinate.
+ * \param[in] col Column coordinate.
+ *
+ * \return A 2D dpoint.
+ */
+ mln::dpoint2d_h dpoint2d_h(int row, int col);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ mln::dpoint2d_h dpoint2d_h(int row, int col)
+ {
+ mln::dpoint2d_h tmp;
+ tmp[0] = row;
+ tmp[1] = col;
+ return tmp;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::make
+
+} // end of namespace mln
+
+
+#endif // ! MLN_MAKE_DPOINT2D_H_HH
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Fix value concepts and related file inclusions.
* tests/value_scalar.cc: New.
* tests/value_gray.cc: Rename as...
* tests/value_graylevel.cc: ...this.
(assert): Change to...
(mln_assertion): ...this!
* tests/trait_op_plus.cc,
* mln/metal/mat.hh,
* mln/metal/vec.hh: Include value concepts.
* mln/trait/image/print.hh: (print). New overload.
* mln/trait/op: New directory; to be populated.
* mln/core/ops.hh: Remove dead code.
* mln/value/graylevel.hh: Layout.
* mln/value/scalar.hh: New.
* mln/value/builtin.hh: Replace includes by decls.
* mln/value/concept/symbolic.hh,
* mln/value/concept/floating.hh,
* mln/value/concept/integer.hh,
* mln/value/concept/structured.hh,
* mln/value/concept/scalar.hh,
* mln/value/concept/vectorial.hh: Fix.
* mln/value/concept/all.hh: New.
mln/core/ops.hh | 13 +++
mln/metal/mat.hh | 1
mln/metal/vec.hh | 1
mln/trait/image/print.hh | 9 ++
mln/value/builtin.hh | 14 +--
mln/value/concept/all.hh | 43 +++++++++++
mln/value/concept/floating.hh | 21 +++--
mln/value/concept/integer.hh | 22 ++++--
mln/value/concept/scalar.hh | 18 +++--
mln/value/concept/structured.hh | 23 ++++--
mln/value/concept/symbolic.hh | 21 ++++-
mln/value/concept/vectorial.hh | 21 ++++-
mln/value/graylevel.hh | 3
mln/value/scalar.hh | 144 ++++++++++++++++++++++++++++++++++++++++
tests/trait_op_plus.cc | 1
tests/value_graylevel.cc | 16 +++-
tests/value_scalar.cc | 51 ++++++++++++++
17 files changed, 372 insertions(+), 50 deletions(-)
Index: tests/value_scalar.cc
--- tests/value_scalar.cc (revision 0)
+++ tests/value_scalar.cc (revision 0)
@@ -0,0 +1,51 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// 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. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/*! \file tests/value_scalar.cc
+ *
+ * \brief Tests on mln::value::scalar.
+ */
+
+#include <iostream>
+#include <mln/value/scalar.hh>
+
+
+template <typename T>
+void foo(const T& t)
+{
+ std::cout << mln::value::scalar(t) << std::endl;
+}
+
+
+int main()
+{
+ using namespace mln;
+
+ int i = 51;
+ foo(i);
+ foo( value::scalar(i) );
+}
Index: tests/trait_op_plus.cc
--- tests/trait_op_plus.cc (revision 1267)
+++ tests/trait_op_plus.cc (working copy)
@@ -31,6 +31,7 @@
*/
#include <mln/core/concept/image.hh>
+#include <mln/value/concept/all.hh>
#include <mln/trait/op_plus.hh>
Index: tests/value_graylevel.cc
--- tests/value_graylevel.cc (revision 1264)
+++ tests/value_graylevel.cc (working copy)
@@ -25,22 +25,30 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
+/*! \file tests/value_graylevel.cc
+ *
+ * \brief Tests on mln::value::graylevel.
+ */
+
#include <mln/value/graylevel.hh>
+
int main()
{
using namespace mln::value;
gl8 a = white;
gl16 b = white;
- assert((a = b) = true);
+ mln_assertion(a = b);
+
gl8 c = (a + b) / 2;
- assert(c = white);
+ mln_assertion(c = white);
+
c = a;
- assert(c = white);
+ mln_assertion(c = white);
c = (a * 2) / 2;
- assert(c = white);
+ mln_assertion(c = white);
c = c / 6;
}
Index: mln/trait/image/print.hh
--- mln/trait/image/print.hh (revision 1267)
+++ mln/trait/image/print.hh (working copy)
@@ -55,6 +55,9 @@
template <typename I>
void print(std::ostream& ostr);
+ template <typename I>
+ void print(const Image<I>& ima, std::ostream& ostr);
+
# ifndef MLN_INCLUDE_ONLY
@@ -78,6 +81,12 @@
<< typename the::speed() .name() << " }" << std::endl;
}
+ template <typename I>
+ void print(const Image<I>&, std::ostream& ostr)
+ {
+ print<I>(ostr);
+ }
+
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln::trait::image
Index: mln/core/ops.hh
--- mln/core/ops.hh (revision 1267)
+++ mln/core/ops.hh (working copy)
@@ -99,6 +99,18 @@
// Operator +.
+ // FIXME HERE
+
+// namespace trait {
+
+// template < typename L, typename R >
+// struct set_binary_< op_plus, Built_In, L, Object, R >
+// {
+// typedef mln_trait_op_plus(R, L)
+// };
+
+// }
+
// FIXME: Doc!
template <typename O>
mln_trait_op_plus(O, int)
@@ -123,6 +135,7 @@
return exact(rhs) + lhs;
}
+
// Operator *.
// FIXME: Doc!
Index: mln/metal/mat.hh
--- mln/metal/mat.hh (revision 1267)
+++ mln/metal/mat.hh (working copy)
@@ -34,6 +34,7 @@
# include <mln/core/contract.hh>
# include <mln/trait/all.hh>
# include <mln/value/props.hh>
+# include <mln/value/concept/all.hh>
// FIXME: Document.
Index: mln/metal/vec.hh
--- mln/metal/vec.hh (revision 1267)
+++ mln/metal/vec.hh (working copy)
@@ -36,6 +36,7 @@
# include <mln/value/props.hh>
# include <mln/fun/i2v/all.hh>
# include <mln/literal/zero.hh>
+# include <mln/value/concept/all.hh>
// FIXME: Document.
Index: mln/value/graylevel.hh
--- mln/value/graylevel.hh (revision 1267)
+++ mln/value/graylevel.hh (working copy)
@@ -29,15 +29,18 @@
# define MLN_CORE_VALUE_GRAYLEVEL_HH
# include <iostream>
+
# include <mln/core/contract.hh>
# include <mln/metal/math.hh>
# include <mln/metal/bexpr.hh>
+
# include <mln/value/internal/value_like.hh>
# include <mln/value/concept/integer.hh>
# include <mln/value/internal/encoding.hh>
# include <mln/value/gray.hh>
# include <mln/value/props.hh>
+
namespace mln
{
Index: mln/value/scalar.hh
--- mln/value/scalar.hh (revision 0)
+++ mln/value/scalar.hh (revision 0)
@@ -0,0 +1,144 @@
+// Copyright (C) 2006, 2007 EPITA Research and Development Laboratory
+//
+// 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. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_VALUE_SCALAR_HH
+# define MLN_VALUE_SCALAR_HH
+
+# include <mln/value/concept/scalar.hh>
+# include <mln/metal/is_a.hh>
+# include <mln/metal/if.hh>
+
+
+
+namespace mln
+{
+
+ namespace value
+ {
+
+ template <typename T>
+ class scalar_ : public Scalar< scalar_<T> >
+ {
+ public:
+
+ /// Encoding associated type.
+ typedef T enc; // FIXME
+
+ /// Equivalent associated type.
+ typedef T equiv; // FIXME
+
+
+ /// Ctor.
+ scalar_();
+
+ /// Ctor.
+ scalar_(const T& val);
+
+ /// Conversion.
+ operator T() const;
+
+ protected:
+ T val_; // FIXME: const&?
+ };
+
+
+ template <typename T>
+ class scalar_< scalar_<T> >; // Safety.
+
+
+
+ template <typename T>
+ std::ostream& operator<<(std::ostream& ostr, const scalar_<T>& s);
+
+
+
+ namespace internal
+ {
+
+ template <typename T>
+ struct helper_scalar_
+ {
+ typedef mlc_is_a(T, Scalar) is_scalar_;
+ typedef mlc_if(is_scalar_, T, scalar_<T>) ret;
+ };
+
+ } // end of namespace mln::value::internal
+
+
+ // Routine.
+ template <typename T>
+ typename internal::helper_scalar_<T>::ret
+ scalar(const T& s); // FIXME: if T already is a scalar_...
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ // scalar_<T>.
+
+ template <typename T>
+ scalar_<T>::scalar_()
+ {
+ }
+
+ template <typename T>
+ scalar_<T>::scalar_(const T& val)
+ : val_(val)
+ {
+ }
+
+ template <typename T>
+ scalar_<T>::operator T() const
+ {
+ return val_;
+ }
+
+ // Operator.
+
+ template <typename T>
+ std::ostream& operator<<(std::ostream& ostr, const scalar_<T>& s)
+ {
+ return ostr << T(s);
+ }
+
+ // Routine.
+
+ template <typename T>
+ typename internal::helper_scalar_<T>::ret
+ scalar(const T& s)
+ {
+ return s;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::value
+
+} // end of namespace mln
+
+
+#endif // ! MLN_VALUE_SCALAR_HH
Index: mln/value/builtin.hh
--- mln/value/builtin.hh (revision 1267)
+++ mln/value/builtin.hh (working copy)
@@ -32,16 +32,19 @@
* \brief Some definitions about builtins.
*/
-# include <mln/value/concept/symbolic.hh>
-# include <mln/value/concept/integer.hh>
-# include <mln/value/concept/floating.hh>
+# include <mln/core/category.hh>
+
namespace mln
{
// Fwd decl.
template <typename E> struct Value;
-
+ namespace value {
+ template <typename E> struct Symbolic;
+ template <typename E> struct Integer;
+ template <typename E> struct Floating;
+ }
// The case of built-in types.
@@ -68,7 +71,4 @@
} // end of namespace mln
-# include <mln/core/concept/value.hh>
-
-
#endif // ! MLN_VALUE_BUILTIN_HH
Index: mln/value/concept/symbolic.hh
--- mln/value/concept/symbolic.hh (revision 1267)
+++ mln/value/concept/symbolic.hh (working copy)
@@ -25,19 +25,26 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_VALUE_CONCEPT_VALUE_SYMBOLIC_HH
-# define MLN_VALUE_CONCEPT_VALUE_SYMBOLIC_HH
+#ifndef MLN_VALUE_CONCEPT_SYMBOLIC_HH
+# define MLN_VALUE_CONCEPT_SYMBOLIC_HH
-/*! \file mln/value/symbolic.hh
+/*! \file mln/value/concept/symbolic.hh
*
* \brief Define a generic class for symbolic values.
*/
+# include <mln/core/concept/value.hh>
+
+
namespace mln
{
- // Fwd decl.
+ // Fwd decls.
template <typename E> struct Value;
+ namespace value
+ {
+ template <typename E> struct Symbolic;
+ }
namespace trait
{
@@ -68,6 +75,8 @@
} // end of namespace mln
-# include <mln/core/concept/value.hh>
-#endif // ! MLN_VALUE_CONCEPT_VALUE_SYMBOLIC_HH
+# include <mln/value/concept/all.hh>
+
+
+#endif // ! MLN_VALUE_CONCEPT_SYMBOLIC_HH
Index: mln/value/concept/floating.hh
--- mln/value/concept/floating.hh (revision 1267)
+++ mln/value/concept/floating.hh (working copy)
@@ -25,19 +25,26 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_VALUE_CONCEPT_VALUE_FLOATING_HH
-# define MLN_VALUE_CONCEPT_VALUE_FLOATING_HH
+#ifndef MLN_VALUE_CONCEPT_FLOATING_HH
+# define MLN_VALUE_CONCEPT_FLOATING_HH
-/*! \file mln/value/floating.hh
+/*! \file mln/value/concept/floating.hh
*
* \brief Define a generic class for float values.
*/
# include <mln/value/concept/scalar.hh>
+
namespace mln
{
+ // Fwd decl.
+ namespace value
+ {
+ template <typename E> struct Floating;
+ }
+
namespace trait
{
// FIXME
@@ -46,9 +53,6 @@
namespace value
{
- // Fwd decl.
- template <typename E> struct Floating;
-
// Category flag type.
template <>
struct Floating<void>
@@ -66,4 +70,7 @@
} // end of namespace mln
-#endif // ! MLN_VALUE_CONCEPT_VALUE_FLOATING_HH
+# include <mln/value/concept/all.hh>
+
+
+#endif // ! MLN_VALUE_CONCEPT_FLOATING_HH
Index: mln/value/concept/structured.hh
--- mln/value/concept/structured.hh (revision 1267)
+++ mln/value/concept/structured.hh (working copy)
@@ -25,29 +25,36 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_VALUE_CONCEPT_VALUE_STRUCTURED_HH
-# define MLN_VALUE_CONCEPT_VALUE_STRUCTURED_HH
+#ifndef MLN_VALUE_CONCEPT_STRUCTURED_HH
+# define MLN_VALUE_CONCEPT_STRUCTURED_HH
-/*! \file mln/value/structured.hh
+/*! \file mln/value/concept/structured.hh
*
* \brief Define a generic class for structured values.
*/
+# include <mln/core/concept/value.hh>
+
+
namespace mln
{
// Fwd decl.
- template <typename E> struct Value;
+ namespace value
+ {
+ template <typename E> struct Structured;
+ }
+
namespace trait
{
// FIXME
} // end of namespace mln::trait
+
namespace value
{
-
// Fwd decl.
template <typename E> struct Structured;
@@ -67,6 +74,8 @@
} // end of namespace mln
-# include <mln/core/concept/value.hh>
-#endif // ! MLN_VALUE_CONCEPT_VALUE_STRUCTURED_HH
+# include <mln/value/concept/all.hh>
+
+
+#endif // ! MLN_VALUE_CONCEPT_STRUCTURED_HH
Index: mln/value/concept/scalar.hh
--- mln/value/concept/scalar.hh (revision 1267)
+++ mln/value/concept/scalar.hh (working copy)
@@ -25,19 +25,26 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_VALUE_CONCEPT_VALUE_SCALAR_HH
-# define MLN_VALUE_CONCEPT_VALUE_SCALAR_HH
+#ifndef MLN_VALUE_CONCEPT_SCALAR_HH
+# define MLN_VALUE_CONCEPT_SCALAR_HH
-/*! \file mln/value/scalar.hh
+/*! \file mln/value/concept/scalar.hh
*
* \brief Define a generic class for scalar values.
*/
+# include <mln/core/concept/value.hh>
+
+
namespace mln
{
- // Fwd decl.
+ // Fwd decls.
template <typename E> struct Value;
+ namespace value
+ {
+ template <typename E> struct Scalar;
+ }
namespace trait
{
@@ -66,6 +73,5 @@
} // end of namespace mln
-# include <mln/core/concept/value.hh>
-#endif // ! MLN_VALUE_CONCEPT_VALUE_SCALAR_HH
+#endif // ! MLN_VALUE_CONCEPT_SCALAR_HH
Index: mln/value/concept/vectorial.hh
--- mln/value/concept/vectorial.hh (revision 1267)
+++ mln/value/concept/vectorial.hh (working copy)
@@ -25,19 +25,25 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_VALUE_CONCEPT_VALUE_VECTORIEL_HH
-# define MLN_VALUE_CONCEPT_VALUE_VECTORIEL_HH
+#ifndef MLN_VALUE_CONCEPT_VECTORIAL_HH
+# define MLN_VALUE_CONCEPT_VECTORIAL_HH
-/*! \file mln/value/vectorial.hh
+/*! \file mln/value/concept/vectorial.hh
*
* \brief Define a generic class for vectorial values.
*/
+# include <mln/core/concept/value.hh>
+
+
namespace mln
{
// Fwd decl.
- template <typename E> struct Value;
+ namespace value
+ {
+ template <typename E> struct Vectorial;
+ }
namespace trait
{
@@ -46,6 +52,7 @@
} // end of namespace mln::trait
+
namespace value
{
@@ -68,6 +75,8 @@
} // end of namespace mln
-# include <mln/core/concept/value.hh>
-#endif // ! MLN_VALUE_CONCEPT_VALUE_VECTORIEL_HH
+# include <mln/value/concept/all.hh>
+
+
+#endif // ! MLN_VALUE_CONCEPT_VECTORIAL_HH
Index: mln/value/concept/all.hh
--- mln/value/concept/all.hh (revision 0)
+++ mln/value/concept/all.hh (revision 0)
@@ -0,0 +1,43 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// 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. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_VALUE_CONCEPT_ALL_HH
+# define MLN_VALUE_CONCEPT_ALL_HH
+
+/*! \file mln/value/concept/all.hh
+ *
+ * \brief FIXME
+ */
+
+# include <mln/value/concept/integer.hh>
+# include <mln/value/concept/floating.hh>
+# include <mln/value/concept/vectorial.hh>
+# include <mln/value/concept/structured.hh>
+# include <mln/value/concept/symbolic.hh>
+
+
+#endif // ! MLN_VALUE_CONCEPT_ALL_HH
Index: mln/value/concept/integer.hh
--- mln/value/concept/integer.hh (revision 1267)
+++ mln/value/concept/integer.hh (working copy)
@@ -25,18 +25,26 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_VALUE_CONCEPT_VALUE_INTEGER_HH
-# define MLN_VALUE_CONCEPT_VALUE_INTEGER_HH
+#ifndef MLN_VALUE_CONCEPT_INTEGER_HH
+# define MLN_VALUE_CONCEPT_INTEGER_HH
-/*! \file mln/value/integer.hh
+/*! \file mln/value/concept/integer.hh
*
* \brief Define a generic class for integer values.
*/
# include <mln/value/concept/scalar.hh>
+
namespace mln
{
+
+ // Fwd decl.
+ namespace value
+ {
+ template <typename E> struct Integer;
+ }
+
namespace trait
{
// FIXME
@@ -45,9 +53,6 @@
namespace value
{
- // Fwd decl.
- template <typename E> struct Integer;
-
// Category flag type.
template <>
struct Integer<void>
@@ -65,4 +70,7 @@
} // end of namespace mln
-#endif // ! MLN_VALUE_CONCEPT_VALUE_INTEGER_HH
+# include <mln/value/concept/all.hh>
+
+
+#endif // ! MLN_VALUE_CONCEPT_INTEGER_HH