Index: integre/ChangeLog
from Niels Van Vliet <niels(a)lrde.epita.fr>
* integre/ntg/core/pred_succ.hh: Add file.
* integre/ntg/Makefile.am: Add file references.
+2004-03-18 Niels Van Vliet <niels(a)lrde.epita.fr>
+
+ * integre/ntg/real/behavior.hh: Change the unsafe::get<T>::check().
+ * integre/ntg/utils/cast.hh: Change cast::force().
+
2004-02-09 Giovanni Palma <giovanni(a)lrde.epita.fr>
* ntg/vect/vec.hh: Add sup() function to vec traits.
Index: olena/ChangeLog
from Niels Van Vliet <niels(a)lrde.epita.fr>
* olena/oln/utils/histogram.hh: Fix doc.
* olena/oln/convert/value_to_point.hh: Likewise.
Index: olena/oln/utils/histogram.hh
--- olena/oln/utils/histogram.hh Thu, 18 Mar 2004 18:24:14 +0100
van-vl_n (oln/10_histogram. 1.6.1.14.1.10 640)
+++ olena/oln/utils/histogram.hh Fri, 19 Mar 2004 11:49:17 +0100
van-vl_n (oln/10_histogram. 1.6.1.14.1.10 640)
@@ -178,11 +178,11 @@
** number of occurrences an image3d (because rgb_8 has 3 components).
**
** \todo FIXME: An image is inside the histogram. This is incorrect
- ** because it is not exactly an image (we do not need any border).
+ ** because it is not exactly an image (no border needed).
**
** \param T Type of the image.
- ** \param CPT Type use to count the occurrences (unsinged).
- ** \param V2P Concersion class to convert a value T to a point.
+ ** \param CPT Type used to count the occurrences (unsigned).
+ ** \param V2P Conversion class to convert a value T to a point.
** \param Exact Exact type of the histogram.
**
** \see oln::abstract::histogram
@@ -227,7 +227,7 @@
/*! \brief Empty histogram.
**
- ** \note The function Init(image) should be used after this
+ ** \note The function init(image) should be used after this
** constructor.
*/
histogram(const value_to_point_type & c2p = value_to_point_type()):
@@ -292,10 +292,10 @@
/*! Minimum value of an histogram.
**
- ** It return the smaller value within the image used to build the
+ ** Return the smaller value within the image used to build the
** histogram.
**
- ** \note It can be slow when the histogram is sparse because it iterate
+ ** \note It can be slow when the histogram is sparse because it
iterates
** over a large range of 0. Use \a histogram_min or \a
histogram_minmax
** instead.
** \see histogram_min
@@ -317,11 +317,11 @@
}
/*! Maximum value of an histogram.
**
- ** It return the higher value within the image used to build the
+ ** Return the higher value within the image used to build the
** histogram.
**
** \note It can be slow when the histogram is sparse because it
- ** iterate over a large range of 0. Use histogram_max or
+ ** iterates over a large range of 0. Use histogram_max or
** histogram_minmax instead.
** \see histogram_max
*/
@@ -357,12 +357,12 @@
/*! Build the histogram and has quick min and max functions.
**
** The idea behind the min- and max-specialized histogram is to
- ** maintain worst min and max bounds while updating histogram. We
- ** don't maintain _exact_ min and max bounds, because this would
+ ** maintain worst min and max bounds while updating histogram. It
+ ** does not maintain _exact_ min and max bounds, because this would
** involve some costly computation when removing values from the
** histogram and maybe this time will be lost if the removed value is
** reinserted before max() or min() is called.\n
- ** So we update the _worst_ min and max bounds whenever the histogram
+ ** So it updates the _worst_ min and max bounds whenever the histogram
** value are accessed, and delay the _real_ min and max computation
** until min() or max() is called.
** \see histogram
@@ -687,10 +687,10 @@
// calculate the histogram of the image
utils::histogram<val> histo(im);
- // initialize the array of pointer to the point in the result
- // with the histogram we can know the number of each color and
- // then calculate an array of pointer for quick access to each
- // value of the image
+ // Initialize the array of pointer to the point in the result.
+ // With the histogram the number of each color can be deduced and
+ // then it calculates an array of pointer for quick access to each
+ // value of the image.
const ntg_cumul_type(val) card = ntg_max_val(val)
- ntg_min_val(val) + 1;
std::vector<oln_point_type(I)* > ptr(card);
@@ -741,7 +741,7 @@
*(ptr[unsigned(im[p] - ntg_min_val(val))]++) = p;
}
- /*! Select staticly the good distrib_sort.
+ /*! Select statically the good distrib_sort.
**
** \param reverse If the sort should be reverted or not.
*/
Index: integre/ntg/Makefile.am
--- integre/ntg/Makefile.am Thu, 27 Nov 2003 11:26:27 +0100 burrus_n
(oln/q/36_Makefile.a 1.8.1.1 640)
+++ integre/ntg/Makefile.am Fri, 19 Mar 2004 11:22:50 +0100 van-vl_n
(oln/q/36_Makefile.a 1.8.1.1 640)
@@ -27,6 +27,7 @@
core/internal/traits.hh \
core/interval.hh \
core/macros.hh \
+ core/pred_succ.hh \
core/predecls.hh \
core/type.hh \
core/type_traits.hh \
Index: olena/oln/convert/value_to_point.hh
--- olena/oln/convert/value_to_point.hh Thu, 18 Mar 2004 18:24:14 +0100
van-vl_n (oln/j/43_value_to_p 1.4 644)
+++ olena/oln/convert/value_to_point.hh Fri, 19 Mar 2004 11:38:53 +0100
van-vl_n (oln/j/43_value_to_p 1.4 644)
@@ -37,7 +37,8 @@
namespace convert {
/*! Convert a value of pixel to a point.
**
- ** For example it transforms an RGB color to a 3D point (ntg::rgb_8
=> oln::point3d).
+ ** For example, transform an RGB color to a 3D point
+ ** (ntg::rgb_8 => oln::point3d).
** This function is useful to build the histogram. \n
** Example:
** \verbatim
@@ -57,14 +58,15 @@
Exact>::ret>
{
private:
- /// By default a scalar is expected. If the type is a vector, a
specialization should be written.
+ /// By default a scalar is expected. If the type is a vector, a
+ /// specialization should be written.
typedef typename ntg_is_a(Argument_type,
ntg::non_vectorial)::ensure_type ensure_type;
public:
- /// By default it return a point1d.
+ /// By default return a point1d.
typedef point1d result_type;
typedef Argument_type argument_type;
- /// This class has bee made because of the lake of operator-- in
ntg::bin
+ /// Convert a binary to a point.
template <typename O, typename I>
struct doit_binary
{
@@ -75,7 +77,7 @@
return input ? O(1) : O(0);
}
};
- /// This class has bee made because of the lake of operator-- in
ntg::bin
+ /// Convert a non vectorial to a point.
template <typename O, typename I>
struct doit_not_binary
{
@@ -99,7 +101,7 @@
/*! Specialization for color of three dimension.
**
- ** \todo It could be generalized to n dimensions if there were a
trait that
+ ** \todo Could be generalized to n dimensions if there were a trait
that
** give a pointkd for a given dimension k.
*/
template <unsigned Qbits, template <unsigned> class S, class Exact>
Index: integre/ntg/core/pred_succ.hh
--- integre/ntg/core/pred_succ.hh Fri, 19 Mar 2004 11:51:05 +0100
van-vl_n ()
+++ integre/ntg/core/pred_succ.hh Fri, 19 Mar 2004 11:15:51 +0100
van-vl_n (oln/k/8_pred_succ. 644)
@@ -0,0 +1,75 @@
+// Copyright (C) 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
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
+// MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef NTG_CORE_PRED_SUCC_HH
+# define NTG_CORE_PRED_SUCC_HH
+
+#include <ntg/all.hh>
+#include <mlc/is_a.hh>
+
+namespace ntg {
+
+ namespace internal {
+ //! Return a type which supports inc and dec.
+ template <typename T>
+ struct with_arith
+ {
+ typedef typename ntg_is_a(T, non_vectorial)::ensure_type non_v;
+
+ typedef int_u<1> bool_with_arith;
+ typedef T non_vectorial_with_arith;
+
+ typedef typename mlc::if_<ntg_is_a(T, ntg::binary)::ret,
+ id_<bool_with_arith>,
+ id_<non_vectorial_with_arith> >::ret::ret ret;
+ };
+ }
+
+ /*! Return the successor of \a t.
+ **
+ ** \note The goal is to iterate on types such as ntg::bin.
+ */
+ template <typename T>
+ T
+ succ(const T &t)
+ {
+ return T(internal::with_arith<T>::ret(t) + 1);
+ }
+
+ /*! Return the predecessor of \a t.
+ **
+ ** \note The goal is to iterate on types such as ntg::bin.
+ */
+ template <typename T>
+ T
+ pred(const T&t)
+ {
+ return T(internal::with_arith<T>::ret(t) - 1);
+ }
+}
+
+#endif
Index: olena/ChangeLog
from Simon Odou <simon(a)lrde.epita.fr>
* olena/oln/io/base.hh: Add comments.
* olena/oln/io/readable.hh: Likewise.
* olena/oln/io/se_neighborhood.hh: Likewise.
* olena/oln/io/se_window.hh: Likewise.
* olena/oln/io/image_base.hh: Likewise.
* olena/oln/io/image_write.hh: Likewise.
* olena/oln/io/stream_wrapper.hh: Likewise.
* olena/oln/io/utils.hh: Likewise.
* olena/oln/io/image_read.hh: Likewise.
* olena/oln/core/abstract/image.hh: Likewise.
* olena/oln/core/bkd_iter1d.hh: Correct comments.
* olena/oln/core/bkd_iter2d.hh: Likewise.
* olena/oln/core/bkd_iter3d.hh: Likewise.
* olena/oln/core/fwd_iter1d.hh: Likewise.
* olena/oln/core/fwd_iter2d.hh: Likewise.
* olena/oln/core/fwd_iter3d.hh: Likewise.
* olena/oln/core/abstract/iter1d.hh: Likewise.
* olena/oln/core/abstract/iter2d.hh: Likewise.
* olena/oln/core/abstract/iter3d.hh: Likewise.
* olena/oln/core/abstract/iter.hh: Likewise.
* olena/oln/core/neighborhood1d.hh: Likewise.
* olena/oln/core/neighborhood2d.hh: Likewise.
* olena/oln/core/neighborhood3d.hh: Likewise.
* olena/oln/core/abstract/neighborhood.hh: Likewise.
* olena/oln/core/abstract/struct_elt.hh: Likewise.
* olena/oln/core/window1d.hh: Likewise.
* olena/oln/core/window2d.hh: Likewise.
* olena/oln/core/window3d.hh: Likewise.
* olena/oln/core/abstract/window.hh: Likewise.
* olena/oln/core/w_window1d.hh: Likewise.
* olena/oln/core/w_window2d.hh: Likewise.
* olena/oln/core/w_window3d.hh: Likewise.
* olena/oln/core/abstract/w_window.hh: Likewise.
* olena/oln/core/abstract/window_base.hh: Likewise.
* olena/oln/core/abstract/windownd.hh: Likewise.
* olena/oln/core/abstract/w_windownd.hh: Likewise.
* olena/oln/core/abstract/neighborhoodnd.hh: Likewise.
Index: olena/oln/core/bkd_iter1d.hh
--- olena/oln/core/bkd_iter1d.hh Fri, 12 Mar 2004 17:51:04 +0100 odou_s (oln/d/38_bkd_iter1d 1.17 640)
+++ olena/oln/core/bkd_iter1d.hh Mon, 15 Mar 2004 18:25:32 +0100 odou_s (oln/d/38_bkd_iter1d 1.17 640)
@@ -100,7 +100,7 @@
}
/*!
- ** \brief Return his type in a string.
+ ** \brief Return its type in a string.
** \return The type in a string.
**
** Very useful to debug.
Index: olena/oln/core/bkd_iter2d.hh
--- olena/oln/core/bkd_iter2d.hh Fri, 12 Mar 2004 17:51:04 +0100 odou_s (oln/d/37_bkd_iter2d 1.17 640)
+++ olena/oln/core/bkd_iter2d.hh Mon, 15 Mar 2004 18:25:31 +0100 odou_s (oln/d/37_bkd_iter2d 1.17 640)
@@ -99,7 +99,7 @@
}
/*!
- ** \brief Return his type in a string.
+ ** \brief Return its type in a string.
** \return The type in a string.
**
** Very useful to debug.
Index: olena/oln/core/bkd_iter3d.hh
--- olena/oln/core/bkd_iter3d.hh Fri, 12 Mar 2004 17:51:04 +0100 odou_s (oln/d/36_bkd_iter3d 1.17 640)
+++ olena/oln/core/bkd_iter3d.hh Mon, 15 Mar 2004 18:25:31 +0100 odou_s (oln/d/36_bkd_iter3d 1.17 640)
@@ -96,7 +96,7 @@
}
/*!
- ** \brief Return his type in a string.
+ ** \brief Return its type in a string.
** \return The type in a string.
**
** Very useful to debug.
Index: olena/oln/core/fwd_iter1d.hh
--- olena/oln/core/fwd_iter1d.hh Fri, 12 Mar 2004 17:51:04 +0100 odou_s (oln/d/21_fwd_iter1d 1.14 640)
+++ olena/oln/core/fwd_iter1d.hh Mon, 15 Mar 2004 18:25:30 +0100 odou_s (oln/d/21_fwd_iter1d 1.14 640)
@@ -98,7 +98,7 @@
}
/*!
- ** \brief Return his type in a string.
+ ** \brief Return its type in a string.
** \return The type in a string.
**
** Very useful to debug.
Index: olena/oln/core/fwd_iter2d.hh
--- olena/oln/core/fwd_iter2d.hh Fri, 12 Mar 2004 17:51:04 +0100 odou_s (oln/d/20_fwd_iter2d 1.14 640)
+++ olena/oln/core/fwd_iter2d.hh Mon, 15 Mar 2004 18:25:30 +0100 odou_s (oln/d/20_fwd_iter2d 1.14 640)
@@ -100,7 +100,7 @@
}
/*!
- ** \brief Return his type in a string.
+ ** \brief Return its type in a string.
** \return The type in a string.
**
** Very useful to debug.
Index: olena/oln/core/fwd_iter3d.hh
--- olena/oln/core/fwd_iter3d.hh Fri, 12 Mar 2004 17:51:04 +0100 odou_s (oln/d/19_fwd_iter3d 1.14 640)
+++ olena/oln/core/fwd_iter3d.hh Mon, 15 Mar 2004 18:25:29 +0100 odou_s (oln/d/19_fwd_iter3d 1.14 640)
@@ -97,7 +97,7 @@
}
/*!
- ** \brief Return his type in a string.
+ ** \brief Return its type in a string.
** \return The type in a string.
**
** Very useful to debug.
Index: olena/oln/core/abstract/iter1d.hh
--- olena/oln/core/abstract/iter1d.hh Sun, 14 Mar 2004 18:15:46 +0100 van-vl_n (oln/d/10_iter1d.hh 1.18 640)
+++ olena/oln/core/abstract/iter1d.hh Mon, 15 Mar 2004 18:38:07 +0100 odou_s (oln/d/10_iter1d.hh 1.18 640)
@@ -89,7 +89,7 @@
}
/*!
- ** \brief Return his type in a string.
+ ** \brief Return its type in a string.
** \return The type in a string.
**
** Very useful to debug.
@@ -101,7 +101,7 @@
protected:
- const coord ncols_; ///< The number of column of the image you are iterating
+ const coord ncols_; ///< The number of columns of the image you are iterating
/*!
** \brief Get the current point viewed by the iterator.
Index: olena/oln/core/abstract/iter2d.hh
--- olena/oln/core/abstract/iter2d.hh Sun, 14 Mar 2004 18:15:46 +0100 van-vl_n (oln/d/9_iter2d.hh 1.18 640)
+++ olena/oln/core/abstract/iter2d.hh Mon, 15 Mar 2004 18:38:07 +0100 odou_s (oln/d/9_iter2d.hh 1.18 640)
@@ -102,7 +102,7 @@
}
/*!
- ** \brief Return his type in a string.
+ ** \brief Return its type in a string.
** \return The type in a string.
**
** Very useful to debug.
@@ -115,7 +115,7 @@
protected:
const coord nrows_; ///< The number of rows of the image you are iterating.
- const coord ncols_; ///< The number of column of the image you are iterating.
+ const coord ncols_; ///< The number of columns of the image you are iterating.
/*!
** \brief Get the current point viewed by the iterator.
Index: olena/oln/core/abstract/iter3d.hh
--- olena/oln/core/abstract/iter3d.hh Sun, 14 Mar 2004 18:15:46 +0100 van-vl_n (oln/d/8_iter3d.hh 1.18 640)
+++ olena/oln/core/abstract/iter3d.hh Mon, 15 Mar 2004 18:38:06 +0100 odou_s (oln/d/8_iter3d.hh 1.18 640)
@@ -115,7 +115,7 @@
}
/*!
- ** \brief Return his type in a string.
+ ** \brief Return its type in a string.
** \return The type in a string.
**
** Very useful to debug.
@@ -127,9 +127,9 @@
protected:
- const coord nslices_; ///< The number of slice of the image you are iterating.
+ const coord nslices_; ///< The number of slices of the image you are iterating.
const coord nrows_; ///< The number of rows of the image you are iterating.
- const coord ncols_; ///< The number of column of the image you are iterating.
+ const coord ncols_; ///< The number of columns of the image you are iterating.
/*!
** \brief Get the current point viewed by the iterator.
Index: olena/oln/core/abstract/iter.hh
--- olena/oln/core/abstract/iter.hh Mon, 15 Mar 2004 17:40:54 +0100 van-vl_n (oln/c/40_iter.hh 1.20 640)
+++ olena/oln/core/abstract/iter.hh Mon, 15 Mar 2004 18:25:38 +0100 odou_s (oln/c/40_iter.hh 1.20 640)
@@ -359,7 +359,7 @@
}
/*!
- ** \brief Return his type in a string.
+ ** \brief Return its type in a string.
** \return The type in a string.
**
** Very useful to debug.
Index: olena/oln/core/neighborhood1d.hh
--- olena/oln/core/neighborhood1d.hh Fri, 12 Mar 2004 17:51:04 +0100 odou_s (oln/c/37_neighborho 1.16 640)
+++ olena/oln/core/neighborhood1d.hh Mon, 15 Mar 2004 18:32:04 +0100 odou_s (oln/c/37_neighborho 1.16 640)
@@ -57,7 +57,7 @@
** \brief Neighborhood 1 dimension.
**
** It looks like structuring elements but here, when
- ** you add an element, you add his opposite.
+ ** you add an element, you add its opposite.
** Points have 1 dimensions.
**
*/
@@ -140,7 +140,7 @@
}
/*!
- ** \brief Return his type in a string.
+ ** \brief Return its type in a string.
** \return The type in a string.
**
** Very useful to debug.
Index: olena/oln/core/neighborhood2d.hh
--- olena/oln/core/neighborhood2d.hh Fri, 12 Mar 2004 17:51:04 +0100 odou_s (oln/c/36_neighborho 1.17 640)
+++ olena/oln/core/neighborhood2d.hh Mon, 15 Mar 2004 18:32:04 +0100 odou_s (oln/c/36_neighborho 1.17 640)
@@ -58,7 +58,7 @@
** \brief Neighborhood 2 dimensions.
**
** It looks like structuring elements but here, when
- ** you add an element, you add his opposite.
+ ** you add an element, you add its opposite.
** Points have 2 dimensions.
**
*/
@@ -160,7 +160,7 @@
}
/*!
- ** \brief Return his type in a string.
+ ** \brief Return its type in a string.
** \return The type in a string.
**
** Very useful to debug.
Index: olena/oln/core/neighborhood3d.hh
--- olena/oln/core/neighborhood3d.hh Fri, 12 Mar 2004 17:51:04 +0100 odou_s (oln/c/35_neighborho 1.16 640)
+++ olena/oln/core/neighborhood3d.hh Mon, 15 Mar 2004 18:32:02 +0100 odou_s (oln/c/35_neighborho 1.16 640)
@@ -57,7 +57,7 @@
** \brief Neighborhood 3 dimensions.
**
** It looks like structuring elements but here, when
- ** you add an element, you add his opposite.
+ ** you add an element, you add its opposite.
** Points have 3 dimensions.
**
*/
@@ -141,7 +141,7 @@
}
/*!
- ** \brief Return his type in a string.
+ ** \brief Return its type in a string.
** \return The type in a string.
**
** Very useful to debug.
Index: olena/oln/core/abstract/neighborhood.hh
--- olena/oln/core/abstract/neighborhood.hh Fri, 12 Mar 2004 17:51:04 +0100 odou_s (oln/c/38_neighborho 1.20 640)
+++ olena/oln/core/abstract/neighborhood.hh Mon, 15 Mar 2004 18:37:35 +0100 odou_s (oln/c/38_neighborho 1.20 640)
@@ -56,17 +56,17 @@
** \brief Neighborhood.
**
** It looks like structuring elements but here, when
- ** you add an element, you add his opposite (cf mathematical
+ ** you add an element, you add its opposite (cf mathematical
** definition to know more about).
** This abstract class defines several virtual methods for his
- ** subclasses. His aim is to deal with a set of deplacement points.
+ ** subclasses. Its goal is to deal with a set of deplacement points.
**
*/
template<class Exact>
struct neighborhood : public mlc_hierarchy::any<Exact>
{
typedef Exact exact_type; ///< Set the exact type.
- typedef neighborhood<Exact> self_type; ///< Set his type.
+ typedef neighborhood<Exact> self_type; ///< Set its type.
/*!
** \brief The associate image's type of iterator.
@@ -94,7 +94,7 @@
///< Set the dim of the points of the neighborhood.
/*!
- ** \brief Return his type in a string.
+ ** \brief Return its type in a string.
** \return The type in a string.
**
** Very useful to debug.
@@ -117,8 +117,8 @@
}
/*!
- ** \brief Get the number of point we get.
- ** \return The number of point.
+ ** \brief Get the number of points.
+ ** \return The number of points.
*/
unsigned
card() const
@@ -210,7 +210,7 @@
/*!
** \brief Set neighborhood to opposite.
**
- ** Each point of neighborhood is assigned to his opposite.
+ ** Each point of neighborhood is assigned to its opposite.
**
*/
void
Index: olena/oln/core/abstract/struct_elt.hh
--- olena/oln/core/abstract/struct_elt.hh Fri, 12 Mar 2004 17:51:04 +0100 odou_s (oln/c/25_structelt. 1.21 640)
+++ olena/oln/core/abstract/struct_elt.hh Mon, 15 Mar 2004 18:39:45 +0100 odou_s (oln/c/25_structelt. 1.21 640)
@@ -58,8 +58,8 @@
/*!
** Structuring elements (set of points).
**
- ** This abstract class defines several virtual methods for his
- ** subclasses. His aim is to deal with a set of deplacement points.
+ ** This abstract class defines several virtual methods for its
+ ** subclasses. Its goal is to deal with a set of 'move' points.
*/
template<class Exact>
struct struct_elt : public mlc_hierarchy::any< Exact >
@@ -73,7 +73,7 @@
///< Set the abstract type of hisself.
/*!
- ** \brief Return his type in a string.
+ ** \brief Return its type in a string.
** \return The type in a string.
**
** Very useful to debug.
@@ -102,8 +102,8 @@
}
/*!
- ** \brief Get the number of point we get.
- ** \return The number of point.
+ ** \brief Get the number of points.
+ ** \return The number of points.
*/
unsigned
card() const
@@ -185,7 +185,7 @@
/*!
** \brief Set structuring elements to opposite.
**
- ** Each point of structuring elements is assigned to his opposite.
+ ** Each point of structuring elements is assigned to its opposite.
*/
exact_type
operator-() const
@@ -200,7 +200,7 @@
/*!
** \brief Set structuring elements to opposite.
**
- ** Each point of structuring elements is assigned to his opposite.
+ ** Each point of structuring elements is assigned to its opposite.
*/
void
sym()
Index: olena/oln/core/window1d.hh
--- olena/oln/core/window1d.hh Fri, 12 Mar 2004 17:51:04 +0100 odou_s (oln/c/15_window1d.h 1.16 640)
+++ olena/oln/core/window1d.hh Mon, 15 Mar 2004 18:25:28 +0100 odou_s (oln/c/15_window1d.h 1.16 640)
@@ -140,7 +140,7 @@
}
/*!
- ** \brief Return his type in a string.
+ ** \brief Return its type in a string.
** \return The type in a string.
**
** Very useful to debug.
Index: olena/oln/core/window2d.hh
--- olena/oln/core/window2d.hh Fri, 12 Mar 2004 17:51:04 +0100 odou_s (oln/c/14_window2d.h 1.18 640)
+++ olena/oln/core/window2d.hh Mon, 15 Mar 2004 18:25:27 +0100 odou_s (oln/c/14_window2d.h 1.18 640)
@@ -161,7 +161,7 @@
}
/*!
- ** \brief Return his type in a string.
+ ** \brief Return its type in a string.
** \return The type in a string.
**
** Very useful to debug.
Index: olena/oln/core/window3d.hh
--- olena/oln/core/window3d.hh Fri, 12 Mar 2004 17:51:04 +0100 odou_s (oln/c/13_window3d.h 1.17 640)
+++ olena/oln/core/window3d.hh Mon, 15 Mar 2004 18:25:27 +0100 odou_s (oln/c/13_window3d.h 1.17 640)
@@ -140,7 +140,7 @@
}
/*!
- ** \brief Return his type in a string.
+ ** \brief Return its type in a string.
** \return The type in a string.
**
** Very useful to debug.
Index: olena/oln/core/abstract/window.hh
--- olena/oln/core/abstract/window.hh Fri, 12 Mar 2004 17:51:04 +0100 odou_s (oln/c/16_window.hh 1.18 640)
+++ olena/oln/core/abstract/window.hh Mon, 15 Mar 2004 18:25:36 +0100 odou_s (oln/c/16_window.hh 1.18 640)
@@ -74,7 +74,7 @@
friend class struct_elt<exact_type>;
/*!
- ** \brief Return his type in a string.
+ ** \brief Return its type in a string.
** \return The type in a string.
**
** Very useful to debug.
Index: olena/oln/core/w_window1d.hh
--- olena/oln/core/w_window1d.hh Fri, 12 Mar 2004 17:51:04 +0100 odou_s (oln/c/19_w_window1d 1.17 640)
+++ olena/oln/core/w_window1d.hh Mon, 15 Mar 2004 18:25:27 +0100 odou_s (oln/c/19_w_window1d 1.17 640)
@@ -164,7 +164,7 @@
}
/*!
- ** \brief Return his type in a string.
+ ** \brief Return its type in a string.
** \return The type in a string.
**
** Very useful to debug.
Index: olena/oln/core/w_window2d.hh
--- olena/oln/core/w_window2d.hh Fri, 12 Mar 2004 17:51:04 +0100 odou_s (oln/c/18_w_window2d 1.6.1.12 640)
+++ olena/oln/core/w_window2d.hh Mon, 15 Mar 2004 18:25:26 +0100 odou_s (oln/c/18_w_window2d 1.6.1.12 640)
@@ -183,7 +183,7 @@
}
/*!
- ** \brief Return his type in a string.
+ ** \brief Return its type in a string.
** \return The type in a string.
**
** Very useful to debug.
Index: olena/oln/core/w_window3d.hh
--- olena/oln/core/w_window3d.hh Fri, 12 Mar 2004 17:51:04 +0100 odou_s (oln/c/17_w_window3d 1.17 640)
+++ olena/oln/core/w_window3d.hh Mon, 15 Mar 2004 18:25:26 +0100 odou_s (oln/c/17_w_window3d 1.17 640)
@@ -170,7 +170,7 @@
}
/*!
- ** \brief Return his type in a string.
+ ** \brief Return its type in a string.
** \return The type in a string.
**
** Very useful to debug.
Index: olena/oln/core/abstract/w_window.hh
--- olena/oln/core/abstract/w_window.hh Fri, 12 Mar 2004 17:51:04 +0100 odou_s (oln/c/20_w_window.h 1.15 640)
+++ olena/oln/core/abstract/w_window.hh Mon, 15 Mar 2004 18:25:36 +0100 odou_s (oln/c/20_w_window.h 1.15 640)
@@ -76,7 +76,7 @@
friend class struct_elt<exact_type>;
/*!
- ** \brief Return his type in a string.
+ ** \brief Return its type in a string.
** \return The type in a string.
**
** Very useful to debug.
Index: olena/oln/io/base.hh
--- olena/oln/io/base.hh Thu, 07 Aug 2003 02:37:23 +0200 burrus_n (oln/b/20_base.hh 1.8 640)
+++ olena/oln/io/base.hh Mon, 15 Mar 2004 16:27:40 +0100 odou_s (oln/b/20_base.hh 1.8 640)
@@ -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,10 +36,21 @@
namespace oln {
+ /*! \namespace io
+ ** \brief io namespace.
+ */
namespace io {
+ /*! \namespace internal
+ ** \brief abstract internal.
+ */
namespace internal {
+ /*!
+ ** \brief Read anything from a file.
+ **
+ ** The "good" read function is called by template specialization.
+ */
template<typename T>
bool
read_any(T& output, const std::string& name)
@@ -47,6 +58,11 @@
return read(output, name);
}
+ /*!
+ ** \brief Write anything to a file.
+ **
+ ** The "good" write function is called by template specialization.
+ */
template<typename T>
bool
write_any(const T& input, const std::string& name)
@@ -58,6 +74,16 @@
// aliases
+ /*
+ ** \brief Load object from a file. This could be an image but also
+ ** a window or a neighborhood.
+ ** \arg name The name of the file.
+ ** \return The new object.
+ **
+ ** Here is the external interface.
+ ** If you would like some examples to know how to use that, go to
+ ** oln::abstract::iter
+ */
inline
internal::anything
load(const std::string& name)
@@ -65,6 +91,15 @@
return internal::anything(name);
}
+ /*
+ ** \brief Load object from a file. This could be an image but also
+ ** a window or a neighborhood.
+ ** \arg output The object to write to a file.
+ ** \arg name The name of the file.
+ ** \return True if successful.
+ **
+ ** Here is the external interface. Depending of T, work is dispatched.
+ */
template<class T>
bool
load(T& output, std::string name)
@@ -72,6 +107,17 @@
return internal::read_any(output, name);
}
+ /*
+ ** \brief Writing object to a file. This could be an image but also
+ ** a window or a neighborhood.
+ ** \arg input The object to read.
+ ** \arg name The name of the file.
+ ** \return True if successful.
+ **
+ ** Here is the external interface. Depending of T, work is dispatched.
+ ** If you would like some examples to know how to use that, go to
+ ** oln::abstract::iter
+ */
template< typename T >
bool
save(const T& input, const std::string& name)
Index: olena/oln/io/readable.hh
--- olena/oln/io/readable.hh Thu, 09 Oct 2003 16:21:55 +0200 burrus_n (oln/b/13_readable.h 1.12 640)
+++ olena/oln/io/readable.hh Mon, 15 Mar 2004 16:24:00 +0100 odou_s (oln/b/13_readable.h 1.12 640)
@@ -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,30 +41,56 @@
template<typename T>
bool
- read_any(T& output, const std::string& name);
+ read_any(T& output, const std::string& name); //forward declaration
+ /*!
+ ** \brief Anything.
+ **
+ ** This class is called by oln::load and just keep the filename to load.
+ ** As soon as you will use the operator = on it, assign will be called
+ ** and it will read the file.
+ ** If you would like some examples to know how to use that, go to
+ ** oln::abstract::iter
+ */
class anything
{
public:
- // FIXME: these constructors are required by swig
+ /*!
+ ** \brief Constructor
+ ** \todo FIXME: these constructors are required by swig
+ */
anything() : str_() {}
+
+ /*!
+ ** \brief Constructor
+ */
anything(const anything& rhs) : str_(rhs.str_) {}
+ /*!
+ ** \brief Constructor
+ */
anything(const std::string& str) : str_(str) {}
+ /*!
+ ** \brief Constructor
+ */
anything(const char* c) : str_(c) {}
+ /*!
+ ** \brief This function will be called when applied to an operator =
+ ** and load the file (str_ is the filename).
+ */
template< typename T >
T&
assign(T& output) const
{
read_any(output, str_);
- // FIXME: call output.clear()?
+ ///< \todo FIXME: call output.clear()?
return output;
}
private:
- std::string str_;
+ std::string str_; ///< The filename to load.
};
} // end of namespace internal
Index: olena/oln/io/se_neighborhood.hh
--- olena/oln/io/se_neighborhood.hh Thu, 07 Aug 2003 02:37:23 +0200 burrus_n (oln/i/47_se_neighbo 1.13 640)
+++ olena/oln/io/se_neighborhood.hh Mon, 15 Mar 2004 15:40:37 +0100 odou_s (oln/i/47_se_neighbo 1.13 640)
@@ -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
@@ -39,6 +39,12 @@
namespace internal {
+ /*!
+ ** \brief Read a neighborhood from a file.
+ ** \arg output The new neighborhood.
+ ** \arg name The name of the file.
+ ** \return True if successful.
+ */
inline bool
read(neighborhood2d& output, const std::string& name)
{
@@ -81,6 +87,12 @@
return true;
}
+ /*!
+ ** \brief Write a neighborhood to a file.
+ ** \arg input The neighborhood to write.
+ ** \arg name The name of the file.
+ ** \return True if successful.
+ */
inline bool
write(const neighborhood2d& input, const std::string& name)
{
Index: olena/oln/io/se_window.hh
--- olena/oln/io/se_window.hh Thu, 07 Aug 2003 02:37:23 +0200 burrus_n (oln/i/46_se_window. 1.14 640)
+++ olena/oln/io/se_window.hh Mon, 15 Mar 2004 15:45:24 +0100 odou_s (oln/i/46_se_window. 1.14 640)
@@ -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
@@ -46,13 +46,14 @@
namespace internal {
- // FIXME: this code should be factorized.
+ ///< \todo FIXME: this code should be factorized.
- /*----------------.
- | read (window1d) |
- `----------------*/
-
- // FIXME: put it in a .cc file ?
+ /*!
+ ** \brief Read a window (1 dimension) from a file.
+ ** \arg output The new window.
+ ** \arg name The name of the file.
+ ** \return True if successful.
+ */
inline bool
read(window1d& output, const std::string& name)
{
@@ -70,11 +71,12 @@
return true;
}
- /*----------------.
- | read (window2d) |
- `----------------*/
-
- // FIXME: put it in a .cc file ?
+ /*!
+ ** \brief Read a window (2 dimensions) from a file.
+ ** \arg output The new window.
+ ** \arg name The name of the file.
+ ** \return True if successful.
+ */
inline bool
read(window2d& output, const std::string& name)
{
@@ -97,11 +99,12 @@
return true;
}
- /*----------------.
- | read (window3d) |
- `----------------*/
-
- // FIXME: put it in a .cc file ?
+ /*!
+ ** \brief Read a window (3 dimensions) from a file.
+ ** \arg output The new window.
+ ** \arg name The name of the file.
+ ** \return True if successful.
+ */
inline bool
read(window3d& output, const std::string& name)
{
@@ -121,11 +124,12 @@
return true;
}
- /*-----------------.
- | write (window1d) |
- `-----------------*/
-
- // FIXME: put it in a .cc file ?
+ /*!
+ ** \brief Write a window (1 dimension) to a file.
+ ** \arg input The window to write.
+ ** \arg name The name of the file.
+ ** \return True if successful.
+ */
inline bool
write(const window1d& input, const std::string& name)
{
@@ -139,11 +143,12 @@
return true;
}
- /*-----------------.
- | write (window2d) |
- `-----------------*/
-
- // FIXME: put it in a .cc file ?
+ /*!
+ ** \brief Write a window (2 dimensions) to a file.
+ ** \arg input The window to write.
+ ** \arg name The name of the file.
+ ** \return True if successful.
+ */
inline bool
write(const window2d& input, const std::string& name)
{
@@ -157,11 +162,12 @@
return true;
}
- /*-----------------.
- | write (window3d) |
- `-----------------*/
-
- // FIXME: put it in a .cc file ?
+ /*!
+ ** \brief Write a window (3 dimensions) to a file.
+ ** \arg input The window to write.
+ ** \arg name The name of the file.
+ ** \return True if successful.
+ */
inline bool
write(const window3d& input, const std::string& name)
{
Index: olena/oln/core/abstract/image.hh
--- olena/oln/core/abstract/image.hh Mon, 15 Mar 2004 17:40:54 +0100 van-vl_n (oln/t/25_image.hh 1.26 600)
+++ olena/oln/core/abstract/image.hh Mon, 15 Mar 2004 19:34:49 +0100 odou_s (oln/t/25_image.hh 1.26 600)
@@ -34,9 +34,14 @@
# include <oln/core/abstract/point.hh>
# include <oln/core/abstract/iter.hh>
-
+/*! \namespace oln
+** \brief oln namespace.
+*/
namespace oln {
+ /*! \namespace oln::abstract
+ ** \brief oln::abstract namespace.
+ */
namespace abstract {
// fwd_decl
Index: olena/oln/io/image_base.hh
--- olena/oln/io/image_base.hh Thu, 07 Aug 2003 02:37:23 +0200 burrus_n (oln/t/41_image_base 1.4 600)
+++ olena/oln/io/image_base.hh Mon, 15 Mar 2004 17:55:14 +0100 odou_s (oln/t/41_image_base 1.4 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
@@ -39,21 +39,30 @@
namespace internal {
- /*---------------------.
- | image default reader |
- `---------------------*/
-
+ /*!
+ ** \brief Reader identifiers.
+ **
+ ** They are used recursively: each time a ReadId fails, then
+ ** try with ReadId - 1.
+ */
enum reader_id { ReadNone = 0,
ReadPnmPlain = 1,
ReadPnmRaw = 2,
ReadAny = 2 };
- // Default reader
-
+ /*!
+ ** \brief Read an image of type reader_id.
+ ** \param F The reader identifier.
+ **
+ ** In fact, do nothing because of the type of reader.
+ ** Used when an errors occurs on others types of reader.
+ ** \see reader_id
+ */
template<reader_id F, class I>
struct image_reader
{
+ ///< Do nothing because of the type of reader.
static const std::string&
name()
{
@@ -61,12 +70,14 @@
return name_;
}
+ ///< Do nothing because of the type of reader.
static bool
knows_ext(const std::string&)
{
return false;
}
+ ///< Do nothing because of the type of reader.
static bool
read(std::istream&, I&)
{
@@ -74,21 +85,32 @@
}
};
- /*---------------------.
- | image default writer |
- `---------------------*/
+ /*!
+ ** \brief Writer identifiers.
+ **
+ ** They are used recursively: each time a WriteId fails, then
+ ** try with WriteId - 1.
+ */
enum writer_id { WriteNone = 0,
WritePnmPlain = 1,
WritePnmRaw = 2,
WriteAny = 2 };
- // Default writer
+ /*!
+ ** \brief Write an image of type writer_id.
+ ** \param F The writer identifier.
+ **
+ ** In fact, do nothing because of the type of writer.
+ ** Used when an errors occurs on others types of writer.
+ ** \see writer_id
+ */
template<writer_id F, class I>
struct image_writer
{
+ ///< Do nothing because of the type of writer.
static const std::string&
name()
{
@@ -96,12 +118,14 @@
return name_;
}
+ ///< Do nothing because of the type of writer.
static bool
knows_ext(const std::string&)
{
return false;
}
+ ///< Do nothing because of the type of writer.
static bool
write(std::ostream&, const I&)
{
Index: olena/oln/io/image_write.hh
--- olena/oln/io/image_write.hh Thu, 07 Aug 2003 02:37:23 +0200 burrus_n (oln/t/42_image_writ 1.9 600)
+++ olena/oln/io/image_write.hh Mon, 15 Mar 2004 18:10:40 +0100 odou_s (oln/t/42_image_writ 1.9 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
@@ -50,16 +50,20 @@
namespace internal {
- /*------------.
- | try_writers |
- `------------*/
-
- // Try writers recursively
-
+ /*!
+ ** \brief Image's writer.
+ ** \param W Type of writer.
+ */
template< writer_id W, typename T >
struct try_writers
{
- // Try to deduce the file format from the extension
+ /*!
+ ** \brief Write object on the stream.
+ ** Try do deduce the image format from the extension.
+ ** \arg input The object to read.
+ ** \arg out The stream.
+ ** \arg ext The extension's filename.
+ */
static bool
by_extension(const T& input, std::ostream& out, const std::string& ext)
{
@@ -70,7 +74,11 @@
::by_extension(input, out, ext);
}
- // Try to match the file format referring to the data only
+ /*!
+ ** \brief Try to match the file format referring to the data only.
+ ** \arg input The object to read.
+ ** \arg out The stream.
+ */
static bool
by_data(const T& input, std::ostream& out, const std::string& ext)
{
@@ -86,17 +94,30 @@
}
};
- // End of try_writers loop
+ /*!
+ ** \brief Reader for image of type None.
+ **
+ ** In fact, do nothing because of the type of writer.
+ ** Used when an errors occurs on others types of writer.
+ */
template< typename T >
struct try_writers<WriteNone, T>
{
+ /*!
+ ** \brief Write object on the stream.
+ ** Try do deduce the image format from the extension.
+ */
static bool
by_extension(const T&, std::ostream&, const std::string&)
{
return false;
}
+ /*!
+ ** \brief Write object on the stream.
+ ** Try to match the file format referring to the data only.
+ */
static bool
by_data(const T&, std::ostream&, const std::string&)
{
@@ -104,14 +125,19 @@
}
};
- /*----------------------.
- | write(image, filename) |
- `----------------------*/
-
- // Writers trier functor, helper for stream_wrappers
-
+ /*!
+ ** \brief Writers trier functor, helper for stream_wrappers.
+ */
struct writers_trier
{
+ /*!
+ ** \brief Writers trier functor, helper for stream_wrappers.
+ ** \arg output The new object.
+ ** \arg in The stream to read from.
+ ** \arg ext The extension.
+ **
+ ** First try to write by extension, then by data.
+ */
template <class T>
static bool
doit(const T& input, std::ostream& out, const std::string ext)
@@ -123,8 +149,13 @@
}
};
- // Write images
+ /*!
+ ** \brief Write an image (2 dimensions) to a file.
+ ** \arg input The image to write to file.
+ ** \arg name The filename.
+ ** \return True if successful.
+ */
template <class E, unsigned N>
inline bool
write(const abstract::image_with_dim<N, E>& input,
@@ -143,9 +174,17 @@
return false;
}
- // Mono-dimensional images is a special case of bi-dimensional
- // images.
-
+ /*!
+ ** \brief Write an image (1 dimension) to a file.
+ ** \arg input The image to write to file.
+ ** \arg name The filename.
+ ** \return True if successful.
+ **
+ ** In fact, real work is not done here : this function calls 'write' for
+ ** images of 2 dimensions:
+ ** Mono-dimensional images is a special case of bi-dimensional
+ ** images.
+ */
template <class E>
inline bool
write(const abstract::image_with_dim<1, E>& input,
Index: olena/oln/io/stream_wrapper.hh
--- olena/oln/io/stream_wrapper.hh Thu, 07 Aug 2003 02:37:23 +0200 burrus_n (oln/t/43_stream_wra 1.3.1.1 600)
+++ olena/oln/io/stream_wrapper.hh Mon, 15 Mar 2004 18:12:30 +0100 odou_s (oln/t/43_stream_wra 1.3.1.1 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,8 +41,12 @@
namespace internal {
- // stream wrappers
-
+ /*!
+ ** \brief Stream identifiers.
+ **
+ ** They are used recursively: each time a StreamId fails, then
+ ** try with StreamId - 1.
+ */
enum stream_id { StreamNone = 0,
StreamFile = 1,
StreamGz = 2,
@@ -81,15 +85,16 @@
{}
};
- /*---------------------------.
- | stream_wrappers_find_files |
- `---------------------------*/
-
- // Find files compatible with the given root, extension free filename
-
+ /*!
+ ** \brief Find files compatible with the given root, extension free
+ ** filename
+ */
template <stream_id W>
struct stream_wrappers_find_files
{
+ /*!
+ ** \brief Just a functor.
+ */
static void
doit(std::list<std::string>& names, const std::string& name)
{
@@ -99,8 +104,9 @@
}
};
- // End of the loop
-
+ /*!
+ ** \brief Do nothing because of the type of stream.
+ */
template <>
struct stream_wrappers_find_files<StreamNone>
{
@@ -109,16 +115,20 @@
{}
};
- /*-----------------------.
- | try_stream_wrappers_in |
- `-----------------------*/
-
- // Try stream wrappers recursively
- // On each potential stream format, try to read using Reader
+ /*!
+ ** \brief Read a stream.
+ ** \param W The type of stream
+ ** \param Reader The real reader of this stream.
+ */
template<stream_id W, typename T, class Reader>
struct try_stream_wrappers_in
{
+
+ /*!
+ ** \brief Open file as a stream, take extension and call the "real" reader.
+ ** If the extension is not known, reiterate with a stream_id - 1.
+ */
static bool
by_extension(T& output, const std::string& name, const std::string& ext)
{
@@ -138,8 +148,15 @@
::by_extension(output, name, ext);
}
- // FIXME: it sounds strange to read wrapped file without
- // matching its extension.
+ /*!
+ ** \brief Open file as a stream, take extension and call the "real" reader.
+ ** If the extension is not known, reiterate with a stream_id - 1.
+ ** \arg output The new object.
+ ** \arg name The filename.
+ **
+ ** \todo FIXME: it sounds strange to read wrapped file without
+ ** matching its extension.
+ */
static bool
by_data(T& output, const std::string& name)
{
@@ -157,17 +174,23 @@
}
};
- // End of loop
-
+ /*!
+ ** \brief Read a stream of type None.
+ **
+ ** In fact, do nothing because of the type of stream.
+ ** Used when an errors occurs on others types of stream.
+ */
template< typename T, class Reader >
struct try_stream_wrappers_in<StreamNone, T, Reader>
{
+ ///< Read s stream of type None by extension.
static bool
by_extension(T&, const std::string&, const std::string&)
{
return false;
}
+ ///< Read a stream of type None by data.
static bool
by_data(T&, const std::string&)
{
@@ -175,16 +198,20 @@
}
};
- /*------------------------.
- | try_stream_wrappers_out |
- `------------------------*/
-
- // Try stream wrappers recursively
- // On each potential stream format, try to write using the given Writer
+ /*!
+ ** \brief Write a stream.
+ ** \param W The type of stream
+ ** \param Writer The "real" writer of this stream.
+ */
template<stream_id W, typename T, class Writer>
struct try_stream_wrappers_out
{
+
+ /*!
+ ** \brief Open file as a stream, take extension and call the "real" writer.
+ ** If the extension is not known, reiterate with a stream_id - 1.
+ */
static bool
by_extension(const T& input,
const std::string& name,
@@ -208,11 +235,16 @@
}
};
- // End of loop
-
+ /*!
+ ** \brief Write a stream of type None.
+ **
+ ** In fact, do nothing because of the type of stream.
+ ** Used when an errors occurs on others types of stream.
+ */
template< typename T, class Reader >
struct try_stream_wrappers_out<StreamNone, T, Reader>
{
+ ///< Do nothing because of the type of stream.
static bool
by_extension(const T&, const std::string&, const std::string&)
{
Index: olena/oln/io/utils.hh
--- olena/oln/io/utils.hh Thu, 07 Aug 2003 02:37:23 +0200 burrus_n (oln/t/44_utils.hh 1.3 600)
+++ olena/oln/io/utils.hh Mon, 15 Mar 2004 16:00:47 +0100 odou_s (oln/t/44_utils.hh 1.3 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,8 +38,17 @@
namespace internal {
+ /*!
+ ** \brief Utils for io (get extension of a file).
+ */
struct utils
{
+
+ /*!
+ ** \brief Return the extension of a filename.
+ ** \arg name The filename.
+ ** \return The extension (lower case).
+ */
static std::string
extension(const std::string& name)
{
@@ -53,6 +62,7 @@
}
return ext;
}
+
};
} // end of namespace internal
Index: olena/oln/io/image_read.hh
--- olena/oln/io/image_read.hh Thu, 07 Aug 2003 02:37:23 +0200 burrus_n (oln/t/45_image_read 1.9 600)
+++ olena/oln/io/image_read.hh Mon, 15 Mar 2004 18:10:52 +0100 odou_s (oln/t/45_image_read 1.9 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
@@ -50,16 +50,20 @@
namespace internal {
- /*------------.
- | try_readers |
- `------------*/
-
- // Try readers recursively
-
+ /*!
+ ** \brief Image's reader.
+ ** \param R Type of reader.
+ */
template< reader_id R, typename T >
struct try_readers
{
- // Try to deduce the file format from the extension
+ /*!
+ ** \brief Read an object from a stream.
+ ** Try do deduce the image format from the extension.
+ ** \arg output The new object to write.
+ ** \arg in The stream.
+ ** \arg ext The extension's filename.
+ */
static bool
by_extension(T& output, std::istream& in, const std::string& ext)
{
@@ -71,7 +75,12 @@
::by_extension(output, in, ext);
}
- // Try to match the file format referring to the data only
+ /*!
+ ** \brief Read an object from a stream.
+ ** Try to match the file format referring to the data only.
+ ** \arg output The new object to write.
+ ** \arg in The stream.
+ */
static bool
by_data(T& output, std::istream& in)
{
@@ -82,17 +91,29 @@
}
};
- // End of try_readers loop
-
+ /*!
+ ** \brief Reader for image of type None.
+ **
+ ** In fact, do nothing because of the type of reader.
+ ** Used when an errors occurs on others types of reader.
+ */
template< typename T >
struct try_readers<ReadNone, T>
{
+ /*!
+ ** \brief Read an object from a stream.
+ ** Try do deduce the image format from the extension.
+ */
static bool
by_extension(T&, std::istream&, const std::string&)
{
return false;
}
+ /*!
+ ** \brief Read an object from a stream.
+ ** Try to match the file format referring to the data only.
+ */
static bool
by_data(T&, std::istream&)
{
@@ -100,14 +121,19 @@
}
};
- /*----------------------.
- | read(image, filename) |
- `----------------------*/
-
- // Readers trier functor, helper for stream_wrappers
-
+ /*!
+ ** \brief Readers trier functor, helper for stream_wrappers.
+ */
struct readers_trier
{
+ /*!
+ ** \brief Readers trier functor, helper for stream_wrappers.
+ ** \arg output The new object.
+ ** \arg in The stream to read from.
+ ** \arg ext The extension.
+ **
+ ** First try to read by extension, then by data.
+ */
template <class T>
static bool
doit(T& output, std::istream& in, const std::string ext)
@@ -119,16 +145,23 @@
}
};
- // Read images
-
+ /*!
+ ** \brief Read an image (2 dimensions) from a file.
+ ** \arg output Where to write the new image.
+ ** \arg name The filename.
+ ** \return True if successful.
+ **
+ ** Try to read first by extension and then by data.
+ ** If you want to know more about, see
+ ** oln::io::internal::try_stream_wrappers_in
+ */
template <unsigned N, class E>
inline bool
read(abstract::image_with_dim<N,E>& output, const std::string& name)
{
mlc::is_true<N == 2 || N == 3>::ensure();
- // FIXME: E or abstract::image_with_dim<N,E> ?
- // E is convenient.
+ ///< \todo FIXME: E or abstract::image_with_dim<N,E> ? E is convenient.
typedef try_stream_wrappers_in<StreamAny, E, readers_trier>
stream_trier;
@@ -170,6 +203,17 @@
return false;
}
+ /*!
+ ** \brief Read an image (1 dimension) from a file.
+ ** \arg output Where to write the new image.
+ ** \arg name The filename.
+ ** \return True if successful.
+ **
+ ** In fact, real work is not done here : this function calls 'read' for
+ ** images of 2 dimensions:
+ ** Mono-dimensional images is a special case of bi-dimensional
+ ** images.
+ */
template <class E>
inline bool
read(abstract::image_with_dim<1, E>& output, const std::string& name)
Index: olena/oln/core/abstract/window_base.hh
--- olena/oln/core/abstract/window_base.hh Fri, 12 Mar 2004 17:51:04 +0100 odou_s (oln/u/3_window_bas 1.10 640)
+++ olena/oln/core/abstract/window_base.hh Mon, 15 Mar 2004 18:41:40 +0100 odou_s (oln/u/3_window_bas 1.10 640)
@@ -135,7 +135,7 @@
// friend class window_base_friend_traits<Sup>::ret;
/*!
- ** \brief Return his type in a string.
+ ** \brief Return its type in a string.
** \return The type in a string.
**
** Very useful to debug.
@@ -160,8 +160,8 @@
}
/*!
- ** \brief Get the number of point we get.
- ** \return The number of point.
+ ** \brief Get the number of points.
+ ** \return The number of points.
*/
unsigned
card_() const
@@ -226,7 +226,7 @@
/*!
** \brief Set a set of point to opposite.
**
- ** Each point of the set of point is assigned to his opposite.
+ ** Each point of the set of point is assigned to its opposite.
*/
void
sym_()
@@ -262,7 +262,7 @@
** \brief Used only by sub-classes
** \arg size The number of point.
**
- ** Set the number of point this object will get.
+ ** Set the number of points this object will get.
** Used only by sub-classes
*/
window_base(unsigned size) : super_type(), dp_(), delta_(0)
Index: olena/oln/core/abstract/windownd.hh
--- olena/oln/core/abstract/windownd.hh Fri, 12 Mar 2004 17:51:04 +0100 odou_s (oln/u/4_windownd.h 1.8 640)
+++ olena/oln/core/abstract/windownd.hh Mon, 15 Mar 2004 18:43:03 +0100 odou_s (oln/u/4_windownd.h 1.8 640)
@@ -73,7 +73,7 @@
friend class window<exact_type>;
/*!
- ** \brief Return his type in a string.
+ ** \brief Return its type in a string.
** \return The type in a string.
**
** Very useful to debug.
@@ -111,7 +111,7 @@
/*!
** \brief Construct a w_window of 'size' elements.
- ** \arg size The number of element to reserve for the window.
+ ** \arg size The number of elements to reserve for the window.
*/
windownd(unsigned size) : super_type(size)
{}
Index: olena/oln/core/abstract/w_windownd.hh
--- olena/oln/core/abstract/w_windownd.hh Fri, 12 Mar 2004 17:51:04 +0100 odou_s (oln/u/5_w_windownd 1.7 640)
+++ olena/oln/core/abstract/w_windownd.hh Mon, 15 Mar 2004 18:43:21 +0100 odou_s (oln/u/5_w_windownd 1.7 640)
@@ -75,7 +75,7 @@
friend class w_window<exact_type>;
/*!
- ** \brief Return his type in a string.
+ ** \brief Return its type in a string.
** \return The type in a string.
**
** Very useful to debug.
@@ -154,7 +154,7 @@
/*!
** \brief Construct a w_window of 'size' elements.
- ** \arg size The number of element to reserve for the window.
+ ** \arg size The number of elements to reserve for the window.
*/
w_windownd(unsigned size) : super_type(size)
{
Index: olena/oln/core/abstract/neighborhoodnd.hh
--- olena/oln/core/abstract/neighborhoodnd.hh Fri, 12 Mar 2004 17:51:04 +0100 odou_s (oln/u/6_neighborho 1.7 640)
+++ olena/oln/core/abstract/neighborhoodnd.hh Mon, 15 Mar 2004 18:35:11 +0100 odou_s (oln/u/6_neighborho 1.7 640)
@@ -50,10 +50,10 @@
namespace abstract {
/*!
- ** \brief Neighborhoodnd.
+ ** \brief Neighborhood N dimensions.
**
** It looks like structuring elements but here, when
- ** you add an element, you add his opposite.
+ ** you add an element, you add its opposite.
** Points have N dimensions.
**
*/
@@ -75,7 +75,7 @@
friend class neighborhood<exact_type>;
/*!
- ** \brief Return his type in a string.
+ ** \brief Return its type in a string.
** \return The type in a string.
**
** Very useful to debug.
@@ -107,14 +107,14 @@
}
/*!
- ** \brief Construct a neighborhoodnd.
+ ** \brief Construct a neighborhood N dimensions.
*/
neighborhoodnd() : super_type()
{}
/*!
** \brief Construct a neighborhood of 'size' elements.
- ** \arg size The number of element to reserve for the neighborhood.
+ ** \arg size The number of elements to reserve for the neighborhood.
*/
neighborhoodnd(unsigned size) : super_type(size)
{}
--
Simon Odou
simon(a)lrde.epita.fr
La section de Tiger pour la documentation a du sens pour Vaucanson et
Olena.
http://www.lrde.epita.fr/~akim/compil/assignments.html#Documentation-Style
2004-03-18 Akim Demaille <akim(a)epita.fr>
* assignments.texi (T3 Goals): More.
(T5 Goals): Traits are now part of...
(T3 Goals): these.
(Documentation Style): More about useless words/comments.
--- /home/akim/www/compil/assignments.txt 2004-03-17 10:39:27.000000000 +0100
+++ assignments.txt 2004-03-18 11:44:38.000000000 +0100
@@ -5,7 +5,7 @@
The Tiger Compiler Project
**************************
- This document, last edited on March 17, 2004, details the various tasks
+ This document, last edited on March 18, 2004, details the various tasks
the "Compilation" students must complete. It is available under various
forms:
- Assignments in a single HTML file(1).
@@ -1617,10 +1617,51 @@
End comments with a period.
+ -- Rule: Be concise
For documentation as for any other kind of writing, the shorter, the
better: hunt useless words. *Note The Elements of Style::, for an
excellent set of writing guidelines.
+ Here are a few samples of things to avoid:
+ Documenting the definition instead of the object of the definition
+ Don't write:
+
+ /// Declaration of the Foo class.
+ class Foo
+ {
+ ...
+ };
+
+ Of course you're documentation the definition of the entities!
+ "Declaration of the" is totally useless, just use `/// Foo
+ class'. But read bellow.
+
+ Don't qualify obvious entity kinds.
+ Don't write:
+
+ /// Foo class.
+ class Foo
+ {
+ public:
+ /// Construct a Foo object.
+ Foo (Bar &bar)
+ ...
+ };
+
+ It is so obvious that you're documentation the class and the
+ constructor that you should not write it down. Instead of
+ documenting the _kind_ of an entity (class, function, namespace,
+ destructor...), document its _goal_.
+
+ /// Wrapper around Bar objects.
+ class Foo
+ {
+ public:
+ /// Bind to \a bar.
+ Foo (Bar &bar)
+ ...
+ };
+
-- Rule: Use the Imperative
Use the imperative when documenting, as if you were giving order to the
function or entity you are describing. When describing a function,