Index: olena/ChangeLog
from Damien Thivolle <damien(a)lrde.epita.fr>
* olena/oln/core/accum.hh: Add comments.
* olena/oln/core/apply.hh: Likewise.
* olena/oln/core/compose.hh: Likewise.
* olena/oln/core/coord.hh: Likewise.
* olena/oln/core/dpoint1d.hh: Likewise.
* olena/oln/core/dpoint2d.hh: Likewise.
* olena/oln/core/dpoint3d.hh: Likewise.
* olena/oln/core/fold.hh: Likewise.
* olena/oln/core/image1d.hh: Likewise.
* olena/oln/core/image1d_size.hh: Likewise.
* olena/oln/core/image2d.hh: Likewise.
* olena/oln/core/image2d_size.hh: Likewise.
* olena/oln/core/image3d.hh: Likewise.
* olena/oln/core/image3d_size.hh: Likewise.
* olena/oln/core/image.hh: Likewise.
* olena/oln/core/point1d.hh: Likewise.
* olena/oln/core/point2d.hh: Likewise.
* olena/oln/core/point3d.hh: Likewise.
* olena/oln/core/traverse.hh: Likewise.
* olena/oln/core/abstract/image.hh: Correct comments.
* olena/oln/core/impl/image_impl.hh: Add comments.
* olena/oln/core/impl/image_array.hh: Likewise.
* olena/oln/core/impl/image_array3d.hh: Likewise.
* olena/oln/core/impl/image_array2d.hh: Likewise.
* olena/oln/core/impl/image_array1d.hh: Likewise.
* olena/oln/core/behavior.hh: Likewise.
Index: olena/oln/core/accum.hh
--- olena/oln/core/accum.hh Thu, 07 Aug 2003 02:08:21 +0200 david (oln/d/40_accum.hh 1.4
600)
+++ olena/oln/core/accum.hh Fri, 12 Mar 2004 19:40:52 +0100 thivol_d (oln/d/40_accum.hh
1.4 600)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2004 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
@@ -28,9 +28,19 @@
#ifndef OLENA_CORE_ACCUM_HH
# define OLENA_CORE_ACCUM_HH
+
+/*! \class max_accumulator
+**
+** This is a \a functor. It saves the maximum T value
+** that has been passed as an argument of its operator()
+** method. To retrieve the value saved, just use the
+** max_accumulator as a T instance.
+*/
+
template <class T>
struct max_accumulator
{
+
max_accumulator (T t) : acc_(t)
{}
Index: olena/oln/core/apply.hh
--- olena/oln/core/apply.hh Thu, 07 Aug 2003 02:08:21 +0200 david (oln/d/39_apply.hh 1.14
600)
+++ olena/oln/core/apply.hh Fri, 12 Mar 2004 19:40:52 +0100 thivol_d (oln/d/39_apply.hh
1.14 600)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 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
@@ -40,8 +40,9 @@
| Unary |
`------*/
- /* Standard unary 'apply' procedure. Apply function f to each
- element of input. */
+ /*! \brief Standard unary \a apply procedure. Apply function f to each
+ ** element of input.
+ */
template<class AdaptableUnaryFun, class I> inline
typename mute<I, typename AdaptableUnaryFun::result_type>::ret
apply(AdaptableUnaryFun f, const abstract::image<I>& input)
@@ -54,8 +55,10 @@
}
- /* Same as above, but the function is passed as a type
- and we build it ourself. */
+ /*! \brief Standard unary \a apply procedure. Apply function f to each
+ ** element of input, the function is passed as a type
+ ** and we build it ourself.
+ */
template<class AdaptableUnaryFun, class I> inline
typename mute<I, typename AdaptableUnaryFun::result_type>::ret
apply(const abstract::image<I>& input)
@@ -64,8 +67,11 @@
}
- /* Same as above, but for template functions passed as template-id.
- We need to instantiate the function for the type of the abstract::image. */
+ /*! \brief Standard unary \a apply procedure. Apply function f to each
+ ** element of input, the function is passed as a type
+ ** and we build it ourself. For template functions passed as template-id,
+ ** we need to instantiate the function for the type of the abstract::image.
+ */
template<template<class> class AdaptableUnaryFun,
class I> inline
typename mute<I, typename
AdaptableUnaryFun<oln_value_type(I)>::result_type>::ret
@@ -81,10 +87,15 @@
| binary |
`-------*/
- /* FIXME: Don't we want to name these functions 'apply()' too? */
-
- /* Standard binary 'apply' procedure. Apply function f to each
- element of input1 and input2. */
+ /*!
+ ** \todo FIXME: Don't we want to name these functions 'apply()' too?
+ */
+
+ /*! \brief Standard binary \a apply procedure. Apply function f to each
+ ** element of input1 and input2.
+ **
+ ** \todo FIXME: Don't we want to name these functions 'apply()' too?
+ */
template<class AdaptableBinaryFun, class I1, class I2> inline
typename mute<I1, typename AdaptableBinaryFun::result_type>::ret
apply2(AdaptableBinaryFun f,
@@ -99,8 +110,12 @@
}
- /* Same as above, but the function is passed as a type
- and we build it ourself. */
+ /*! \brief Standard binary \a apply procedure. Apply function f to each
+ ** element of input1 and input2. The function is passed as a type
+ ** and we build it ourself.
+ **
+ ** \todo FIXME: Don't we want to name these functions 'apply()' too?
+ */
template<class AdaptableBinaryFun, class I1, class I2> inline
typename mute<I1, typename AdaptableBinaryFun::result_type>::ret
apply2(const abstract::image<I1>& input1, const
abstract::image<I2>& input2)
@@ -108,8 +123,14 @@
return apply2(AdaptableBinaryFun(), input1, input2);
}
- /* Same as above, but for template functions passed as template-id.
- We need to instantiate the function for the type of the abstract::images. */
+ /*! \brief Standard binary \a apply procedure. Apply function f to each
+ ** element of input1 and input2. The function is passed as a type
+ ** and we build it ourself. For template functions passed as template-id,
+ ** we need to instantiate the function for the type of the
+ ** abstract::images.
+ **
+ ** \todo FIXME: Don't we want to name these functions 'apply()' too?
+ */
template<template <class, class> class AdaptableBinaryFun,
class I1, class I2> inline
typename mute<I1,
@@ -121,8 +142,16 @@
return apply2(tmp, input1, input2);
}
- /* Same as above, when I1 == I2 and the AdaptableBinaryFun template
- has only one parameter. */
+
+ /*! \brief Standard binary \a apply procedure. Apply function f to each
+ ** element of input1 and input2. The function is passed as a type
+ ** and we build it ourself. For template functions passed as template-id,
+ ** we need to instantiate the function for the type of the
+ ** abstract::images.
+ **
+ ** \todo FIXME: Don't we want to name these functions 'apply()' too?\n
+ ** FIXME: Workaround for g++-2.95 bug.
+ */
template<template <class> class AdaptableBinaryFun,
class I> inline
typename mute<I,
@@ -139,9 +168,10 @@
| self unary |
`-----------*/
- /* Main apply_self() function. Note we require a UnaryFun only,
- not a AdaptableUnaryFunc, because as we overwrite an abstract::image
- we already know the output type. */
+ /*! \brief Main apply_self() function. Note we require a UnaryFun only,
+ ** not a AdaptableUnaryFunc, because as we overwrite an abstract::image
+ ** we already know the output type.
+ */
template<class UnaryFun, class I> inline
abstract::image<I>& apply_self(UnaryFun f, abstract::image<I>&
input)
{
@@ -151,7 +181,10 @@
}
- /* Same as above, but we instantiate the function ourself. */
+ /*! \brief Main apply_self() function. Note we require a UnaryFun only,
+ ** not a AdaptableUnaryFunc, because as we overwrite an abstract::image
+ ** we already know the output type. We instantiate the function ourself.
+ */
template<class UnaryFun, class I> inline
abstract::image<I>& apply_self(abstract::image<I>& input)
{
@@ -159,8 +192,12 @@
}
- /* If the function is passed as a template-id. Instantiate it
- for the type of the input elements. */
+ /*! \brief Main apply_self() function. Note we require a UnaryFun only,
+ ** not a AdaptableUnaryFunc, because as we overwrite an abstract::image
+ ** we already know the output type. We instantiate the function ourself.
+ **
+ ** \todo FIXME: Workaround for g++-2.95 bug.
+ */
template<template<class> class UnaryFun, class I> inline
abstract::image<I>& apply_self(abstract::image<I>& input)
{
@@ -174,7 +211,10 @@
| self binary |
`------------*/
- /* Main apply2_exact() function. See also the comment for apply_self(). */
+ /*! \brief Main apply2_exact() function.
+ **
+ ** \see apply_self()
+ */
template<class UnaryFun, class I1, class I2>
abstract::image<I1>& apply2_self(UnaryFun f,
abstract::image<I1>& input1, const abstract::image<I2>& input2)
@@ -186,7 +226,10 @@
}
- /* Same as above, but we instantiate the function ourself. */
+ /*! \brief We instantiate the function ourself.
+ **
+ ** \see apply_self()
+ */
template<class UnaryFun, class I1, class I2> inline
abstract::image<I1>& apply2_self(abstract::image<I1>& input1, const
abstract::image<I1>& input2)
{
@@ -194,8 +237,13 @@
}
- /* If the function is passed as a template-id. Instantiate it
- for the type of the input elements. */
+ /*! \brief If the function is passed as a template-id, we
+ ** Instantiate it for the type of the input elements.
+ **
+ ** \todo FIXME: Workaround for g++-2.95 bug.
+ **
+ ** \see apply_self()
+ */
template<template<class, class> class UnaryFun, class I1, class I2> inline
abstract::image<I1>& apply2_self(abstract::image<I1>& input1, const
abstract::image<I2>& input2)
{
@@ -205,7 +253,12 @@
}
- /* Same as above, but I1==I2 and the UnaryFun has only one parameter. */
+ /*! apply2_self() if I1==I2 and the UnaryFun has only one parameter.
+ **
+ ** \todo FIXME: Workaround for g++-2.95 bug.
+ **
+ ** \see apply_self()
+ */
template<template<class> class UnaryFun, class I> inline
abstract::image<I>& apply2_self(abstract::image<I>& input1, const
abstract::image<I>& input2)
{
Index: olena/oln/core/compose.hh
--- olena/oln/core/compose.hh Thu, 07 Aug 2003 02:08:21 +0200 david (oln/c/22_compose.hh
1.5 600)
+++ olena/oln/core/compose.hh Fri, 12 Mar 2004 19:40:52 +0100 thivol_d
(oln/c/22_compose.hh 1.5 600)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2004 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
@@ -34,6 +34,12 @@
namespace internal {
+ /*! \class compose_uu_
+ **
+ ** The operator () of this class performs a composition between
+ ** two unary functors F1 & F2.
+ */
+
template< class F1, class F2 >
struct compose_uu_ :
public std::unary_function <typename F2::argument_type,
@@ -56,6 +62,13 @@
};
+ /*! \class compose_ub_
+ **
+ ** The operator () of this class performs a composition between
+ ** an unary functor F1 and a binary functor F2.
+ */
+
+
template< class F1, class F2 >
struct compose_ub_ :
public std::binary_function <typename F2::first_argument_type,
@@ -80,6 +93,12 @@
};
+ /*! \class compose_bu_
+ **
+ ** The operator () of this class performs a composition between
+ ** a binary functor F1 and an unary functor F2.
+ */
+
template< class F1, class F2 >
struct compose_bu_ :
public std::binary_function <typename F2::argument_type,
@@ -107,6 +126,7 @@
}
+ /// Compose two unary functors F1 & F2.
template<class UF1, class UF2>
internal::compose_uu_<UF1, UF2>
compose_uu(const UF1& f1, const UF2& f2)
@@ -114,6 +134,7 @@
return internal::compose_uu_<UF1, UF2>(f1, f2);
}
+ /// Compose an unary functors F1 with a binary functor F2.
template<class UF1, class BF2>
internal::compose_ub_<UF1, BF2>
compose_ub(const UF1& f1, const BF2& f2)
@@ -121,6 +142,7 @@
return internal::compose_ub_<UF1, BF2>(f1, f2);
}
+ /// Compose a binary functor F1 and an unary functor F2.
template<class BF1, class UF2>
internal::compose_bu_<BF1, UF2>
compose_bu(const BF1& f1, const UF2& f2)
@@ -128,6 +150,10 @@
return internal::compose_bu_<BF1, UF2>(f1, f2);
}
+ /*! \class f_identity
+ **
+ ** This functor returns its argument.
+ */
template<class T>
struct f_identity : std::unary_function<T, T>
Index: olena/oln/core/coord.hh
--- olena/oln/core/coord.hh Thu, 07 Aug 2003 02:08:21 +0200 david (oln/d/29_coord.hh 1.3
600)
+++ olena/oln/core/coord.hh Fri, 12 Mar 2004 19:40:52 +0100 thivol_d (oln/d/29_coord.hh
1.3 600)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2004 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
@@ -31,6 +31,7 @@
namespace oln {
+ /// coord == int
typedef int coord;
@@ -39,6 +40,13 @@
{
template<class T> struct default_less;
+ /*! \brief default_less<coord>
+ **
+ ** Specialized version for \a coord. This functor
+ ** test if a coord \a lhs is less than another
+ ** coord \a rhs.
+ */
+
template<>
struct default_less<coord>
{
Index: olena/oln/core/dpoint1d.hh
--- olena/oln/core/dpoint1d.hh Tue, 14 Oct 2003 09:40:52 +0200 burrus_n
(oln/d/27_dpoint1d.h 1.13 600)
+++ olena/oln/core/dpoint1d.hh Fri, 12 Mar 2004 19:40:52 +0100 thivol_d
(oln/d/27_dpoint1d.h 1.13 600)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 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
@@ -41,6 +41,11 @@
class dpoint1d; //fwd_decl
+ /*! \class dpoint_traits<dpoint1d>
+ **
+ ** The specialized version for dpoint1d.
+ */
+
template <>
struct dpoint_traits<dpoint1d>: public
dpoint_traits<abstract::dpoint<dpoint1d> >
@@ -49,6 +54,17 @@
typedef point1d point_type;
};
+ /*! \class dpoint1d
+ **
+ ** Subclass of abstract::dpoint, declaration of dpoint
+ ** for image1d. To instantiate a dpoint1d on an
+ ** oln::image1d<ntg::rgb_8> for example, use the
+ ** macro oln_dpoint_type(I).\n
+ ** oln_dpoint_type(oln::image1d<ntg::rgb_8>) p();\n
+ ** or\n
+ ** oln_dpoint_type(oln::image1d<ntg::rgb_8>) p(1);
+ */
+
class dpoint1d : public abstract::dpoint<dpoint1d>
{
@@ -58,15 +74,23 @@
friend class abstract::dpoint<dpoint1d>;
+
dpoint1d();
+ /// The coordinate of the dpoint1d is set to \a c.
+
dpoint1d(coord c);
+ /// The coordinate of the dpoint1d is set to the \p coordinate.
+
explicit dpoint1d(const point1d& p);
+ /// Return the value of the dpoint1d coordinate.
coord
col() const;
+ /// Return a reference to the dpoint1d coordinate.
+
coord&
col();
@@ -78,26 +102,53 @@
protected:
+ /*! \brief Return a dpoint1d whose coordinate is equal to
+ ** \a dp coordinate plus the current dpoint1d coordinate.
+ **
+ */
+
dpoint1d
plus_dp(const dpoint1d& dp) const;
+ /*! \brief Return a dpoint1d whose coordinate is equal to
+ ** the opposite of the current dpoint1d coordinate.
+ */
+
dpoint1d
minus() const;
+ /*! \brief Return a dpoint1d whose coordinate is equal to
+ ** the current dpoint1d coordinate minus 'dp' coordinate.
+ */
+
dpoint1d
minus_dp(const dpoint1d& dp) const;
+ /*! \brief Return a reference to the current dpoint1d
+ ** plus 'dp'.
+ */
+
dpoint1d&
plus_assign_dp(const dpoint1d& dp);
+ /*! \brief Return a reference to the current dpoint1d
+ ** minus 'dp'.
+ */
+
dpoint1d&
minus_assign_dp(const dpoint1d& dp);
};
+
namespace internal
{
+ /*! \class default_less<dpoint1d>
+ **
+ ** The specialized version for dpoint1d.
+ */
+
template<>
struct default_less<dpoint1d> :
public default_less<dpoint1d::super_type>
@@ -107,6 +158,9 @@
} // end of internal
} // end of oln
+
+/// Write on an output stream \a o the coordinate of the dpoint1d \a dp.
+
inline std::ostream&
operator<<(std::ostream& o, const oln::dpoint1d& dp);
Index: olena/oln/core/dpoint2d.hh
--- olena/oln/core/dpoint2d.hh Tue, 14 Oct 2003 09:40:52 +0200 burrus_n
(oln/d/25_dpoint2d.h 1.12 600)
+++ olena/oln/core/dpoint2d.hh Fri, 12 Mar 2004 19:40:52 +0100 thivol_d
(oln/d/25_dpoint2d.h 1.12 600)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 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
@@ -38,6 +38,13 @@
class point2d;
class dpoint2d;
+
+
+ /*! \class dpoint_traits<dpoint2d>
+ **
+ ** The specialized version for dpoint2d.
+ */
+
template<>
struct dpoint_traits<dpoint2d>: public
dpoint_traits<abstract::dpoint<dpoint2d> >
@@ -46,6 +53,18 @@
typedef point2d point_type;
};
+ /*! \class dpoint2d
+ **
+ ** Subclass of abstract::dpoint, declaration of dpoint
+ ** for image2d. To instantiate a dpoint2d on an
+ ** oln::image2d<ntg::rgb_8> for example, use the
+ ** macro oln_dpoint_type(I).\n
+ ** oln_dpoint_type(oln::image2d<ntg::rgb_8>) dp();\n
+ ** or\n
+ ** oln_dpoint_type(oln::image2d<ntg::rgb_8>) dp(1, 2);
+ */
+
+
class dpoint2d : public abstract::dpoint< dpoint2d >
{
@@ -57,19 +76,30 @@
dpoint2d();
+ /// The coordinates of the dpoint2d are set to \a row and \a col.
+
dpoint2d(coord row, coord col);
+ /// The coordinates of the dpoint2d are set to the \a p coordinates.
explicit dpoint2d(const point2d& p);
+ /// Return the value of the dpoint2d row coordinate.
+
coord
row() const;
+ /// Return a reference to the dpoint2d row coordinate.
+
coord&
row();
+ /// Return the value of the dpoint2d column coordinate.
+
coord
col() const;
+ /// Return a reference to the dpoint2d column coordinate.
+
coord&
col();
@@ -81,18 +111,40 @@
protected:
+
+ /*! \brief Return a dpoint2d whose coordinates are equal to
+ ** \a dp coordinates plus the current dpoint2d coordinates.
+ */
+
dpoint2d
plus_dp(const dpoint2d& dp) const;
+ /*! \brief Return a dpoint2d whose coordinates are equal to
+ ** the opposite of the current dpoint2d coordinates.
+ */
+
dpoint2d
minus() const;
+
+ /*! \brief Return a dpoint2d whose coordinates are equal to
+ ** the current dpoint2d coordinates minus \a dp coordinates.
+ */
+
dpoint2d
minus_dp(const dpoint2d& dp) const;
+ /*! \brief Return a reference to the current dpoint2d
+ ** plus \a dp.
+ */
+
dpoint2d&
plus_assign_dp(const dpoint2d& dp);
+ /*! \brief Return a reference to the current dpoint2d
+ ** minus \a dp.
+ */
+
dpoint2d&
minus_assign_dp(const dpoint2d& dp);
@@ -100,6 +152,11 @@
namespace internal
{
+ /*! \class default_less<dpoint2d>
+ **
+ ** The specialized version for dpoint2d.
+ */
+
template<>
struct default_less<dpoint2d> :
public default_less<dpoint2d::super_type>
@@ -108,6 +165,8 @@
} // end of oln
+/// Write on an output stream \a o the coordinates of the dpoint2d \a dp.
+
inline std::ostream&
operator<<(std::ostream& o, const oln::dpoint2d& dp);
Index: olena/oln/core/dpoint3d.hh
--- olena/oln/core/dpoint3d.hh Tue, 14 Oct 2003 09:40:52 +0200 burrus_n
(oln/d/23_dpoint3d.h 1.12 600)
+++ olena/oln/core/dpoint3d.hh Fri, 12 Mar 2004 19:40:52 +0100 thivol_d
(oln/d/23_dpoint3d.h 1.12 600)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 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
@@ -38,6 +38,11 @@
class point3d;
class dpoint3d;
+ /*! \class dpoint_traits<dpoint3d>
+ **
+ ** The specialized version for dpoint3d.
+ */
+
template<>
struct dpoint_traits<dpoint3d>: public
dpoint_traits<abstract::dpoint<dpoint3d> >
@@ -46,6 +51,17 @@
typedef point3d point_type;
};
+ /*! \class dpoint3d
+ **
+ ** Subclass of abstract::dpoint, declaration of dpoint
+ ** for image3d. To instantiate a dpoint3d on an
+ ** oln::image3d<ntg::rgb_8> for example, use the
+ ** macro oln_dpoint_type(I).\n
+ ** oln_dpoint_type(oln::image3d<ntg::rgb_8>) dp();\n
+ ** or\n
+ ** oln_dpoint_type(oln::image3d<ntg::rgb_8>) dp(1, 2, 3);
+ */
+
class dpoint3d : public abstract::dpoint< dpoint3d >
{
@@ -57,25 +73,44 @@
dpoint3d();
+ /// The coordinates of the dpoint3d are set to \a slice, \a row, and \a col.
+
dpoint3d(coord slice, coord row, coord col);
+ /// The coordinates of the dpoint3d are set to the \a p coordinates.
+
explicit dpoint3d(const point3d& p);
+
+ /// Return the value of the dpoint3d slice coordinate.
+
coord
slice() const;
+ /// Return a reference to the dpoint3d slice coordinate.
+
coord&
slice();
+ /// Give the value of the dpoint3d row coordinate.
+
coord
row() const;
+ /*! \brief Return a reference to the dpoint3d row coordinate.
+ **
+ */
+
coord&
row();
+ /// Return the value of the dpoint3d column coordinate.
+
coord
col() const;
+ /// Return a reference to the dpoint3d column coordinate.
+
coord&
col();
@@ -87,25 +122,50 @@
protected:
+ /*! \brief Return a dpoint3d whose coordinates are equal to
+ ** \a dp coordinates plus the current dpoint3d coordinates.
+ **
+ */
+
dpoint3d
plus_dp(const dpoint3d& dp) const;
+ /*! \brief Return a dpoint3d whose coordinates are equal to
+ ** the opposite of the current dpoint3d coordinates.
+ */
+
dpoint3d
minus() const;
+ /*! \brief Return a dpoint3d whose coordinates are equal to
+ ** the current dpoint3d coordinates minus \a dp coordinates.
+ */
+
dpoint3d
minus_dp(const dpoint3d& dp) const;
+ /*! \brief Return a reference to the current dpoint3d
+ ** plus \a dp.
+ */
+
dpoint3d&
plus_assign_dp(const dpoint3d& dp);
+ /*! \brief Return a reference to the current dpoint3d
+ ** minus 'dp'.
+ */
+
dpoint3d&
minus_assign_dp(const dpoint3d& dp);
};
-
namespace internal
{
+ /*! \class default_less<dpoint3d>
+ **
+ ** The specialized version for dpoint3d.
+ */
+
template<>
struct default_less<dpoint3d> :
public default_less<dpoint3d::super_type>
@@ -115,6 +175,8 @@
} // end of oln
+/// Write on an output stream \a o the coordinates of the dpoint3d \a dp.
+
inline std::ostream&
operator<<(std::ostream& o, const oln::dpoint3d& dp);
Index: olena/oln/core/fold.hh
--- olena/oln/core/fold.hh Thu, 07 Aug 2003 02:08:21 +0200 david (oln/c/7_fold.hh 1.13
600)
+++ olena/oln/core/fold.hh Fri, 12 Mar 2004 19:40:52 +0100 thivol_d (oln/c/7_fold.hh 1.13
600)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 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
@@ -36,17 +36,21 @@
namespace oln {
- // Compute f(...f(f(val,i_0),i_1)...,i_n), where i_0...i_n
- // are the value associated to each abstract::image point.
+
+ /*! \brief Compute f(...f(f(val,i_0),i_1)...,i_n), where i_0...i_n
+ ** are the value associated to each abstract::image point.
+ ** f could return a reference or a const. Make sure VAL is assignable.
+ **
+ ** \todo FIXME: Ensure that first_argument_type == result_type.
+ */
+
template<class AdaptableBinaryFun, class I> inline
typename AdaptableBinaryFun::result_type
fold(AdaptableBinaryFun f,
- // f could return a reference or a const. Make sure VAL is assignable.
typename mlc::typeadj<
typename AdaptableBinaryFun::result_type>::mutable_val val,
const abstract::image<I>& input)
{
- // FIXME: ensure that first_argument_type == result_type.
oln_iter_type(I) p(input);
for_all(p)
val = f(val, input[p]);
@@ -54,15 +58,18 @@
}
- // Compute f(...f(f(i_0,i_1),i_2)...,i_n).
+ /*! \brief Compute f(...f(f(i_0,i_1),i_2)...,i_n), where i_0...i_n
+ ** are the value associated to each abstract::image point.
+ ** f could return a reference or a const, so make sure VAL is assignable.
+ **
+ ** \todo FIXME: Ensure that first_argument_type == result_type.
+ */
template<class AdaptableBinaryFun, class I> inline
typename AdaptableBinaryFun::result_type
fold(AdaptableBinaryFun f, const abstract::image<I>& input)
{
- // FIXME: ensure that first_argument_type == result_type.
oln_iter_type(I) p(input);
p = begin;
- // f could return a reference or a const, so make sure VAL is assignable.
typename mlc::typeadj<
typename AdaptableBinaryFun::result_type>::mutable_val val
= input[p];
Index: olena/oln/core/image1d.hh
--- olena/oln/core/image1d.hh Mon, 02 Feb 2004 10:57:28 +0100 van-vl_n
(oln/c/47_image1d.hh 1.28.1.1 600)
+++ olena/oln/core/image1d.hh Fri, 12 Mar 2004 19:40:52 +0100 thivol_d
(oln/c/47_image1d.hh 1.28.1.1 600)
@@ -44,6 +44,12 @@
template<class T, class Exact = mlc::final>
class image1d; // fwd_decl
+ /*! \class image_id<image1d<T, Exact> >
+ **
+ ** Helper class used by image_traits to retrieve
+ ** the typedef associated to an image.
+ */
+
template<class T, class Exact>
struct image_id<image1d<T, Exact> >
{
@@ -53,6 +59,12 @@
typedef impl::image_array1d<T> impl_type;
};
+ /*! \class image_traits<image1d<T, Exact> >
+ **
+ ** Helper class usefull to retrieve all the type
+ ** relative to an image.
+ */
+
template<class T, class Exact>
struct image_traits<image1d<T, Exact> >:
public image_traits<image<image_id<image1d<T, Exact> >::dim,
@@ -66,6 +78,13 @@
// client can use image1d; instances are real images, that is,
// images with data ---conversely to proxy images
+ /*! \class image1d
+ **
+ ** To instantiate an image1d with oln::rgb_8 as value_type,
+ ** one can write:\n
+ ** oln::image1d<ntg::rgb_8> t;
+ */
+
template<class T, class Exact>
class image1d:
public image<image_id<image1d<T, Exact> >::dim,
@@ -93,22 +112,46 @@
mlc_init_static_hierarchy(Exact);
}
+ /*! \brief Allocate memory to contain
+ ** an image1d with \a ncols column plus a border
+ ** width equal to 2 by default.
+ */
+
image1d(coord ncols, coord border = 2) :
super_type(new impl_type(image1d_size(ncols, border)))
{
mlc_init_static_hierarchy(Exact);
}
+ /*! \brief Allocate memory to contain an
+ ** image1d with a size equal to \a size.
+ */
+
image1d(const image1d_size& size) :
super_type(new impl_type(size))
{
mlc_init_static_hierarchy(Exact);
}
+ /*! \brief Build a new image1d by performing
+ ** a shallow copy of \a rhs, all the points
+ ** will be shared between \a rhs and the
+ ** current image.
+ **
+ ** \see abstract::image::clone()
+ */
+
image1d(self_type& rhs) : // shallow copy
super_type(rhs)
{ mlc_init_static_hierarchy(Exact); }
+ /*! \brief Perform a shallow copy from \a rhs to
+ ** the current image, the points are not duplicated
+ ** but shared between the two images.
+ **
+ ** \see abstract::image::clone()
+ */
+
exact_type&
operator=(self_type rhs)
{
@@ -116,6 +159,14 @@
}
// io
+
+ /*! \brief Perform a shallow copy from \a r to
+ ** the new image, the points are not duplicated,
+ ** but shared between the two images.
+ **
+ ** \see abstract::image::clone()
+ */
+
image1d(const io::internal::anything& r)
: super_type()
{
@@ -123,6 +174,13 @@
r.assign(*this);
}
+ /*! \brief Perform a shallow copy from \a r to
+ ** the current image, the points are not duplicated,
+ ** but shared between the two images.
+ **
+ ** \see abstract::image::clone()
+ */
+
image1d&
operator=(const io::internal::anything& r)
{
@@ -138,6 +196,8 @@
+ Exact::name() + ">";
}
+ /// Define ret equal to image1d<U>.
+
template<class U>
struct mute
{
@@ -148,11 +208,18 @@
protected:
+ /*! \brief Return a deep copy of the current image.
+ **
+ ** \warning It may be really dangerous to instantiate a self_type
+ ** and not an exact_type if Exact != mlc::final.
+ **
+ ** \todo FIXME: It may be really dangerous to instantiate a self_type
+ ** and not an exact_type if Exact != mlc::final.
+ */
+
self_type
clone_() const // deep copy
{
- // FIXME: it may be really dangerous to instantiate a self_type
- // and not an exact_type is Exact != mlc::final.
self_type output(this->ncols(), this->border());
clone_to(output.impl());
return output;
@@ -160,6 +227,11 @@
};
+ /*! \class dim_traits<1, T, Exact>
+ **
+ ** Define img_type equal to image1d<T, Exact>.
+ */
+
template <class T, class Exact>
struct dim_traits<1, T, Exact>
{
Index: olena/oln/core/image1d_size.hh
--- olena/oln/core/image1d_size.hh Thu, 07 Aug 2003 02:08:21 +0200 david
(oln/c/46_image1d_si 1.10 600)
+++ olena/oln/core/image1d_size.hh Fri, 12 Mar 2004 19:40:52 +0100 thivol_d
(oln/c/46_image1d_si 1.10 600)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 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
@@ -36,21 +36,42 @@
struct image1d_size;
+ /*! \class image_size_traits<image1d_size>
+ **
+ ** The specialized version for image1d_size.
+ */
+
template<>
struct image_size_traits<image1d_size>
{
enum { dim = 1 };
};
+ /*! \class image1d_size
+ **
+ ** Size_type for image1d.
+ */
+
struct image1d_size : public abstract::image_size<image1d_size >
{
+ /*! \brief Image1d_size constructor.
+ **
+ ** \arg ncols The number of columns in
+ ** the image is set to \a ncols.
+ **
+ ** \arg border The border width of the image
+ ** is set to border.
+ */
+
image1d_size(coord ncols, coord border)
{
nth(0) = ncols;
border_ = border;
}
+ /// Return the number of columns in the image.
+
coord
ncols() const
{
@@ -58,6 +79,10 @@
return nth(0);
}
+ /*! \brief Return a reference to the number
+ ** of columns in the image.
+ */
+
coord&
ncols()
{
Index: olena/oln/core/image2d.hh
--- olena/oln/core/image2d.hh Mon, 02 Feb 2004 10:57:28 +0100 van-vl_n
(oln/c/45_image2d.hh 1.30.1.1 600)
+++ olena/oln/core/image2d.hh Fri, 12 Mar 2004 19:40:52 +0100 thivol_d
(oln/c/45_image2d.hh 1.30.1.1 600)
@@ -44,6 +44,12 @@
template<class T, class Exact = mlc::final>
class image2d; // fwd_decl
+ /*! \class image_id<image2d<T, Exact> >
+ **
+ ** Helper class used by image_traits to retrieve
+ ** the typedef associated to an image.
+ */
+
template<class T, class Exact>
struct image_id<image2d<T, Exact> >
{
@@ -53,6 +59,12 @@
typedef impl::image_array2d<T> impl_type;
};
+ /*! \class image_traits<image2d<T, Exact> >
+ **
+ ** Helper class usefull to retrieve all the type
+ ** relative to an image.
+ */
+
template<class T, class Exact>
struct image_traits<image2d<T, Exact> >:
public image_traits<image<image_id<image2d<T, Exact> >::dim,
@@ -64,6 +76,13 @@
// client can use image2d; instances are real images, that is,
// images with data ---conversely to proxy images
+ /*! \class image2d
+ **
+ ** To instantiate an image2d with oln::rgb_8 as value_type,
+ ** one can write:\n
+ ** oln::image2d<ntg::rgb_8> t = load("img.ppm");
+ */
+
template<class T, class Exact>
class image2d:
public image<image_id<image2d<T, Exact> >::dim,
@@ -85,24 +104,44 @@
friend class abstract::image<exact_type>;
+
image2d() :
super_type()
{
mlc_init_static_hierarchy(Exact);
}
+
+ /*! \brief Allocate memory to contain
+ ** an image2d with \a ncols column and
+ ** \a nrows rows plus a border width
+ ** equal to 2 by default.
+ */
+
image2d(coord nrows, coord ncols, coord border = 2) :
super_type(new impl_type(image2d_size(nrows, ncols, border)))
{
mlc_init_static_hierarchy(Exact);
}
+ /*! \brief Allocate memory to contain an
+ ** image2d with a size equal to \a size.
+ */
+
image2d(const image2d_size& size) :
super_type(new impl_type(size))
{
mlc_init_static_hierarchy(Exact);
}
+ /*! \brief Build a new image2d by performing
+ ** a shallow copy of \a rhs, the points are
+ ** not duplicated, but shared between \a rhs
+ ** and the new image.
+ **
+ ** \see abstract::image::clone()
+ */
+
image2d(self_type& rhs) : // shallow copy
super_type(rhs)
{
@@ -110,6 +149,13 @@
}
// io
+ /*! \brief Perform a shallow copy from \a r to
+ ** the new image, the points are not duplicated,
+ ** but shared between the two images.
+ **
+ ** \see abstract::image::clone()
+ */
+
image2d(const io::internal::anything& r)
: super_type()
{
@@ -117,12 +163,26 @@
r.assign(*this);
}
+ /*! \brief Perform a shallow copy from \a rhs to
+ ** the current image, the points are ot duplicated,
+ ** but shared between the two images.
+ **
+ ** \see abstract::image::clone()
+ */
+
image2d&
operator=(const io::internal::anything& r)
{
return r.assign(*this);
}
+ /*! \brief Perform a shallow copy from \a r to
+ ** the current image, the points are not duplicated
+ ** but shared between the two images.
+ **
+ ** \see abstract::image::clone()
+ */
+
exact_type&
operator=(self_type rhs)
{
@@ -138,6 +198,8 @@
+ Exact::name() + ">";
}
+ /// Define ret equal to image2d<U>.
+
template<class U>
struct mute
{
@@ -148,11 +210,18 @@
protected:
+ /*! \brief Return a deep copy of the current image.
+ **
+ ** \warning It may be really dangerous to instantiate a self_type
+ ** and not an exact_type if Exact != mlc::final.
+ **
+ ** \todo FIXME: It may be really dangerous to instantiate a self_type
+ ** and not an exact_type is Exact != mlc::final.
+ */
+
self_type
clone_() const // deep copy
{
- // FIXME: it may be really dangerous to instantiate a self_type
- // and not an exact_type is Exact != mlc::final.
self_type output(this->nrows(), this->ncols(), this->border());
clone_to(output.impl());
return output;
@@ -160,6 +229,11 @@
};
+ /*! \class dim_traits<2, T, Exact>
+ **
+ ** Define img_type equal to image2d<T, Exact>.
+ */
+
template <class T, class Exact>
struct dim_traits<2, T, Exact>
{
Index: olena/oln/core/image2d_size.hh
--- olena/oln/core/image2d_size.hh Thu, 07 Aug 2003 02:08:21 +0200 david
(oln/c/44_image2d_si 1.10 600)
+++ olena/oln/core/image2d_size.hh Fri, 12 Mar 2004 19:40:52 +0100 thivol_d
(oln/c/44_image2d_si 1.10 600)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 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
@@ -36,6 +36,11 @@
struct image2d_size;
+ /*! \class image_size_traits<image2d_size>
+ **
+ ** The specialized version for image2d_size.
+ */
+
template<>
struct image_size_traits<image2d_size>
{
@@ -43,8 +48,25 @@
};
+ /*! \class image2d_size
+ **
+ ** Size_type for image2d.
+ */
+
struct image2d_size : public abstract::image_size<image2d_size >
{
+ /*! \brief Image2d_size constructor.
+ **
+ ** \arg nrows The number of rows in
+ ** the image is set to \a nrows.
+ **
+ ** \arg ncols The number of columns in
+ ** the image is set to \a ncols.
+ **
+ ** \arg border The border width of the image
+ ** is set to border.
+ */
+
image2d_size(coord nrows, coord ncols, coord border)
{
nth(0) = nrows;
@@ -52,6 +74,8 @@
border_ = border;
}
+ /// Return the number of rows in the image.
+
coord
nrows() const
{
@@ -59,6 +83,8 @@
return nth(0);
}
+ /// Return a reference to the number of rows in the image.
+
coord&
nrows()
{
@@ -66,6 +92,8 @@
return nth(0);
}
+ /// Return the number of columns in the image.
+
coord
ncols() const
{
@@ -73,6 +101,8 @@
return nth(1);
}
+ /// Return a reference to the number of columns in the image.
+
coord&
ncols()
{
Index: olena/oln/core/image3d.hh
--- olena/oln/core/image3d.hh Mon, 02 Feb 2004 10:57:28 +0100 van-vl_n
(oln/c/43_image3d.hh 1.27.1.1 600)
+++ olena/oln/core/image3d.hh Fri, 12 Mar 2004 19:40:52 +0100 thivol_d
(oln/c/43_image3d.hh 1.27.1.1 600)
@@ -44,6 +44,12 @@
template<class T, class Exact = mlc::final>
class image3d; // fwd_decl
+ /*! \class image_id<image3d<T, Exact> >
+ **
+ ** Helper class used by image_traits to retrieve
+ ** the typedef associated to an image.
+ */
+
template<class T, class Exact>
struct image_id<image3d<T, Exact> >
{
@@ -53,6 +59,12 @@
typedef impl::image_array3d<T> impl_type;
};
+ /*! \class image_traits<image3d<T, Exact> >
+ **
+ ** Helper class usefull to retrieve all the type
+ ** relative to an image.
+ */
+
template<class T, class Exact>
struct image_traits<image3d<T, Exact> >:
public image_traits<image<image_id<image3d<T, Exact> >::dim,
@@ -64,6 +76,13 @@
// client can use image3d; instances are real images, that is,
// images with data ---conversely to proxy images
+ /*! \class image3d
+ **
+ ** To instantiate an image3d with oln::rgb_8 as value_type,
+ ** one can write:\n
+ ** oln::image3d<ntg::rgb_8> t;
+ */
+
template<class T, class Exact>
class image3d:
public image<image_id<image3d<T, Exact> >::dim,
@@ -91,19 +110,37 @@
mlc_init_static_hierarchy(Exact);
}
+ /*! \brief Allocate memory to contain
+ ** an image3d with \a ncols column,
+ ** \a nrows rows, and \a nslices slices
+ ** plus a border width equal to 2 by default.
+ */
+
image3d(coord nslices, coord nrows, coord ncols, coord border = 2) :
super_type(new impl_type(image3d_size(nslices, nrows, ncols, border)))
{
mlc_init_static_hierarchy(Exact);
}
+ /*! \brief Allocate memory to contain an
+ ** image3d with a size equal to \a size.
+ */
+
image3d(const image3d_size& size) :
super_type(new impl_type(size))
{
mlc_init_static_hierarchy(Exact);
}
- // shallow copy
+ /*! \brief Build a new image3d by performing
+ ** a shallow copy of \a rhs, the points are
+ ** not duplicated, but shared between \a rhs
+ ** and the new image.
+ **
+ ** \see abstract::image::clone()
+ */
+
+
image3d(self_type& rhs) :
super_type(rhs)
{
@@ -111,17 +148,39 @@
}
// io
+ /*! \brief Perform a shallow copy from \a r to
+ ** the new image, the points are not duplicated,
+ ** but shared between the two images.
+ **
+ ** \see abstract::image::clone()
+ */
+
image3d(const io::internal::anything& r) : super_type()
{
mlc_init_static_hierarchy(Exact);
r.assign(*this);
}
+
+ /*! \brief Perform a shallow copy from \a rhs to
+ ** the current image, the points are ot duplicated,
+ ** but shared between the two images.
+ **
+ ** \see abstract::image::clone()
+ */
+
image3d&
operator=(const io::internal::anything& r)
{
return r.assign(*this);
}
+ /*! \brief Perform a shallow copy from \a r to
+ ** the current image, the points are not duplicated
+ ** but shared between the two images.
+ **
+ ** \see abstract::image::clone()
+ */
+
exact_type&
operator=(self_type rhs)
{
@@ -137,6 +196,8 @@
+ Exact::name() + ">";
}
+ /// Define ret equal to image3d<U>.
+
template<class U>
struct mute
{
@@ -147,11 +208,18 @@
protected:
+ /*! \brief Return a deep copy of the current image.
+ **
+ ** \warning It may be really dangerous to instantiate a self_type
+ ** and not an exact_type if Exact != mlc::final.
+ **
+ ** \todo FIXME: It may be really dangerous to instantiate a self_type
+ ** and not an exact_type is Exact != mlc::final.
+ */
+
self_type
clone_() const // deep copy
{
- // FIXME: it may be really dangerous to instantiate a self_type
- // and not an exact_type is Exact != mlc::final.
self_type output(this->nslices(), this->nrows(), this->ncols(),
this->border());
clone_to(output.impl());
return output;
@@ -159,6 +227,11 @@
};
+ /*! \class dim_traits<3, T, Exact>
+ **
+ ** Define img_type equal to image3d<T, Exact>.
+ */
+
template <class T, class Exact>
struct dim_traits<3, T, Exact>
{
Index: olena/oln/core/image3d_size.hh
--- olena/oln/core/image3d_size.hh Thu, 07 Aug 2003 02:08:21 +0200 david
(oln/c/42_image3d_si 1.10 600)
+++ olena/oln/core/image3d_size.hh Fri, 12 Mar 2004 19:40:52 +0100 thivol_d
(oln/c/42_image3d_si 1.10 600)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 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
@@ -36,17 +36,42 @@
struct image3d_size;
+ /*! \class image_size_traits<image3d_size>
+ **
+ ** The specialized version for image3d_size.
+ */
template<>
struct image_size_traits<image3d_size>
{
enum { dim = 3 };
};
+ /*! \class image3d_size
+ **
+ ** Size_type for image3d.
+ */
+
struct image3d_size : public abstract::image_size<image3d_size >
{
public:
+ /*! \brief Image2d_size constructor.
+ **
+ ** \arg nslices The number of slices in
+ ** the image is set to \a nslices
+ **
+ ** \arg nrows The number of rows in
+ ** the image is set to \a nrows.
+ **
+ ** \arg ncols The number of columns in
+ ** the image is set to \a ncols.
+ **
+ ** \arg border The border width of the image
+ ** is set to border.
+ */
+
+
image3d_size(coord nslices, coord nrows, coord ncols, coord border)
{
nth(0) = nslices;
@@ -55,6 +80,8 @@
border_ = border;
}
+ /// Return the number of slices in the image.
+
coord
nslices() const
{
@@ -62,6 +89,8 @@
return nth(0);
}
+ /// Return a reference to the number of slices in the image.
+
coord&
nslices()
{
@@ -69,6 +98,8 @@
return nth(0);
}
+ /// Return the number of rows in the image.
+
coord
nrows() const
{
@@ -76,6 +107,8 @@
return nth(1);
}
+ /// Return a reference to the number of rows in the image.
+
coord&
nrows()
{
@@ -83,6 +116,8 @@
return nth(1);
}
+ /// Return the number of columns in the image.
+
coord
ncols() const
{
@@ -90,6 +125,8 @@
return nth(2);
}
+ /// Return a reference to the number of columns in the image.
+
coord&
ncols()
{
Index: olena/oln/core/image.hh
--- olena/oln/core/image.hh Mon, 02 Feb 2004 10:57:28 +0100 van-vl_n (oln/d/18_image.hh
1.20.2.1 600)
+++ olena/oln/core/image.hh Fri, 12 Mar 2004 19:40:52 +0100 thivol_d (oln/d/18_image.hh
1.20.2.1 600)
@@ -35,11 +35,18 @@
# include <sstream>
+
namespace oln {
template<unsigned Dim, class T, class Impl, class Exact = mlc::final>
class image; //fwd_decl
+ /*! \class image_id<image<Dim, T, Impl, Exact> >
+ **
+ ** Helper class used by image_traits to retrieve
+ ** the typedef associated to an image.
+ */
+
template<unsigned Dim, class T, class Impl, class Exact>
struct image_id<image<Dim, T, Impl, Exact> >
{
@@ -49,7 +56,13 @@
typedef typename mlc::exact_vt<image<Dim, T, Impl, Exact>, Exact>::ret
exact_type;
};
- template<class T, unsigned Dim, class Impl, class Exact>
+ /*! \class image_traits<image<Dim, T, Impl, Exact> >
+ **
+ ** Helper class usefull to retrieve all the type
+ ** relative to an image.
+ */
+
+ template<unsigned Dim, class T, class Impl, class Exact>
struct image_traits<image<Dim, T, Impl, Exact> >:
public image_traits<abstract::image_with_impl<typename
image_id<image<Dim, T, Impl, Exact> >::impl_type,
typename image_id<image<Dim, T, Impl, Exact> >::exact_type> >
@@ -59,23 +72,53 @@
// image
+
+ /*! \class image
+ **
+ ** Generic image class, all the classic image class (image with dim = N)
+ ** will derive from it.
+ */
+
template<unsigned Dim, class T, class Impl, class Exact>
class image:
public abstract::image_with_impl<typename image_id<image<Dim, T, Impl,
Exact> >::impl_type,
typename image_id<image<Dim, T, Impl, Exact> >::exact_type>
{
+
public:
typedef typename mlc::exact_vt<image<Dim, T, Impl, Exact>, Exact>::ret
exact_type;
typedef typename image_traits<exact_type>::point_type point_type;
+ /*!< Prefer the macro oln_point_type(I) to retrieve the point_type of
+ ** an image.
+ **
+ ** \see abstract::point
+ */
typedef typename image_traits<exact_type>::dpoint_type dpoint_type;
+ /*!< Prefer the macro oln_dpoint_type(I) to retrieve the dpoint_type of
+ ** an image.
+ ** \see abstract::dpoint
+ **
+ */
typedef typename image_traits<exact_type>::iter_type iter_type;
+ /*!< Prefer the macro oln_iter_type(I) to retrieve the iter_type of
+ ** an image.
+ **
+ ** \see abstract::iter
+ */
typedef typename image_traits<exact_type>::fwd_iter_type fwd_iter_type;
+ /*!< Forward iterator type. */
typedef typename image_traits<exact_type>::bkd_iter_type bkd_iter_type;
+ /*!< Backward iterator type. */
typedef typename image_traits<exact_type>::value_type value_type;
+ /*!< Prefer the macro oln_value_type(I) to retrieve the value_type of
+ ** an image.
+ */
typedef typename image_traits<exact_type>::size_type size_type;
+ /*!< Indicate how the image size is handled. */
typedef typename image_traits<exact_type>::impl_type impl_type;
+ /*!< Underlying implementation. */
typedef image<Dim, T, Impl, Exact> self_type;
typedef typename abstract::image_with_impl<Impl,
@@ -86,6 +129,13 @@
mlc_init_static_hierarchy(Exact);
}
+ /*! \brief The new image is a shallow copy of \a rhs.
+ ** The \a rhs points are not duplicated, they are shared by
+ ** the new image.
+ **
+ ** \see oln::abstract::image::clone()
+ */
+
image(self_type& rhs): super_type(rhs)
{
mlc_init_static_hierarchy(Exact);
@@ -100,11 +150,15 @@
return s.str();
}
+ /// The image data pointer is set to \a i.
+
image(impl_type* i) : super_type(i)
{
mlc_init_static_hierarchy(Exact);
}
+ /// Allocate memory according to the \a size value.
+
image(const size_type& size) :
super_type(new impl_type(size))
{
@@ -113,7 +167,11 @@
};
- // mute
+ /*! \class mute
+ **
+ ** \a ret is the same type as \a I excepted the value_type
+ ** which will be \a T.
+ */
template<class I, class T = typename mlc::exact<I>::ret::value_type>
struct mute
@@ -121,7 +179,14 @@
typedef typename mlc::exact<I>::ret::template mute<T>::ret ret;
};
- //define img_type equals to the image of dim Dim
+ //define img_type equal to the image of dim Dim
+
+ /*! \class dim_traits
+ **
+ ** Define img_type equal to the image of dim \a Dim
+ ** the generic declaration defines nothing this class
+ ** will be specialized for each dimension.
+ */
template <unsigned Dim, class T, class Exact = mlc::final>
struct dim_traits
{
Index: olena/oln/core/point1d.hh
--- olena/oln/core/point1d.hh Tue, 14 Oct 2003 09:40:52 +0200 burrus_n
(oln/c/32_point1d.hh 1.14 600)
+++ olena/oln/core/point1d.hh Fri, 12 Mar 2004 19:40:52 +0100 thivol_d
(oln/c/32_point1d.hh 1.14 600)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 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
@@ -41,6 +41,12 @@
class dpoint1d;
class point1d;
+
+ /*! \class point_traits<point1d>
+ **
+ ** The specialized version for point1d.
+ */
+
template<>
struct point_traits<point1d> : public
point_traits<abstract::point<point1d> >
{
@@ -48,6 +54,17 @@
typedef dpoint1d dpoint_type;
};
+ /*! \class point1d
+ **
+ ** Subclass of abstract::point, declaration of point
+ ** for image1d. To instantiate a point1d on an
+ ** oln::image1d<ntg::rgb_8> for example, use the
+ ** macro oln_point_type.\n
+ ** oln_point_type(oln::image1d<ntg::rgb_8>) p();\n
+ ** or\n
+ ** oln_point_type(oln::image1d<ntg::rgb_8>) p(1);
+ */
+
class point1d : public abstract::point<point1d>
{
public:
@@ -59,11 +76,17 @@
point1d();
+ /// The coordinate of the point1d is set to \a col.
+
point1d(coord col);
+ /// Return the value of the point1d coordinate.
+
coord
col() const;
+ /// Return a reference to the point1d coordinate.
+
coord&
col();
@@ -75,21 +98,46 @@
protected:
+
+ /*! \brief Return a point1d whose coordinate is equal to
+ ** \a dp coordinate plus the current point1d coordinate.
+ */
+
point1d
plus_dp(const dpoint1d& dp) const;
+ /*! \brief Return a point1d whose coordinate is equal to
+ ** the current point1d coordinate minus \a dp coordinate.
+ */
+
point1d
minus_dp(const dpoint1d& dp) const;
+ /*! \brief Return a reference to the current point1d
+ ** plus \a dp.
+ */
+
point1d&
plus_assign_dp(const dpoint1d& dp);
+ /*! \brief Return a reference to the current point1d
+ ** minus \a dp.
+ */
+
point1d&
minus_assign_dp(const dpoint1d& dp);
+ /*! \brief Return a dpoint1d whose coordinate is equal
+ ** to the current point1d coordinate minus \a p coordinate.
+ */
+
dpoint1d
minus_p(const point1d& p) const;
+ /*! \brief Return a point1d whose coordinate is equal to
+ ** the opposite of the current point1d coordinate.
+ */
+
point1d
minus() const;
@@ -97,6 +145,12 @@
namespace internal
{
+
+ /*! \class default_less<point1d>
+ **
+ ** The specialized version for point1d.
+ */
+
template<>
struct default_less<point1d> : public default_less<point1d::super_type>
{
@@ -106,6 +160,8 @@
} // oln
+/// Write on an output stream \a o the coordinate of the point1d \a p.
+
inline std::ostream&
operator<<(std::ostream& o, const oln::point1d& p);
Index: olena/oln/core/point2d.hh
--- olena/oln/core/point2d.hh Tue, 14 Oct 2003 09:40:52 +0200 burrus_n
(oln/c/30_point2d.hh 1.12 600)
+++ olena/oln/core/point2d.hh Fri, 12 Mar 2004 19:40:52 +0100 thivol_d
(oln/c/30_point2d.hh 1.12 600)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 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
@@ -31,14 +31,17 @@
# include <oln/core/coord.hh>
# include <oln/core/abstract/point.hh>
# include <iostream>
-
-
namespace oln {
// fwd decl
class dpoint2d;
class point2d;
+ /*! \class point_traits<point2d>
+ **
+ ** The specialized version for point2d.
+ */
+
template<>
struct point_traits<point2d>: public
point_traits<abstract::point<point2d> >
{
@@ -46,6 +49,17 @@
typedef dpoint2d dpoint_type;
};
+ /*! \class point2d
+ **
+ ** Subclass of abstract::point, declaration of point
+ ** for image2d. To instantiate a dpoint2d on an
+ ** oln::image2d<ntg::rgb_8> for example, use the
+ ** macro oln_point_type(I).\n
+ ** oln_point_type(oln::image2d<ntg::rgb_8>) p();\n
+ ** or\n
+ ** oln_point_type(oln::image2d<ntg::rgb_8>) p(1, 2);
+ */
+
class point2d : public abstract::point<point2d >
{
public:
@@ -57,17 +71,27 @@
point2d();
+ /// The coordinates of the point2d are set to \a row and \a col.
+
point2d(coord row, coord col);
+ /// Return Give the value of the point2d row coordinate.
+
coord
row() const;
+ /// Return a reference to the point2d row coordinate.
+
coord&
row();
+ /// Return the value of the point2d col coordinate.
+
coord
col() const;
+ /// Return a reference to the point2d col coordinate.
+
coord&
col();
@@ -79,21 +103,45 @@
protected:
+ /*! \brief Return a point2d whose coordinates are equal to
+ ** \a dp coordinates plus the current point2d coordinates.
+ */
+
point2d
plus_dp(const dpoint2d& dp) const;
+ /*! \brief Return a point2d whose coordinates are equal to
+ ** the current point2d coordinates minus \a dp coordinates.
+ */
+
point2d
minus_dp(const dpoint2d& dp) const;
+ /*! \brief Return a reference to the current point2d
+ ** plus \a dp.
+ */
+
point2d&
plus_assign_dp(const dpoint2d& dp);
+ /*! \brief Return a reference to the current point2d
+ ** minus \a dp.
+ */
+
point2d&
minus_assign_dp(const dpoint2d& dp);
+ /*! \brief Return a dpoint2d whose coordinates are equal
+ ** to the current point2d coordinates minus \a p coordinates.
+ */
+
dpoint2d
minus_p(const point2d& p) const;
+ /*! \brief Return a point2d whose coordinates are equal to
+ ** the opposite of the current point2d coordinates.
+ */
+
point2d
minus() const;
@@ -101,6 +149,12 @@
namespace internal
{
+
+ /*! \class default_less<point2d>
+ **
+ ** The specialized version for point2d.
+ */
+
template<>
struct default_less<point2d> :
public default_less<point2d::super_type>
@@ -109,6 +163,8 @@
} // oln
+/// Write on an output stream \a o the coordinates of the point2d \a p.
+
inline std::ostream&
operator<<(std::ostream& o, const oln::point2d& p);
Index: olena/oln/core/point3d.hh
--- olena/oln/core/point3d.hh Tue, 14 Oct 2003 09:40:52 +0200 burrus_n
(oln/c/28_point3d.hh 1.14 600)
+++ olena/oln/core/point3d.hh Fri, 12 Mar 2004 19:40:52 +0100 thivol_d
(oln/c/28_point3d.hh 1.14 600)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 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
@@ -33,6 +33,7 @@
# include <oln/core/abstract/point.hh>
# include <iostream>
+
namespace oln {
@@ -40,6 +41,11 @@
class dpoint3d;
class point3d;
+ /*! \class point_traits<point3d>
+ **
+ ** The specialized version for point3d.
+ */
+
template<>
struct point_traits<point3d>: public
point_traits<abstract::point<point3d> >
{
@@ -47,6 +53,17 @@
typedef dpoint3d dpoint_type;
};
+ /*! \class point3d
+ **
+ ** Subclass of abstract::point, declaration of point
+ ** for image3d. To instantiate a point3d on an
+ ** oln::image3d<ngt::rgb_8> for example, use the
+ ** macro oln_point_type(I).\n
+ ** oln_point_type(oln::image3d<ngt::rgb_8>) p();\n
+ ** or\n
+ ** oln_point_type(oln::image3d<ngt::rgb_8>) p(1, 2, 3);
+ */
+
class point3d : public abstract::point< point3d >
{
public:
@@ -56,25 +73,40 @@
friend class abstract::point< point3d >;
+
point3d();
+ /// The coordinates of the point3d are set to \a slice, \a row, and \a col.
+
point3d(coord slice, coord row, coord col);
+ /// Return the value of the point3d slice coordinate.
+
coord
slice() const;
+ /// Return a reference to the value of the point3d slice coordinate.
+
coord&
slice();
+ /// Return the value of the point3d row coordinate.
+
coord
row() const;
+ /// Return a reference to the point3d row coordinate.
+
coord&
row();
+ /// Return the value of the point3d col coordinate.
+
coord
col() const;
+ /// Return a reference to the point3d col coordinate.
+
coord&
col();
@@ -86,21 +118,45 @@
protected:
+ /*! \brief Return a point3d whose coordinates are equal to
+ ** \a dp coordinates plus the current point3d coordinates.
+ */
+
point3d
plus_dp(const dpoint3d& dp) const;
+ /*! \brief Return a point3d whose coordinates are equal to
+ ** the current point3d coordinates minus \a dp coordinates.
+ */
+
point3d
minus_dp(const dpoint3d& dp) const;
+ /*! \brief Return a reference to the current point3d
+ ** plus \a dp.
+ */
+
point3d&
plus_assign_dp(const dpoint3d& dp);
+ /*! \brief Return a reference to the current point3d
+ ** minus \a dp.
+ */
+
point3d&
minus_assign_dp(const dpoint3d& dp);
+ /*! \brief Return a dpoint3d whose coordinates are equal
+ ** to the current point3d coordinates minus \a p coordinates.
+ */
+
dpoint3d
minus_p(const point3d& p) const;
+ /*! \brief Return a point3d whose coordinates are equal to
+ ** the opposite of the current point3d coordinates.
+ */
+
point3d
minus() const;
@@ -108,6 +164,12 @@
namespace internal
{
+
+ /*! \class default_less<point3d>
+ **
+ ** The specialized version for point3d.
+ */
+
template<>
struct default_less<point3d> : public default_less<point3d::super_type>
{
@@ -117,6 +179,8 @@
} // end of oln
+/// Write on an output stream \a o the coordinates of the point3d \a p.
+
inline std::ostream&
operator<<(std::ostream& o, const oln::point3d& p);
Index: olena/oln/core/traverse.hh
--- olena/oln/core/traverse.hh Thu, 07 Aug 2003 02:08:21 +0200 david (oln/d/30_traverse.h
1.11 600)
+++ olena/oln/core/traverse.hh Fri, 12 Mar 2004 19:40:52 +0100 thivol_d
(oln/d/30_traverse.h 1.11 600)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2002, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2002, 2003, 2004 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
@@ -37,7 +37,9 @@
// traverse (unary)
-
+ /*! \brief Call the functor \a f on each point of the
+ ** input image.
+ */
template<class I, class F>
const F&
traverse(F& f, const abstract::image<I>& input)
@@ -47,6 +49,10 @@
return f;
}
+
+ /*! \brief Create a functor \a f whose type is F, then
+ ** call it on each point of the input image.
+ */
template<class F, class I>
inline const F
traverse(const abstract::image<I>& input)
@@ -55,6 +61,9 @@
return traverse(f, input);
}
+ /*! \brief Create a functor \a f whose type is F<oln_value_type(I)>,
+ ** then call it on each point of the input image.
+ */
template<template<class> class F, class I>
inline const F<oln_value_type(I)>
traverse(const abstract::image<I>& input)
@@ -63,6 +72,10 @@
return traverse(f, input);
}
+
+ /*! \brief Create a functor \a f whose type is F<oln_value_type(I), I2>,
+ ** the call it on each point of the input image.
+ */
template<template<class, class> class F, class I2, class I>
inline const F<oln_value_type(I), I2>
traverse(const abstract::image<I>& input)
@@ -71,6 +84,10 @@
return traverse(f, input);
}
+ /*! \brief Create a functor \a f whose type is
+ ** F<oln_value_type(I), F2<oln_value_type(I)> >, then call it on
+ ** each point of the input image.
+ */
template<template<class,class> class F,
template<class> class F2,
class I>
@@ -85,7 +102,11 @@
// traverse2 (binary)
-
+ /*! \brief Call functor \a f whose type is F on each point
+ ** of the two input images.
+ **
+ ** \pre input1.size() == input2.size()
+ */
template<class I1, class I2, class F>
const F&
traverse2(F& f,
@@ -98,6 +119,12 @@
return f;
}
+ /*! \brief Create a functor \a f whose type is F<oln_value_type(I)>,
+ ** then call it on each point of the two input images.
+ **
+ ** \pre input1.size() == input2.size()
+ */
+
template<template<class> class F, class I>
inline const F<oln_value_type(I)>
traverse2(const abstract::image<I>& input1, const
abstract::image<I>& input2)
@@ -106,6 +133,13 @@
return traverse2(f, input1, input2);
}
+ /*! \brief Create a functor \a f whose type is
+ ** F<oln_value_type(I1), oln_value_type(I2)>, then call it on each point
+ ** of the two input images.
+ **
+ ** \pre input1.size() == input2.size()
+ */
+
template<template<class,class> class F, class I1, class I2>
inline const F<oln_value_type(I1), oln_value_type(I2)>
traverse2(const abstract::image<I1>& input1,
Index: olena/oln/core/abstract/image.hh
--- olena/oln/core/abstract/image.hh Fri, 12 Mar 2004 17:51:04 +0100 odou_s
(oln/t/25_image.hh 1.24 600)
+++ olena/oln/core/abstract/image.hh Fri, 12 Mar 2004 19:40:52 +0100 thivol_d
(oln/t/25_image.hh 1.24 600)
@@ -37,6 +37,9 @@
namespace oln {
+ /*! \namespace abstract
+ ** \brief abstract namespace.
+ */
namespace abstract {
Index: olena/oln/core/impl/image_impl.hh
--- olena/oln/core/impl/image_impl.hh Thu, 07 Aug 2003 02:37:23 +0200 burrus_n
(oln/t/29_image_impl 1.16 600)
+++ olena/oln/core/impl/image_impl.hh Fri, 12 Mar 2004 19:40:52 +0100 thivol_d
(oln/t/29_image_impl 1.16 600)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2003, 2004 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
@@ -48,6 +48,12 @@
template<class Impl>
struct impl_traits;
+ /*! \class impl_traits<impl::image_impl<Exact> >
+ **
+ ** Specialized version for impl::image_impl<Exact>. Retrieve
+ ** associated types.
+ */
+
template<class Exact>
struct impl_traits<impl::image_impl<Exact> >
{
@@ -56,6 +62,11 @@
namespace impl {
+ /*! \class image_impl
+ **
+ ** Data array implementation for image
+ */
+
template<class Exact>
class image_impl : public mlc_hierarchy::any<Exact>
{
@@ -70,12 +81,19 @@
image_impl(const size_type s): refcount_(0), size_(s) {}
+
+ /// Notice that there is a new reference to the object.
+
void
ref() const
{
++refcount_;
}
+ /*! \brief Notice that there a reference to the object has disappeared.
+ ** When there is no reference left, the object is deleted.
+ */
+
void
unref() const
{
@@ -85,30 +103,40 @@
delete mlc::to_exact(this);
}
+ /// Return a constant reference to the value stored at \a p.
+
const value_type&
at(const point_type& p) const
{
return this->exact().at_(p);
}
+ /// Return a reference to the value stored at \p.
+
value_type&
at(const point_type& p)
{
return this->exact().at_(p);
}
+ /// Return true if \a p belongs to the image.
+
bool
hold(const point_type& p) const
{
return this->exact().hold_(p);
}
+ /// Return true if \a p belongs to the image or the image border.
+
bool
hold_large(const point_type& p) const
{
return this->exact().hold_large_(p);
}
+ /// Use the function for debugging purpose.
+
void
precondition_hold_large(const point_type& p) const
{
@@ -120,12 +148,17 @@
# endif
}
+
+ /// Perform a deep copy from the data array to output_data.
+
void
clone_to(exact_type* output_data) const
{
return this->exact().clone_to_(output_data);
}
+ /// Return the number of point in the image.
+
const
size_type& size() const
{
@@ -140,6 +173,10 @@
// borders
+ /*! \brief Reallocate the border regarding to the value of \a
+ ** new_border.
+ */
+
void
border_reallocate_and_copy(coord new_border, bool
copy_border)
@@ -147,18 +184,28 @@
this->exact().border_reallocate_and_copy_(new_border, copy_border);
}
+ /*! \brief The border points are all set to
+ ** the value of the closest image point.
+ */
+
void
border_replicate(void)
{
this->exact().border_replicate_();
}
+ /*! \brief The border points are set by mirroring
+ ** the image edges.
+ */
+
void
border_mirror(void)
{
this->exact().border_mirror_();
}
+ /// The border points are set to \a val.
+
void
border_assign(value_type val)
{
Index: olena/oln/core/impl/image_array.hh
--- olena/oln/core/impl/image_array.hh Tue, 14 Oct 2003 09:40:52 +0200 burrus_n
(oln/t/30_image_arra 1.14 600)
+++ olena/oln/core/impl/image_array.hh Fri, 12 Mar 2004 19:57:45 +0100 thivol_d
(oln/t/30_image_arra 1.14 600)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2003, 2004 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
@@ -37,6 +37,12 @@
namespace oln {
+ /*! \brief Allocate an array of \a s elements of \a T
+ ** type.
+ **
+ ** \pre s > 0
+ */
+
template<class T>
void
allocate_data_(T*& buffer, size_t s)
@@ -45,6 +51,11 @@
buffer = new T[s];
}
+ /*! \brief Free memory pointed to by buffer, then set buffer to 0.
+ **
+ ** \pre buffer != 0
+ */
+
template<class T>
void
desallocate_data_(T*& buffer)
@@ -59,14 +70,30 @@
class image_array;
} // end of impl
+
+ /*! \class impl_traits<impl::image_array<T, Exact> >
+ **
+ ** The specialized version for impl::image_array<T, Exact>
+ */
+
template<class T, class Exact>
struct impl_traits<impl::image_array<T, Exact> >: public
impl_traits<impl::image_impl<Exact> >
{
};
+ /*! \namespace impl
+ **
+ ** \brief impl namespace.
+ */
+
namespace impl {
+ /*! \class image_array
+ **
+ ** Array implementation of image data.
+ */
+
template<class T, class Exact>
class image_array: public image_impl<Exact>
{
@@ -86,6 +113,12 @@
friend class image_impl<Exact>;
+ /*! \brief Constructor that allocates \a buffer_ to be
+ ** an array of \a s \a value_type.
+ **
+ ** \pre s > 0
+ */
+
image_array(const size_type& s): super_type(s), buffer_(0)
{
allocate_data_(buffer_, len(s));
@@ -96,6 +129,11 @@
void
operator=(const self_type&); // assign op w/o impl
+ /*! \brief Return a constant pointer to the data array.
+ **
+ ** \invariant buffer_ != 0
+ */
+
const T*
buffer() const
{
@@ -103,6 +141,11 @@
return buffer_;
}
+ /*! \brief Return a point to the data array.
+ **
+ ** \invariant buffer_ != 0
+ */
+
T*
buffer()
{
@@ -110,12 +153,14 @@
return buffer_;
}
+ /// Return the length of the data array.
size_t
len() const
{
return len(this->size());
}
+ /// Return the length of the data array.
size_t
len(const size_type& s) const
{
@@ -124,11 +169,20 @@
protected:
+
~image_array()
{
desallocate_data_(buffer_);
}
+ /*! \brief Perform a deep copy of the current data array.
+ ** This copy is pointed to by \a output_data.
+ **
+ ** \pre output_data != 0
+ **
+ ** \pre output_data->len() == len()
+ */
+
void
clone_to_(exact_type* output_data) const
{
Index: olena/oln/core/impl/image_array3d.hh
--- olena/oln/core/impl/image_array3d.hh Tue, 14 Oct 2003 09:40:52 +0200 burrus_n
(oln/t/32_image_arra 1.10 600)
+++ olena/oln/core/impl/image_array3d.hh Fri, 12 Mar 2004 19:40:52 +0100 thivol_d
(oln/t/32_image_arra 1.10 600)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2003, 2004 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
@@ -34,6 +34,8 @@
namespace oln {
+ /// Build an image data array with the real data and the border.
+
template<class T>
void
pretreat_3d_data_(T*& buffer, T**& array2, T***& array,
@@ -64,6 +66,8 @@
array += s.border();
}
+ /// Free the image3d data array.
+
template<class T>
void
desallocate_3d_data_(T**& array2, T***& array, const
@@ -82,6 +86,12 @@
class image_array3d;
} // end of impl
+ /*! \class impl_traits<impl::image_array3d<T> >
+ **
+ ** Specialized version for impl::image_array3d<T>. Retrieve
+ ** associated types.
+ */
+
template<class T>
struct impl_traits<impl::image_array3d<T> >: public
impl_traits<impl::image_array<T, impl::image_array3d<T> > >
{
@@ -94,6 +104,11 @@
namespace impl
{
+ /*! \class image_array3d
+ **
+ ** Data array implementation for image3d
+ */
+
template<class T>
class image_array3d :
public image_array<T, image_array3d<T> >
@@ -126,6 +141,8 @@
protected:
+ /// Return true if \a p belongs to the image.
+
bool
hold_(const point_type& p) const
{
@@ -137,6 +154,8 @@
&& p.col() < this->size_.ncols());
}
+ /// Return true if \a p belongs to the image or the image border
+
bool
hold_large_(const point_type& p) const
{
@@ -148,6 +167,8 @@
&& p.col() < this->size_.ncols() + this->size_.border());
}
+ /// Return a reference to the value stored at \a p.
+
value_type&
at_(const point_type& p)
{
@@ -155,6 +176,8 @@
return at_(p.slice(), p.row(), p.col());
}
+ /// Return a reference to the value stored at \a slice, \a row and \a col.
+
value_type&
at_(coord slice, coord row, coord col)
{
@@ -163,6 +186,8 @@
return array_[slice][row][col];
}
+ /// Return the total size of the data array.
+
size_t
len_(const size_type& s) const
{
@@ -174,6 +199,10 @@
// borders
+ /*! \brief Reallocate the border regarding to the value of \a
+ ** new_border.
+ */
+
void
border_reallocate_and_copy_(coord new_border, bool
copy_border)
@@ -212,6 +241,10 @@
array_ = array;
}
+ /*! \brief The border points are all set to
+ ** the value of the closest image point.
+ */
+
void
border_replicate_(void)
{
@@ -244,6 +277,10 @@
}
}
+ /*! \brief The border points are set by mirroring
+ ** the image edges.
+ */
+
void
border_mirror_(void)
{
@@ -276,6 +313,8 @@
}
}
+ /// The border points are set to \a val.
+
void
border_assign_(value_type val)
{
Index: olena/oln/core/impl/image_array2d.hh
--- olena/oln/core/impl/image_array2d.hh Tue, 14 Oct 2003 09:40:52 +0200 burrus_n
(oln/t/33_image_arra 1.11 600)
+++ olena/oln/core/impl/image_array2d.hh Fri, 12 Mar 2004 19:40:52 +0100 thivol_d
(oln/t/33_image_arra 1.11 600)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2003, 2004 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
@@ -34,6 +34,8 @@
namespace oln {
+ /// Build an image data array with the real data and the border.
+
template<class T>
void
pretreat_2d_data_(T*& buffer, T**& array, const image2d_size& s)
@@ -53,6 +55,8 @@
array += s.border();
}
+ /// Free the image2d data array.
+
template<class T>
void
desallocate_2d_data_(T**& array, const image2d_size& s)
@@ -67,6 +71,12 @@
class image_array2d;
} // end of impl
+ /*! \class impl_traits<impl::image_array2d<T> >
+ **
+ ** Specialized version for impl::image_array2d<T>. Retrieve
+ ** associated types.
+ */
+
template<class T>
struct impl_traits<impl::image_array2d<T> >: public
impl_traits<impl::image_array<T, impl::image_array2d<T> > >
{
@@ -80,6 +90,11 @@
namespace impl
{
+ /*! \class image_array2d
+ **
+ ** Data array implementation for image2d
+ */
+
template<class T>
class image_array2d :
public image_array<T, image_array2d<T> >
@@ -100,6 +115,8 @@
friend class image_impl<image_array2d<T> >;
friend class image_array<T, image_array2d<T> >;
+
+
image_array2d(const size_type& s): super_type(s)
{
pretreat_2d_data_(this->buffer_, array_, s);
@@ -112,6 +129,8 @@
protected:
+ /// Return true if \a p belongs to the image.
+
bool
hold_(const point_type& p) const
{
@@ -122,6 +141,8 @@
p.col() < this->size_.ncols();
}
+ /// Return true if \a p belongs to the image or the image border
+
bool
hold_large_(const point_type& p) const
{
@@ -132,12 +153,16 @@
p.col() < this->size_.ncols() + this->size_.border();
}
+ /// Return a reference to the value stored at \a p.
+
value_type&
at_(const point_type& p)
{
return at_(p.row(), p.col());
}
+ /// Return a reference to the value stored at \a row and \a col.
+
value_type&
at_(coord row, coord col)
{
@@ -146,6 +171,8 @@
return array_[row][col];
}
+ /// Return the total size of the data array.
+
size_t
len_(const size_type& s) const
{
@@ -156,6 +183,10 @@
// borders
+ /*! \brief Reallocate the border regarding to the value of \a
+ ** new_border.
+ */
+
void
border_reallocate_and_copy_(coord new_border, bool
copy_border)
@@ -188,6 +219,11 @@
array_ = array;
}
+
+ /*! \brief The border points are all set to
+ ** the value of the closest image point.
+ */
+
void
border_replicate_(void)
{
@@ -209,6 +245,10 @@
}
}
+ /*! \brief The border points are set by mirroring
+ ** the image edges.
+ */
+
void
border_mirror_(void)
{
@@ -231,6 +271,8 @@
}
}
+ /// The border points are set to \a val.
+
void
border_assign_(value_type val)
{
Index: olena/oln/core/impl/image_array1d.hh
--- olena/oln/core/impl/image_array1d.hh Tue, 14 Oct 2003 09:40:52 +0200 burrus_n
(oln/t/34_image_arra 1.12 600)
+++ olena/oln/core/impl/image_array1d.hh Fri, 12 Mar 2004 19:40:52 +0100 thivol_d
(oln/t/34_image_arra 1.12 600)
@@ -1,4 +1,4 @@
-// Copyright (C) 2001, 2003 EPITA Research and Development Laboratory
+// Copyright (C) 2001, 2003, 2004 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
@@ -34,6 +34,9 @@
namespace oln {
+
+ /// Build an image data array with the real data and the border.
+
template<class T>
void
pretreat_1d_data_(T*& buffer, T*& buffer_, const image1d_size& s)
@@ -48,6 +51,12 @@
class image_array1d;
} // end of impl
+ /*! \class impl_traits<impl::image_array1d<T> >
+ **
+ ** Specialized version for impl::image_array1d<T>. Retrieve
+ ** associated types.
+ */
+
template<class T>
struct impl_traits<impl::image_array1d<T> >: public
impl_traits<impl::image_array<T, impl::image_array1d<T> > >
{
@@ -59,6 +68,12 @@
namespace impl {
+
+ /*! \class image_array1d
+ **
+ ** Data array implementation for image1d
+ */
+
template<class T>
class image_array1d :
public image_array<T, image_array1d<T> >
@@ -88,6 +103,8 @@
protected:
+ /// Return true if \a p belongs to the image.
+
bool
hold_(const point_type& p) const
{
@@ -96,6 +113,8 @@
p.col() < this->size_.ncols();
}
+ /// Return true if \a p belongs to the image or the image border
+
bool
hold_large_(const point_type& p) const
{
@@ -104,12 +123,15 @@
p.col() < this->size_.ncols() + this->size_.border();
}
+
+ /// Return a reference to the value stored at \a p.
value_type&
at_(const point_type& p)
{
return at_(p.col());
}
+ /// Return a reference to the value stored at \a col.
value_type&
at_(coord col)
{
@@ -118,6 +140,8 @@
return buffer__[col];
}
+
+ /// Return the total size of the data array.
size_t
len_(const size_type& s) const
{
@@ -126,6 +150,10 @@
}
// borders
+
+ /*! \brief Reallocate the border regarding to the value of \a
+ ** new_border.
+ */
void
border_reallocate_and_copy_(coord new_border, bool copy_border)
{
@@ -150,6 +178,11 @@
}
+ /*! \brief The border points are all set to
+ ** the value of the closest image point.
+ */
+
+
void
border_replicate_(void)
{
@@ -160,6 +193,10 @@
}
}
+ /*! \brief The border points are set by mirroring
+ ** the image edges.
+ */
+
void
border_mirror_(void)
{
@@ -170,6 +207,8 @@
}
}
+ /// The border points are set to \a val.
+
void
border_assign_(value_type val)
{
Index: olena/oln/core/behavior.hh
--- olena/oln/core/behavior.hh Tue, 24 Feb 2004 16:33:38 +0100 palma_g
(oln/j/47_behavior.h 1.2 600)
+++ olena/oln/core/behavior.hh Fri, 12 Mar 2004 19:40:52 +0100 thivol_d
(oln/j/47_behavior.h 1.2 600)
@@ -33,7 +33,9 @@
namespace oln {
/*! \class mirror_behavior
**
- ** make the border be a mirror of the image
+ ** Make the border be a mirror of the image.
+ **
+ ** \see abstract::image_size::border_
*/
// mirror the image content into the border
template <class Exact = mlc::final>
@@ -52,6 +54,13 @@
};
// set the border to a specific value
+
+ /*! \class value_behavior
+ **
+ ** Set the border to a specific value.
+ **
+ ** \see abstract::image_size::border_
+ */
template <class T, class Exact = mlc::final>
class value_behavior:
public abstract::behavior<mlc_2_exact_vt_type(value_behavior, T, Exact)>
@@ -76,6 +85,13 @@
};
// replicate the border
+
+ /*! \brief replicate_behavior
+ **
+ ** Replicate the border.
+ **
+ ** \see abstract::image_size::border_
+ */
template <class Exact = mlc::final>
class replicate_behavior:
public abstract::behavior<mlc_exact_vt_type(replicate_behavior<Exact>,
Exact)>
@@ -92,17 +108,20 @@
};
// tools to call ctors with type inference
+ /// To call Ctors with type inference.
inline mirror_behavior<> mirror_bhv()
{
return mirror_behavior<>();
}
+ /// To call Ctors with type inference.
template <class T>
inline value_behavior<T> value_bhv(const T &value)
{
return value_behavior<T>(value);
}
+ /// To call Ctors with type inference.
inline replicate_behavior<> replicate_bhv()
{
return replicate_behavior<>();
--
Damien Thivolle
damien.thivolle(a)lrde.epita.fr