LRE
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
April
March
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
List overview
Download
Olena-patches
----- 2025 -----
April 2025
March 2025
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
olena-patches@lrde.epita.fr
9625 discussions
Start a n
N
ew thread
proto-1.0 17: Add tests for readonly and readwrite images
by Simon Odou
Index: ChangeLog from Simon Odou <simon(a)lrde.epita.fr> * tests/core/tests/readonly_image: New. * tests/core/tests/readwrite_image: New. readonly_image | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ readwrite_image | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 120 insertions(+) Index: tests/core/tests/readonly_image --- tests/core/tests/readonly_image (revision 0) +++ tests/core/tests/readonly_image (revision 0) @@ -0,0 +1,60 @@ +#include <iostream> + +#include <ntg/real/int_u8.hh> +#include <oln/basics2d.hh> + +#include "check.hh" +#include "data.hh" + +namespace oln { + + struct dummy_image; + + template <> + struct category_type< dummy_image > { typedef cat::image ret; }; + + template <> + struct props <cat::image, dummy_image> : + public default_props < cat::image > + { + typedef size2d size_type; + typedef point2d point_type; + typedef ntg::int_u8 value_type; + + typedef mlc_encoding_type_(value_type) value_storage_type; + typedef array2d<value_storage_type> value_container_type; + + typedef tag::readonly constness_tag; + typedef tag::dimension2 dimension_tag; + typedef mlc::no_type delegated_type; + }; + + struct dummy_image : public abstract::image_with_data< dummy_image > + { + + typedef abstract::image_with_data< dummy_image > super_type; + + dummy_image() + { + this->exact_ptr = this; + } + + dummy_image(coord_t nrows, coord_t ncols) : + super_type(size2d(nrows, ncols)) + { + this->exact_ptr = this; + } + + }; + +} // end of namespace test + + + +bool check() +{ + oln::dummy_image ima(3, 3); + // COMPFAIL + ima[oln::point2d(0,0)] = 42; + return false; +} Index: tests/core/tests/readwrite_image --- tests/core/tests/readwrite_image (revision 0) +++ tests/core/tests/readwrite_image (revision 0) @@ -0,0 +1,60 @@ +#include <iostream> + +#include <ntg/real/int_u8.hh> +#include <oln/basics2d.hh> + +#include "check.hh" +#include "data.hh" + +namespace oln { + + struct dummy_image; + + template <> + struct category_type< dummy_image > { typedef cat::image ret; }; + + template <> + struct props <cat::image, dummy_image> : + public default_props < cat::image > + { + typedef size2d size_type; + typedef point2d point_type; + typedef ntg::int_u8 value_type; + + typedef mlc_encoding_type_(value_type) value_storage_type; + typedef array2d<value_storage_type> value_container_type; + + typedef tag::readwrite constness_tag; + typedef tag::dimension2 dimension_tag; + typedef mlc::no_type delegated_type; + }; + + struct dummy_image : public abstract::image_with_data< dummy_image > + { + + typedef abstract::image_with_data< dummy_image > super_type; + + dummy_image() + { + this->exact_ptr = this; + } + + dummy_image(coord_t nrows, coord_t ncols) : + super_type(size2d(nrows, ncols)) + { + this->exact_ptr = this; + } + + }; + +} // end of namespace test + + + +bool check() +{ + oln::dummy_image ima(3, 3); + ima[oln::point2d(0,0)] = 42; + std::cout << ima[oln::point2d(0,0)].value() << std::endl; + return false; +}
20Â years, 2Â months
1
0
0
0
proto-1.0 16: Abstract hierarchy for image with dimension (and update pseudo algorithms to use these abstractions)
by Simon Odou
Index: ChangeLog from Simon Odou <simon(a)lrde.epita.fr> * oln/core/tags.hh: The abstract entry point is a big switch which must now inherits an image dimension. * oln/fancy/print.hh: Use abstraction for image with dimension (image_with_dim in Olena). * oln/fancy/iota.hh: Likewise. * oln/makefile.src: Add image_dimension.hh. * oln/core/abstract/image_dimension.hh: New. * oln/core/1d/image1d.hh: Add a property for dimension. * oln/core/2d/image2d.hh: Likewise. * oln/core/3d/image3d.hh: Likewise. core/1d/image1d.hh | 1 core/2d/image2d.hh | 1 core/3d/image3d.hh | 1 core/abstract/image_dimension.hh | 58 +++++++++++++++++++++++++++++++++++++++ core/tags.hh | 22 ++++++++++++-- fancy/iota.hh | 12 ++++---- fancy/print.hh | 32 ++++++++++----------- makefile.src | 1 8 files changed, 103 insertions(+), 25 deletions(-) Index: oln/fancy/print.hh --- oln/fancy/print.hh (revision 15) +++ oln/fancy/print.hh (working copy) @@ -22,13 +22,12 @@ namespace impl { - template <typename T> - void print(const image1d<T>& input, std::ostream& ostr); - template <typename T> - void print(const image2d<T>& input, std::ostream& ostr); - template <typename T> - void print(const image3d<T>& input, std::ostream& ostr); - // FIXME: it should be abstract::image2d<I>... + template <typename E> + void print(const abstract::image1d<E>& input, std::ostream& ostr); + template <typename E> + void print(const abstract::image2d<E>& input, std::ostream& ostr); + template <typename E> + void print(const abstract::image3d<E>& input, std::ostream& ostr); } // end of namespace impl @@ -73,31 +72,31 @@ } - template <typename T> - void print(const image1d<T>& input, std::ostream& ostr) + template <typename E> + void print(const abstract::image1d<E>& input, std::ostream& ostr) { // FIXME: lacks cleaning for (coord_t index = 0; index < input.size().nindices(); ++index) { - ostr << internal::pp<T>(input[point1d(index)]) << ' '; + ostr << internal::pp<oln_value_type(E)>(input[point1d(index)]) << ' '; } ostr << std::endl; } - template <typename T> - void print(const image2d<T>& input, std::ostream& ostr) + template <typename E> + void print(const abstract::image2d<E>& input, std::ostream& ostr) { // FIXME: lacks cleaning for (coord_t row = 0; row < input.size().nrows(); ++row) { for (coord_t col = 0; col < input.size().ncols(); ++col) - ostr << internal::pp<T>(input[point2d(row,col)]) << ' '; + ostr << internal::pp<oln_value_type(E)>(input[point2d(row,col)]) << ' '; ostr << std::endl; } } - template <typename T> - void print(const image3d<T>& input, std::ostream& ostr) + template <typename E> + void print(const abstract::image3d<E>& input, std::ostream& ostr) { // FIXME: lacks cleaning for (coord_t slice = 0; slice < input.size().nslices(); ++slice) @@ -105,7 +104,8 @@ for (coord_t row = 0; row < input.size().nrows(); ++row) { for (coord_t col = 0; col < input.size().ncols(); ++col) - ostr << internal::pp<T>(input[point3d(slice,row,col)]) << ' '; + ostr << internal::pp<oln_value_type(E)>(input[point3d(slice,row,col)]) + << ' '; ostr << ", "; } ostr << std::endl; Index: oln/fancy/iota.hh --- oln/fancy/iota.hh (revision 15) +++ oln/fancy/iota.hh (working copy) @@ -12,11 +12,11 @@ namespace impl { template <typename T> - void iota(image1d<T>& inout); // FIXME: abstract::image1d<I>... + void iota(abstract::image1d<T>& inout); template <typename T> - void iota(image2d<T>& inout); // FIXME: abstract::image2d<I>... + void iota(abstract::image2d<T>& inout); template <typename T> - void iota(image3d<T>& inout); // FIXME: abstract::image2d<I>... + void iota(abstract::image3d<T>& inout); } // end of namespace impl @@ -39,7 +39,7 @@ // iterators and we just want to test. template <typename T> - void iota(image2d<T>& inout) + void iota(abstract::image2d<T>& inout) { unsigned counter = 0; // FIXME: lacks cleaning @@ -49,7 +49,7 @@ } template <typename T> - void iota(image1d<T>& inout) + void iota(abstract::image1d<T>& inout) { unsigned counter = 0; // FIXME: lacks cleaning @@ -58,7 +58,7 @@ } template <typename T> - void iota(image3d<T>& inout) + void iota(abstract::image3d<T>& inout) { unsigned counter = 0; // FIXME: lacks cleaning Index: oln/makefile.src --- oln/makefile.src (revision 15) +++ oln/makefile.src (working copy) @@ -26,6 +26,7 @@ core/abstract/data_storage.hh \ core/abstract/image.hh \ core/abstract/image_constness.hh \ + core/abstract/image_dimension.hh \ core/abstract/image_with_data.hh \ core/abstract/images.hh \ core/abstract/internal/image_impl.hh \ Index: oln/core/abstract/image_dimension.hh --- oln/core/abstract/image_dimension.hh (revision 0) +++ oln/core/abstract/image_dimension.hh (revision 0) @@ -0,0 +1,58 @@ +#ifndef OLENA_CORE_ABSTRACT_IMAGE_DIMENSION_HH +# define OLENA_CORE_ABSTRACT_IMAGE_DIMENSION_HH + +# include <oln/core/abstract/image.hh> + +/*! \namespace oln +** \brief oln namespace. +*/ +namespace oln { + + /*! \namespace oln::abstract + ** \brief oln::abstract namespace. + */ + namespace abstract { + + /*! \class abstract::image2d<E> + ** + ** Class of 1d images. + */ + + + template <typename E> + struct image1d : public virtual image<E> + { + protected: + + /*! \brief Constructor (protected, empty). + */ + image1d() {} + }; + + template <typename E> + struct image2d : public virtual image<E> + { + protected: + + /*! \brief Constructor (protected, empty). + */ + image2d() {} + }; + + template <typename E> + struct image3d : public virtual image<E> + { + protected: + + /*! \brief Constructor (protected, empty). + */ + image3d() {} + }; + + + } // end of namespace oln::abstract + +} // end of namespace oln + + +#endif // ! OLENA_CORE_ABSTRACT_IMAGE_DIMENSION_HH Index: oln/core/1d/image1d.hh --- oln/core/1d/image1d.hh (revision 15) +++ oln/core/1d/image1d.hh (working copy) @@ -47,6 +47,7 @@ // tags typedef tag::readwrite constness_tag; + typedef tag::dimension1 dimension_tag; // functions Index: oln/core/2d/image2d.hh --- oln/core/2d/image2d.hh (revision 15) +++ oln/core/2d/image2d.hh (working copy) @@ -48,6 +48,7 @@ // tags typedef tag::readwrite constness_tag; + typedef tag::dimension2 dimension_tag; // functions Index: oln/core/3d/image3d.hh --- oln/core/3d/image3d.hh (revision 15) +++ oln/core/3d/image3d.hh (working copy) @@ -48,6 +48,7 @@ // tags typedef tag::readwrite constness_tag; + typedef tag::dimension3 dimension_tag; // functions Index: oln/core/tags.hh --- oln/core/tags.hh (revision 15) +++ oln/core/tags.hh (working copy) @@ -2,6 +2,7 @@ # define OLENA_CORE_TAGS_HH # include <oln/core/abstract/image_constness.hh> +# include <oln/core/abstract/image_dimension.hh> #define oln_tag_decl(TAG) \ \ @@ -60,6 +61,10 @@ oln_tag_decl_case( constness, readonly, abstract::readonly_image ) oln_tag_decl_case( constness, readwrite, abstract::readwrite_image ) + oln_tag_decl ( dimension ); + oln_tag_decl_case( dimension, dimension1, abstract::image1d) + oln_tag_decl_case( dimension, dimension2, abstract::image2d) + oln_tag_decl_case( dimension, dimension3, abstract::image3d) namespace internal { @@ -70,8 +75,17 @@ // test if ret derives from constness_tag }; + template <typename E> + struct retrieve < tag::dimension, E > + { + typedef typename props<cat::image,E>::dimension_tag ret; // FIXME: ok? + // test if ret derives from constness_tag + }; + + template <typename TAG, typename E> - struct image_switch : public image_case< typename retrieve<TAG,E>::ret, E> + struct image_switch : + public image_case< typename retrieve<TAG,E>::ret, E> { protected: image_switch() {} @@ -86,8 +100,10 @@ namespace abstract { template <typename E> - struct image_entry : public tag::internal::image_switch < tag::constness, E > - // ... + struct image_entry : + public tag::internal::image_switch < tag::constness, E >, + public tag::internal::image_switch < tag::dimension, E > + // ... { protected: image_entry() {}
20Â years, 2Â months
1
0
0
0
proto-1.0 10: Add Point1d and Point3d
by Simon Odou
Index: ChangeLog from Simon Odou <simon(a)lrde.epita.fr> * oln/basics1d.hh: New. * oln/core/1d/point1d.hh: New. * oln/core/3d: New. * oln/core/3d/point3d.hh: New. * oln/basics3d.hh: New. ChangeLog | 8 +++++ oln/basics1d.hh | 9 ++++++ oln/basics3d.hh | 9 ++++++ oln/core/1d/point1d.hh | 58 +++++++++++++++++++++++++++++++++++++++ oln/core/3d/point3d.hh | 72 +++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 156 insertions(+) Index: ChangeLog --- ChangeLog (revision 9) +++ ChangeLog (working copy) @@ -1,3 +1,11 @@ +2005-01-21 Simon Odou <simon(a)lrde.epita.fr> + + * oln/basics1d.hh: New. + * oln/core/1d/point1d.hh: New. + * oln/core/3d: New. + * oln/core/3d/point3d.hh: New. + * oln/basics3d.hh: New. + 2005-01-21 Damien Thivolle <damien(a)lrde.epita.fr> * oln/makefile.src: Update file dependencies. Index: oln/basics1d.hh --- oln/basics1d.hh (revision 0) +++ oln/basics1d.hh (revision 0) @@ -0,0 +1,9 @@ +#ifndef OLENA_BASICS1D_HH +# define OLENA_BASICS1D_HH + + +# include <oln/basics.hh> + +# include <oln/core/1d/point1d.hh> + +#endif // ! OLENA_BASICS1D_HH Index: oln/core/1d/point1d.hh --- oln/core/1d/point1d.hh (revision 0) +++ oln/core/1d/point1d.hh (revision 0) @@ -0,0 +1,58 @@ +#ifndef OLENA_CORE_1D_POINT1D_HH +# define OLENA_CORE_1D_POINT1D_HH + +# include <ostream> + +# include <oln/core/abstract/point.hh> +# include <oln/core/coord.hh> + +namespace oln { + + struct point1d : public abstract::point< point1d > + { + point1d() : + index_(0) + { + } + + point1d(coord_t index_) : + index_(index_) + { + } + + point1d(const point1d& rhs) : + index_(rhs.index_) + { + } + + point1d& operator=(const point1d& rhs) + { + if (&rhs == this) + return *this; + this->index_ = rhs.index_; + return *this; + } + + bool impl_eq(const point1d& rhs) const + { + return this->index_ == rhs.index_; + } + + const coord_t index() const { return index_; } + + coord_t& index() { return index_; } + + protected: + coord_t index_; + }; + +} // end of namespace oln + + +std::ostream& operator<<(std::ostream& ostr, const oln::point1d& p) +{ + return ostr << '(' << p.index() << ')'; +} + + +#endif // ! OLENA_CORE_1D_POINT1D_HH Index: oln/core/3d/point3d.hh --- oln/core/3d/point3d.hh (revision 0) +++ oln/core/3d/point3d.hh (revision 0) @@ -0,0 +1,72 @@ +#ifndef OLENA_CORE_3D_POINT3D_HH +# define OLENA_CORE_3D_POINT3D_HH + +# include <ostream> + +# include <oln/core/abstract/point.hh> +# include <oln/core/coord.hh> + +namespace oln { + + struct point3d : public abstract::point< point3d > + { + point3d() : + slice_(0), + row_(0), + col_(0) + { + } + + point3d(coord_t slice_, coord_t row_, coord_t col_) : + slice_(slice_), + row_(row_), + col_(col_) + { + } + + point3d(const point3d& rhs) : + slice_(slice_), + row_(rhs.row_), + col_(rhs.col_) + { + } + + point3d& operator=(const point3d& rhs) + { + if (&rhs == this) + return *this; + this->slice_ = rhs.slice_; + this->row_ = rhs.row_; + this->col_ = rhs.col_; + return *this; + } + + bool impl_eq(const point3d& rhs) const + { + return this->slice_ == rhs.slice_ and + this->row_ == rhs.row_ and + this->col_ == rhs.col_; + } + + const coord_t slice() const { return slice_; } + const coord_t row() const { return row_; } + const coord_t col() const { return col_; } + + coord_t& slice() { return slice_; } + coord_t& row() { return row_; } + coord_t& col() { return col_; } + + protected: + coord_t slice_, row_, col_; + }; + +} // end of namespace oln + + +std::ostream& operator<<(std::ostream& ostr, const oln::point3d& p) +{ + return ostr << '(' << p.slice() << ',' << p.row() << ',' << p.col() << ')'; +} + + +#endif // ! OLENA_CORE_3D_POINT3D_HH Index: oln/basics3d.hh --- oln/basics3d.hh (revision 0) +++ oln/basics3d.hh (revision 0) @@ -0,0 +1,9 @@ +#ifndef OLENA_BASICS3D_HH +# define OLENA_BASICS3D_HH + + +# include <oln/basics.hh> + +# include <oln/core/3d/point3d.hh> + +#endif // ! OLENA_BASICS3D_HH
20Â years, 2Â months
2
6
0
0
proto-1.0 15: Fix missing files in makefile.src
by Simon Odou
Index: ChangeLog from Simon Odou <simon(a)lrde.epita.fr> * oln/makefile.src: Fix missing files. makefile.src | 12 ++++++++++++ 1 files changed, 12 insertions(+) Index: oln/makefile.src --- oln/makefile.src (revision 14) +++ oln/makefile.src (working copy) @@ -4,13 +4,25 @@ ## OLN_DEP = \ + basics.hh \ + basics1d.hh \ + basics2d.hh \ + basics3d.hh \ config/pconf.hh \ config/system.hh \ + core/1d/array1d.hh \ + core/1d/image1d.hh \ + core/1d/point1d.hh \ + core/1d/size1d.hh \ core/2d/array2d.hh \ core/2d/image2d.hh \ core/2d/iter2d.hh \ core/2d/point2d.hh \ core/2d/size2d.hh \ + core/3d/array3d.hh \ + core/3d/image3d.hh \ + core/3d/point3d.hh \ + core/3d/size3d.hh \ core/abstract/data_storage.hh \ core/abstract/image.hh \ core/abstract/image_constness.hh \
20Â years, 2Â months
1
0
0
0
proto-1.0 14: Add Image3d with test
by Simon Odou
Index: ChangeLog from Simon Odou <simon(a)lrde.epita.fr> * tests/core/tests/image3d: New. * oln/fancy/print.hh: Add print for image3d. * oln/fancy/iota.hh: Add iota for image3d. * oln/core/2d/image2d.hh: Fix a 80 columns line. * oln/core/3d/array3d.hh: Fix a missing variable. * oln/core/3d/image3d.hh: New. * oln/core/3d/point3d.hh: Fix a missing "rhs". * oln/basics3d.hh: Add image3d include. oln/basics3d.hh | 1 oln/core/2d/image2d.hh | 3 - oln/core/3d/array3d.hh | 4 - oln/core/3d/image3d.hh | 102 +++++++++++++++++++++++++++++++++++++++++++++++ oln/core/3d/point3d.hh | 2 oln/fancy/iota.hh | 16 ++++++- oln/fancy/print.hh | 28 +++++++++++- tests/core/tests/image3d | 40 ++++++++++++++++++ 8 files changed, 187 insertions(+), 9 deletions(-) Index: tests/core/tests/image3d --- tests/core/tests/image3d (revision 0) +++ tests/core/tests/image3d (revision 0) @@ -0,0 +1,40 @@ + +#include <iostream> + +#include <ntg/real/int_u8.hh> +#include <oln/basics3d.hh> + +#include <oln/fancy/iota.hh> +#include <oln/fancy/print.hh> + +#include "check.hh" +#include "data.hh" + + + +template <typename I> +void foo(oln::abstract::image<I>& input, const oln_point_type(I)& p) +{ + // FIXME: dummy code below +// struct dummy {}; +// oln_typeof(I,value) tmp = (dummy*)0; + input[p] = 7; +} + + +bool check() +{ + oln::point3d p(0,0,0); + + typedef oln::image3d<ntg::int_u8> image_type; + image_type ima(3, 3, 3); + oln::fancy::iota(ima); + oln::fancy::println(ima); + + image_type ima2; + ima2 = ima; + + foo(ima, p); + oln::fancy::println(ima2); + return false; +} Index: oln/fancy/print.hh --- oln/fancy/print.hh (revision 13) +++ oln/fancy/print.hh (working copy) @@ -10,6 +10,7 @@ # include <oln/core/1d/image1d.hh> # include <oln/core/2d/image2d.hh> +# include <oln/core/3d/image3d.hh> namespace oln { @@ -25,6 +26,8 @@ void print(const image1d<T>& input, std::ostream& ostr); template <typename T> void print(const image2d<T>& input, std::ostream& ostr); + template <typename T> + void print(const image3d<T>& input, std::ostream& ostr); // FIXME: it should be abstract::image2d<I>... } // end of namespace impl @@ -71,6 +74,17 @@ } template <typename T> + void print(const image1d<T>& input, std::ostream& ostr) + { + // FIXME: lacks cleaning + for (coord_t index = 0; index < input.size().nindices(); ++index) + { + ostr << internal::pp<T>(input[point1d(index)]) << ' '; + } + ostr << std::endl; + } + + template <typename T> void print(const image2d<T>& input, std::ostream& ostr) { // FIXME: lacks cleaning @@ -83,15 +97,21 @@ } template <typename T> - void print(const image1d<T>& input, std::ostream& ostr) + void print(const image3d<T>& input, std::ostream& ostr) { // FIXME: lacks cleaning - for (coord_t index = 0; index < input.size().nindices(); ++index) + for (coord_t slice = 0; slice < input.size().nslices(); ++slice) + { + for (coord_t row = 0; row < input.size().nrows(); ++row) { - ostr << internal::pp<T>(input[point1d(index)]) << ' '; + for (coord_t col = 0; col < input.size().ncols(); ++col) + ostr << internal::pp<T>(input[point3d(slice,row,col)]) << ' '; + ostr << ", "; } - ostr << std::endl; + ostr << std::endl; + } } + } // end of namespace impl Index: oln/fancy/iota.hh --- oln/fancy/iota.hh (revision 13) +++ oln/fancy/iota.hh (working copy) @@ -1,8 +1,9 @@ #ifndef OLENA_FANCY_IOTA_HH # define OLENA_FANCY_IOTA_HH +# include <oln/core/1d/image1d.hh> # include <oln/core/2d/image2d.hh> -# include <oln/core/1d/image1d.hh> +# include <oln/core/3d/image3d.hh> namespace oln { @@ -14,6 +15,8 @@ void iota(image1d<T>& inout); // FIXME: abstract::image1d<I>... template <typename T> void iota(image2d<T>& inout); // FIXME: abstract::image2d<I>... + template <typename T> + void iota(image3d<T>& inout); // FIXME: abstract::image2d<I>... } // end of namespace impl @@ -54,6 +57,17 @@ inout[point1d(index)] = ++counter; } + template <typename T> + void iota(image3d<T>& inout) + { + unsigned counter = 0; + // FIXME: lacks cleaning + for (coord_t slice = 0; slice < inout.size().nslices(); ++slice) + for (coord_t row = 0; row < inout.size().nrows(); ++row) + for (coord_t col = 0; col < inout.size().ncols(); ++col) + inout[point3d(slice,row,col)] = ++counter; + } + } // end of namespace impl Index: oln/core/2d/image2d.hh --- oln/core/2d/image2d.hh (revision 13) +++ oln/core/2d/image2d.hh (working copy) @@ -16,7 +16,8 @@ template <typename T> class image2d; // category decl - template <typename T> struct category_type< image2d<T> > { typedef cat::image ret; }; + template <typename T> + struct category_type< image2d<T> > { typedef cat::image ret; }; /*! \class props< abstract::image, image2d<T> > Index: oln/core/3d/array3d.hh --- oln/core/3d/array3d.hh (revision 13) +++ oln/core/3d/array3d.hh (working copy) @@ -114,7 +114,7 @@ for (size_t slice = 0; slice < nslices_eff; ++slice) { T** a2 = array2_ + slice * nrows_eff; - array[slice] = a2 + size_.border(); + array_[slice] = a2 + size_.border(); for (size_t row = 0; row < nrows_eff; ++row) { a2[row] = buf; @@ -179,8 +179,8 @@ private: T* buffer_; + T*** array_; T** array2_; - T*** array_; size3d size_; void invariant_() const Index: oln/core/3d/image3d.hh --- oln/core/3d/image3d.hh (revision 0) +++ oln/core/3d/image3d.hh (revision 0) @@ -0,0 +1,102 @@ +#ifndef OLENA_CORE_IMAGE3D_HH +# define OLENA_CORE_IMAGE3D_HH + +# include <mlc/traits.hh> + +# include <oln/core/abstract/image_with_data.hh> +# include <oln/core/3d/array3d.hh> + +/*! \namespace oln +** \brief oln namespace. +*/ +namespace oln { + + + // fwd decl + template <typename T> class image3d; + + // category decl + template <typename T> + struct category_type< image3d<T> > { typedef cat::image ret; }; + + + /*! \class props< abstract::image, image3d<T> > + ** + ** Properties of common 3D images. Specialization of props<abstraction,type>. + ** Parameter T is the type of pixel values. + ** + ** \see image3d<T>, props<category,type> + */ + + template <typename T> + struct props < cat::image, image3d<T> > : public default_props < cat::image > + { + typedef mlc::no_type delegated_type; + + typedef size3d size_type; + typedef point3d point_type; + typedef T value_type; + + // please note that value_storage_type means data_type + // since image3d is an image_with_data + typedef mlc_encoding_type(T) value_storage_type; + + // please note that value_container_type means + // data_container_type (or value_storage_container_type) + // FIXME: find a better name... + typedef array3d<value_storage_type> value_container_type; + + // tags + typedef tag::readwrite constness_tag; + + // functions + + template <typename U> + struct ch_value_type + { + typedef image3d<U> ret; + }; + + }; + + + + /*! \class image3d<T> + ** + ** Common class for 3D images. Pixels values are stored in memory. + ** FIXME: give details about other properties (border, etc.) + ** + ** Parameter T is the type of pixel values. + */ + + template <typename T> + class image3d : public abstract::image_with_data< image3d<T> > + { + public: + + typedef abstract::image_with_data< image3d<T> > super_type; + + image3d() + { + this->exact_ptr = this; + } + + image3d(coord_t nslices, coord_t nrows, coord_t ncols) : + super_type(size3d(nslices, nrows, ncols)) + { + this->exact_ptr = this; + } + + image3d(image3d& rhs) : + super_type(rhs) + { + this->exact_ptr = this; + } + + }; + + +} // end of namespace oln + + +#endif // ! OLENA_CORE_IMAGE3D_HH Index: oln/core/3d/point3d.hh --- oln/core/3d/point3d.hh (revision 13) +++ oln/core/3d/point3d.hh (working copy) @@ -25,7 +25,7 @@ } point3d(const point3d& rhs) : - slice_(slice_), + slice_(rhs.slice_), row_(rhs.row_), col_(rhs.col_) { Index: oln/basics3d.hh --- oln/basics3d.hh (revision 13) +++ oln/basics3d.hh (working copy) @@ -6,5 +6,6 @@ # include <oln/core/3d/size3d.hh> # include <oln/core/3d/point3d.hh> +# include <oln/core/3d/image3d.hh> #endif // ! OLENA_BASICS3D_HH
20Â years, 2Â months
1
0
0
0
proto-1.0 13: Add Image1d with test
by Simon Odou
Index: ChangeLog from Simon Odou <simon(a)lrde.epita.fr> * tests/core/tests/image1d: New. * oln/fancy/print.hh: Add print for image1d. * oln/fancy/iota.hh: Add iota for image1d. * oln/basics1d.hh: Add image1d include. * oln/core/2d/image2d.hh: Move the has_data method to... * oln/core/abstract/image_with_data.hh: here. * oln/core/1d/image1d.hh: New. * oln/core/1d/size1d.hh: Fix a forgotten initialization in constructor. ChangeLog | 15 ----- oln/basics1d.hh | 1 oln/core/1d/image1d.hh | 101 +++++++++++++++++++++++++++++++++++ oln/core/1d/size1d.hh | 3 - oln/core/2d/image2d.hh | 5 - oln/core/abstract/image_with_data.hh | 10 +++ oln/fancy/iota.hh | 21 ++++++- oln/fancy/print.hh | 14 ++++ tests/core/tests/image1d | 40 +++++++++++++ 9 files changed, 186 insertions(+), 24 deletions(-) Index: tests/core/tests/image1d --- tests/core/tests/image1d (revision 0) +++ tests/core/tests/image1d (revision 0) @@ -0,0 +1,40 @@ + +#include <iostream> + +#include <ntg/real/int_u8.hh> +#include <oln/basics1d.hh> + +#include <oln/fancy/iota.hh> +#include <oln/fancy/print.hh> + +#include "check.hh" +#include "data.hh" + + + +template <typename I> +void foo(oln::abstract::image<I>& input, const oln_point_type(I)& p) +{ + // FIXME: dummy code below +// struct dummy {}; +// oln_typeof(I,value) tmp = (dummy*)0; + input[p] = 7; +} + + +bool check() +{ + oln::point1d p(0); + + typedef oln::image1d<ntg::int_u8> image_type; + image_type ima(3); + oln::fancy::iota(ima); + oln::fancy::println(ima); + + image_type ima2; + ima2 = ima; + + foo(ima, p); + oln::fancy::println(ima2); + return false; +} Index: oln/fancy/print.hh --- oln/fancy/print.hh (revision 12) +++ oln/fancy/print.hh (working copy) @@ -8,6 +8,7 @@ # include <ntg/real/int_u8.hh> // FIXME: no coupling like that! +# include <oln/core/1d/image1d.hh> # include <oln/core/2d/image2d.hh> namespace oln { @@ -21,6 +22,8 @@ namespace impl { template <typename T> + void print(const image1d<T>& input, std::ostream& ostr); + template <typename T> void print(const image2d<T>& input, std::ostream& ostr); // FIXME: it should be abstract::image2d<I>... @@ -79,6 +82,17 @@ } } + template <typename T> + void print(const image1d<T>& input, std::ostream& ostr) + { + // FIXME: lacks cleaning + for (coord_t index = 0; index < input.size().nindices(); ++index) + { + ostr << internal::pp<T>(input[point1d(index)]) << ' '; + } + ostr << std::endl; + } + } // end of namespace impl Index: oln/fancy/iota.hh --- oln/fancy/iota.hh (revision 12) +++ oln/fancy/iota.hh (working copy) @@ -2,6 +2,7 @@ # define OLENA_FANCY_IOTA_HH # include <oln/core/2d/image2d.hh> +# include <oln/core/1d/image1d.hh> namespace oln { @@ -9,7 +10,10 @@ namespace impl { - template <typename T> void iota(image2d<T>& inout); // FIXME: abstract::image2d<I>... + template <typename T> + void iota(image1d<T>& inout); // FIXME: abstract::image1d<I>... + template <typename T> + void iota(image2d<T>& inout); // FIXME: abstract::image2d<I>... } // end of namespace impl @@ -28,15 +32,28 @@ namespace impl { + // FIXME: must be generic, of course ! But for now, we have not yet + // iterators and we just want to test. + template <typename T> void iota(image2d<T>& inout) { unsigned counter = 0; - for (coord_t row = 0; row < inout.size().nrows(); ++row) // FIXME: lacks cleaning + // FIXME: lacks cleaning + for (coord_t row = 0; row < inout.size().nrows(); ++row) for (coord_t col = 0; col < inout.size().ncols(); ++col) inout[point2d(row,col)] = ++counter; } + template <typename T> + void iota(image1d<T>& inout) + { + unsigned counter = 0; + // FIXME: lacks cleaning + for (coord_t index = 0; index < inout.size().nindices(); ++index) + inout[point1d(index)] = ++counter; + } + } // end of namespace impl Index: oln/basics1d.hh --- oln/basics1d.hh (revision 12) +++ oln/basics1d.hh (working copy) @@ -6,5 +6,6 @@ # include <oln/core/1d/size1d.hh> # include <oln/core/1d/point1d.hh> +# include <oln/core/1d/image1d.hh> #endif // ! OLENA_BASICS1D_HH Index: oln/core/abstract/image_with_data.hh --- oln/core/abstract/image_with_data.hh (revision 12) +++ oln/core/abstract/image_with_data.hh (working copy) @@ -97,6 +97,14 @@ return this->data_->set(p, v); } + /*! \brief True if the image contains data. + */ + bool has_data() const + { + return data_ != 0; + } + + protected: /*! \brief Constructor (protected) with no memory allocation for @@ -107,6 +115,7 @@ data_ = 0; } + /*! \brief Constructor (protected) with memory allocation for ** data. */ @@ -123,7 +132,6 @@ this->data_ = rhs.data_; } - /*! \brief Data storage. */ mlc::tracked_ptr<oln_value_container_type(E)> data_; Index: oln/core/1d/image1d.hh --- oln/core/1d/image1d.hh (revision 0) +++ oln/core/1d/image1d.hh (revision 0) @@ -0,0 +1,101 @@ +#ifndef OLENA_CORE_IMAGE1D_HH +# define OLENA_CORE_IMAGE1D_HH + +# include <mlc/traits.hh> + +# include <oln/core/abstract/image_with_data.hh> +# include <oln/core/1d/array1d.hh> + +/*! \namespace oln +** \brief oln namespace. +*/ +namespace oln { + + + // fwd decl + template <typename T> class image1d; + + // category decl + template <typename T> struct category_type< image1d<T> > { typedef cat::image ret; }; + + + /*! \class props< abstract::image, image1d<T> > + ** + ** Properties of common 1D images. Specialization of props<abstraction,type>. + ** Parameter T is the type of pixel values. + ** + ** \see image1d<T>, props<category,type> + */ + + template <typename T> + struct props < cat::image, image1d<T> > : public default_props < cat::image > + { + typedef mlc::no_type delegated_type; + + typedef size1d size_type; + typedef point1d point_type; + typedef T value_type; + + // please note that value_storage_type means data_type + // since image1d is an image_with_data + typedef mlc_encoding_type(T) value_storage_type; + + // please note that value_container_type means + // data_container_type (or value_storage_container_type) + // FIXME: find a better name... + typedef array1d<value_storage_type> value_container_type; + + // tags + typedef tag::readwrite constness_tag; + + // functions + + template <typename U> + struct ch_value_type + { + typedef image1d<U> ret; + }; + + }; + + + + /*! \class image1d<T> + ** + ** Common class for 1D images. Pixels values are stored in memory. + ** FIXME: give details about other properties (border, etc.) + ** + ** Parameter T is the type of pixel values. + */ + + template <typename T> + class image1d : public abstract::image_with_data< image1d<T> > + { + public: + + typedef abstract::image_with_data< image1d<T> > super_type; + + image1d() + { + this->exact_ptr = this; + } + + image1d(coord_t nindices) : + super_type(size1d(nindices)) + { + this->exact_ptr = this; + } + + image1d(image1d& rhs) : + super_type(rhs) + { + this->exact_ptr = this; + } + + }; + + +} // end of namespace oln + + +#endif // ! OLENA_CORE_IMAGE1D_HH Index: oln/core/1d/size1d.hh --- oln/core/1d/size1d.hh (revision 12) +++ oln/core/1d/size1d.hh (working copy) @@ -12,7 +12,8 @@ struct size1d : public abstract::size< size1d > { size1d() : - nindices_(0) + nindices_(0), + border_(0) {} size1d(coord_t nindices_) : Index: oln/core/2d/image2d.hh --- oln/core/2d/image2d.hh (revision 12) +++ oln/core/2d/image2d.hh (working copy) @@ -109,11 +109,6 @@ // FIXME: idem with abstract::image2d<E> (?) - bool has_data() const // FIXME: should be defined in abstract::something_image... - { - return this->data_ != 0; - } - };
20Â years, 2Â months
1
0
0
0
proto-1.0 12: Add Array1d and Array3d
by Simon Odou
Index: ChangeLog from Simon Odou <simon(a)lrde.epita.fr> * oln/core/1d/array1d.hh: New. * oln/core/2d/array2d.hh: Fix a missing destructor. * oln/core/3d/array3d.hh: New. 1d/array1d.hh | 156 +++++++++++++++++++++++++++++++++++++++++++ 2d/array2d.hh | 8 +- 3d/array3d.hh | 208 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 371 insertions(+), 1 deletion(-) Index: oln/core/1d/array1d.hh --- oln/core/1d/array1d.hh (revision 0) +++ oln/core/1d/array1d.hh (revision 0) @@ -0,0 +1,156 @@ +#ifndef OLENA_CORE_1D_ARRAY1D_HH +# define OLENA_CORE_1D_ARRAY1D_HH + + +# include <oln/core/abstract/data_storage.hh> +# include <oln/core/1d/size1d.hh> +# include <oln/core/1d/point1d.hh> + +namespace oln { + + + template <typename T> struct array1d; + template <typename T> + struct category_type< array1d<T> > { typedef cat::data_storage ret; }; + + + template <typename T> + struct props < cat::data_storage, array1d<T> > // FIXME: add inheritance + { + typedef size1d size_type; + typedef point1d point_type; + typedef T data_type; + }; + + + template <typename T> + class array1d : public abstract::data_storage< array1d<T> > + { + + public: + + array1d() : + buffer_(0), + size_() + { + this->exact_ptr = this; + invariant_(); + } + + // w/o impl + array1d(const array1d&); + void operator=(const array1d&); + + + array1d(const size1d& s) : + buffer_(0), + size_() + { + this->exact_ptr = this; + this->resize(s); + } + + ~array1d() + { + this->impl_clear_data(); + } + + bool impl_has_data() const + { + invariant_(); + return buffer_ != 0; + } + + void impl_clear_data() + { + invariant_(); + if (this->has_data()) + { + // buffer + delete[] buffer_; + buffer_ = 0; + // size + size_ = size1d(); + } + invariant_(); + } + + const size1d& size() const + { + return size_; + } + + void impl_resize(const size1d& s) + { + precondition(s.nindices() > 0 and + s.border() >= 0); + invariant_(); + this->clear_data(); + size_ = s; + size_t nelts_eff = size_.nindices() + 2 * size_.border(); + buffer_ = new T[nelts_eff]; + invariant_(); + } + + unsigned long impl_npoints() const + { + return size_.npoints(); + } + + bool impl_hold(const point1d& p) const + { + return + p.index() >= 0 and + p.index() < size_.nindices(); + } + + bool impl_hold_large(const point1d& p) const + { + return + p.index() >= - size_.border() and + p.index() < size_.nindices() + size_.border(); + } + + const T impl_get(const point1d& p) const + { + invariant_(); + return buffer_[p.index()]; + } + + void impl_set(const point1d& p, const T& v) + { + invariant_(); + buffer_[p.index()] = v; + } + + void impl_set_data(const T& v) + { + invariant_(); + const size_t len = size_.nindices() + 2 * size_.border(); + T* p = buffer_; + for (size_t i = 0; i < len; ++i) + *p++ = v; + } + + private: + + T* buffer_; + size1d size_; + + void invariant_() const + { + invariant((buffer_ != 0 and + size_.nindices() > 0 and + size_.border() >= 0) + or + (buffer_ == 0 and + size_.nindices() == 0 and + size_.border() == 0)); + } + + }; + +} // end of namespace oln + + +#endif // ! OLENA_CORE_1D_ARRAY1D_HH Index: oln/core/2d/array2d.hh --- oln/core/2d/array2d.hh (revision 11) +++ oln/core/2d/array2d.hh (working copy) @@ -10,7 +10,8 @@ template <typename T> struct array2d; - template <typename T> struct category_type< array2d<T> > { typedef cat::data_storage ret; }; + template <typename T> + struct category_type< array2d<T> > { typedef cat::data_storage ret; }; template <typename T> @@ -51,6 +52,11 @@ this->resize(s); } + ~array2d() + { + this->impl_clear_data(); + } + bool impl_has_data() const { invariant_(); Index: oln/core/3d/array3d.hh --- oln/core/3d/array3d.hh (revision 0) +++ oln/core/3d/array3d.hh (revision 0) @@ -0,0 +1,208 @@ +#ifndef OLENA_CORE_3D_ARRAY3D_HH +# define OLENA_CORE_3D_ARRAY3D_HH + + +# include <oln/core/abstract/data_storage.hh> +# include <oln/core/3d/size3d.hh> +# include <oln/core/3d/point3d.hh> + +namespace oln { + + + template <typename T> struct array3d; + template <typename T> + struct category_type< array3d<T> > { typedef cat::data_storage ret; }; + + + template <typename T> + struct props < cat::data_storage, array3d<T> > // FIXME: add inheritance + { + typedef size3d size_type; + typedef point3d point_type; + typedef T data_type; + }; + + + template <typename T> + class array3d : public abstract::data_storage< array3d<T> > + { + + public: + + array3d() : + buffer_(0), + array_(0), + array2_(0), + size_() + { + this->exact_ptr = this; + invariant_(); + } + + // w/o impl + array3d(const array3d&); + void operator=(const array3d&); + + + array3d(const size3d& s) : + buffer_(0), + array_(0), + array2_(0), + size_() + { + this->exact_ptr = this; + this->resize(s); + } + + ~array3d() + { + this->impl_clear_data(); + } + + bool impl_has_data() const + { + invariant_(); + return buffer_ != 0; + } + + void impl_clear_data() + { + invariant_(); + if (this->has_data()) + { + // buffer + delete[] buffer_; + buffer_ = 0; + // array2 + delete[] array2_; + array2_ = 0; + // array + array_ -= size_.border(); + delete[] array_; + array_ = 0; + // size + size_ = size3d(); + } + invariant_(); + } + + const size3d& size() const + { + return size_; + } + + void impl_resize(const size3d& s) + { + precondition(s.nslices() > 0 and + s.nrows() > 0 and + s.ncols() > 0 and + s.border() >= 0); + invariant_(); + this->clear_data(); + size_ = s; + + size_t nslices_eff = size_.nslices() + 2 * size_.border(); + size_t nrows_eff = size_.nrows() + 2 * size_.border(); + size_t ncols_eff = size_.ncols() + 2 * size_.border(); + size_t nelts_eff = nslices_eff * nrows_eff * ncols_eff; + + buffer_ = new T[nelts_eff]; + array_ = new T**[nslices_eff]; + array2_ = new T*[nslices_eff * nrows_eff]; + + T* buf = buffer_ + size_.border(); + for (size_t slice = 0; slice < nslices_eff; ++slice) + { + T** a2 = array2_ + slice * nrows_eff; + array[slice] = a2 + size_.border(); + for (size_t row = 0; row < nrows_eff; ++row) + { + a2[row] = buf; + buf += ncols_eff; + } + } + array_ += size_.border(); + invariant_(); + } + + unsigned long impl_npoints() const + { + return size_.npoints(); + } + + bool impl_hold(const point3d& p) const + { + return + p.slice() >= 0 and + p.slice() < size_.nslices() and + p.row() >= 0 and + p.row() < size_.nrows() and + p.col() >= 0 and + p.col() < size_.ncols(); + } + + bool impl_hold_large(const point3d& p) const + { + return + p.slice() >= - size_.border() and + p.slice() < size_.nslices() + size_.border() and + p.row() >= - size_.border() and + p.row() < size_.nrows() + size_.border() and + p.col() >= - size_.border() and + p.col() < size_.ncols() + size_.border(); + } + + const T impl_get(const point3d& p) const + { + invariant_(); + return array_[p.slice()][p.row()][p.col()]; + } + + void impl_set(const point3d& p, const T& v) + { + invariant_(); + array_[p.slice()][p.row()][p.col()] = v; + } + + void impl_set_data(const T& v) + { + invariant_(); + const size_t nslices_eff = size_.nslices() + 2 * size_.border(); + const size_t nrows_eff = size_.nrows() + 2 * size_.border(); + const size_t ncols_eff = size_.ncols() + 2 * size_.border(); + const size_t len = nslices_eff * nrows_eff * ncols_eff; + T* p = buffer_; + for (size_t i = 0; i < len; ++i) + *p++ = v; + } + + private: + + T* buffer_; + T** array2_; + T*** array_; + size3d size_; + + void invariant_() const + { + invariant((buffer_ != 0 and + array_ != 0 and + size_.nslices() > 0 and + size_.nrows() > 0 and + size_.ncols() > 0 and + size_.border() >= 0) + or + (buffer_ == 0 and + array_ == 0 and + size_.nslices() == 0 and + size_.nrows() == 0 and + size_.ncols() == 0 and + size_.border() == 0)); + } + + }; + +} // end of namespace oln + + +#endif // ! OLENA_CORE_3D_ARRAY3D_HH
20Â years, 2Â months
2
1
0
0
proto-1.0 11: Add Size1d and Size3d
by Simon Odou
Index: ChangeLog from Simon Odou <simon(a)lrde.epita.fr> * oln/basics1d.hh: Add size1d include. * oln/core/1d/size1d.hh: New. * oln/core/2d/size2d.hh: Fix a missing "this". * oln/core/3d/size3d.hh: New. * oln/basics3d.hh: Add size3d include. ChangeLog | 7 ++++ oln/basics1d.hh | 1 oln/basics3d.hh | 1 oln/core/1d/size1d.hh | 67 ++++++++++++++++++++++++++++++++++++++ oln/core/2d/size2d.hh | 3 + oln/core/3d/size3d.hh | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 164 insertions(+), 1 deletion(-) Index: ChangeLog --- ChangeLog (revision 10) +++ ChangeLog (working copy) @@ -1,5 +1,12 @@ 2005-01-21 Simon Odou <simon(a)lrde.epita.fr> + * oln/basics1d.hh: Add size1d include. + * oln/core/1d/size1d.hh: New. + * oln/core/3d/size3d.hh: New. + * oln/basics3d.hh: Add size3d include. + +2005-01-21 Simon Odou <simon(a)lrde.epita.fr> + * oln/basics1d.hh: New. * oln/core/1d/point1d.hh: New. * oln/core/3d: New. Index: oln/basics1d.hh --- oln/basics1d.hh (revision 10) +++ oln/basics1d.hh (working copy) @@ -4,6 +4,7 @@ # include <oln/basics.hh> +# include <oln/core/1d/size1d.hh> # include <oln/core/1d/point1d.hh> #endif // ! OLENA_BASICS1D_HH Index: oln/core/1d/size1d.hh --- oln/core/1d/size1d.hh (revision 0) +++ oln/core/1d/size1d.hh (revision 0) @@ -0,0 +1,67 @@ +#ifndef OLENA_CORE_1D_SIZE1D_HH +# define OLENA_CORE_1D_SIZE1D_HH + +# include <ostream> + +# include <oln/core/abstract/size.hh> +# include <oln/core/coord.hh> + +namespace oln { + + + struct size1d : public abstract::size< size1d > + { + size1d() : + nindices_(0) + {} + + size1d(coord_t nindices_) : + nindices_(nindices_), + border_(2) // FIXME: 2! + {} + + size1d(coord_t nindices_, coord_t border_) : + nindices_(nindices_), + border_(border_) + {} + + size1d(const size1d& rhs) : + nindices_(rhs.nindices_), + border_(rhs.border_) + {} + + void operator=(const size1d& rhs) + { + this->nindices_ = rhs.nindices_; + this->border_ = rhs.border_; + } + + unsigned long impl_npoints() const + { + return (unsigned long)nindices_; + } + + bool impl_eq(const size1d& rhs) const + { + return this->nindices_ == rhs.nindices_; + } + + const coord_t nindices() const { return nindices_; } + const coord_t border() const { return border_; } + + protected: + coord_t nindices_, border_; + }; + + +} // end of namespace oln + + +std::ostream& operator<<(std::ostream& ostr, const oln::size1d& s) +{ + return ostr << "(nindices=" << s.nindices() + << ", border=" << s.border() << ")"; +} + + +#endif // ! OLENA_CORE_1D_SIZE1D_HH Index: oln/core/2d/size2d.hh --- oln/core/2d/size2d.hh (revision 10) +++ oln/core/2d/size2d.hh (working copy) @@ -49,7 +49,8 @@ bool impl_eq(const size2d& rhs) const { - return nrows_ == rhs.nrows_ and ncols_ == rhs.ncols_; + return this->nrows_ == rhs.nrows_ and + this->ncols_ == rhs.ncols_; } const coord_t nrows() const { return nrows_; } Index: oln/core/3d/size3d.hh --- oln/core/3d/size3d.hh (revision 0) +++ oln/core/3d/size3d.hh (revision 0) @@ -0,0 +1,86 @@ +#ifndef OLENA_CORE_3D_SIZE3D_HH +# define OLENA_CORE_3D_SIZE3D_HH + +# include <ostream> + +# include <oln/core/abstract/size.hh> +# include <oln/core/coord.hh> + +namespace oln { + + + struct size3d : public abstract::size< size3d > + { + size3d() : + nslices_(0), + nrows_(0), + ncols_(0), + border_(0) + {} + + size3d(coord_t nslices_, coord_t nrows_, coord_t ncols_) : + nslices_(nslices_), + nrows_(nrows_), + ncols_(ncols_), + border_(2) // FIXME: 2! + {} + + size3d(coord_t nslices_, coord_t nrows_, coord_t ncols_, coord_t border_) : + nslices_(nslices_), + nrows_(nrows_), + ncols_(ncols_), + border_(border_) + {} + + size3d(const size3d& rhs) : + nslices_(rhs.nslices_), + nrows_(rhs.nrows_), + ncols_(rhs.ncols_), + border_(rhs.border_) + {} + + void operator=(const size3d& rhs) + { + this->nslices_ = rhs.nslices_; + this->nrows_ = rhs.nrows_; + this->ncols_ = rhs.ncols_; + this->border_ = rhs.border_; + } + + unsigned long impl_npoints() const + { + return (unsigned long)nslices_ * + (unsigned long)nslices_ * + (unsigned long)ncols_; + } + + bool impl_eq(const size3d& rhs) const + { + return this->nslices_ == rhs.nslices_ and + this->nrows_ == rhs.nrows_ and + this->ncols_ == rhs.ncols_; + } + + const coord_t nslices() const { return nslices_; } + const coord_t nrows() const { return nrows_; } + const coord_t ncols() const { return ncols_; } + const coord_t border() const { return border_; } + + protected: + coord_t nslices_, nrows_, ncols_, border_; + }; + + +} // end of namespace oln + + +std::ostream& operator<<(std::ostream& ostr, const oln::size3d& s) +{ + return ostr << "(nslices=" << s.nslices() + << ", nrows=" << s.nrows() + << ", ncols=" << s.ncols() + << ", border=" << s.border() << ")"; +} + + +#endif // ! OLENA_CORE_3D_SIZE3D_HH Index: oln/basics3d.hh --- oln/basics3d.hh (revision 10) +++ oln/basics3d.hh (working copy) @@ -4,6 +4,7 @@ # include <oln/basics.hh> +# include <oln/core/3d/size3d.hh> # include <oln/core/3d/point3d.hh> #endif // ! OLENA_BASICS3D_HH
20Â years, 2Â months
2
1
0
0
proto-1.0 9: Adding support for vcs in olena, metalic and integre
by Damien Thivolle
Index: ChangeLog from Damien Thivolle <damien(a)lrde.epita.fr> * integre/vcs: New. * integre/vcs/oln.rb: New. Configuration file for vcs. * olena/vcs: New. * olena/vcs/oln.rb: New. * metalic/vcs: New. * metalic/vcs/oln.rb: New. integre/vcs/oln.rb | 13 +++++++++++++ metalic/vcs/oln.rb | 13 +++++++++++++ olena/vcs/oln.rb | 13 +++++++++++++ 3 files changed, 39 insertions(+) Index: integre/vcs/oln.rb --- integre/vcs/oln.rb (revision 0) +++ integre/vcs/oln.rb (revision 0) @@ -0,0 +1,13 @@ +class Vcs + + def oln_commit! ( s, *args ) + + common_commit!(*args) do |rev| + news!(:groups => ['lrde.olena.patches'], + :subject => "proto-1.0 #{rev}: #{s}") + end + + end + alias_command :olnci, :oln_commit + +end # class Vcs Index: olena/vcs/oln.rb --- olena/vcs/oln.rb (revision 0) +++ olena/vcs/oln.rb (revision 0) @@ -0,0 +1,13 @@ +class Vcs + + def oln_commit! ( s, *args ) + + common_commit!(*args) do |rev| + news!(:groups => ['lrde.olena.patches'], + :subject => "proto-1.0 #{rev}: #{s}") + end + + end + alias_command :olnci, :oln_commit + +end # class Vcs Index: metalic/vcs/oln.rb --- metalic/vcs/oln.rb (revision 0) +++ metalic/vcs/oln.rb (revision 0) @@ -0,0 +1,13 @@ +class Vcs + + def oln_commit! ( s, *args ) + + common_commit!(*args) do |rev| + news!(:groups => ['lrde.olena.patches'], + :subject => "proto-1.0 #{rev}: #{s}") + end + + end + alias_command :olnci, :oln_commit + +end # class Vcs
20Â years, 2Â months
1
0
0
0
proto-1.0 8: File dependencies update in Olena
by Damien Thivolle
Index: ChangeLog from Damien Thivolle <damien(a)lrde.epita.fr> * oln/makefile.src: Update file dependencies. * oln/core/2d/iter2d.hh: Fix a bad file inclusion. core/2d/iter2d.hh | 3 +-- makefile.src | 2 ++ 2 files changed, 3 insertions(+), 2 deletions(-) Index: oln/makefile.src --- oln/makefile.src (revision 5) +++ oln/makefile.src (working copy) @@ -4,6 +4,8 @@ ## OLN_DEP = \ + config/pconf.hh \ + config/system.hh \ core/2d/array2d.hh \ core/2d/image2d.hh \ core/2d/iter2d.hh \ Index: oln/core/2d/iter2d.hh --- oln/core/2d/iter2d.hh (revision 5) +++ oln/core/2d/iter2d.hh (working copy) @@ -2,7 +2,6 @@ # define PROTO_OLN_CORE_2D_ITER2D_HH # include <mlc/contract.hh> -# include <mlc/objs.hh> # include <oln/core/abstract/iter.hh> # include <oln/core/2d/point2d.hh> @@ -96,4 +95,4 @@ } -#endif // ndef PROTO_OLN_CORE_ABSTRACT_ITER_HH +#endif // ndef PROTO_OLN_CORE_2D_ITER2D_HH
20Â years, 2Â months
1
0
0
0
← Newer
1
...
945
946
947
948
949
950
951
...
963
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
Results per page:
10
25
50
100
200