Commit bc1b7409 authored by Edwin Carlinet's avatar Edwin Carlinet
Browse files

Rename predorder iterator by depth1st iterator.

	* mln/morpho/tree/data.hh,
	* mln/morpho/tree/propagate_node.hh,
	* sandbox/edwin/tests/sharpness_attribute.cc:
	Rename predorder iterator by depth1st iterator.

git-svn-id: https://svn.lrde.epita.fr/svn/oln/trunk@3987 4aad255d-cdde-0310-9447-f3009e2ae8c0
parent 5381aec6
2009-06-04 Edwin Carlinet <carlinet@lrde.epita.fr>
Rename predorder iterator by depth1st iterator.
* mln/morpho/tree/data.hh,
* mln/morpho/tree/propagate_node.hh,
* sandbox/edwin/tests/sharpness_attribute.cc:
Rename predorder iterator by depth1st iterator.
2009-06-03 Thierry Geraud <thierry.geraud@lrde.epita.fr>
 
Fix the library name in the copyright text.
......@@ -1248,6 +1248,7 @@ mln/value/sign.hh \
mln/value/stack.hh \
mln/value/super_value.hh \
mln/value/viter.hh \
mln/version.hh \
mln/win/all.hh \
mln/win/backdiag2d.hh \
mln/win/ball.hh \
......
......@@ -49,7 +49,7 @@
# define mln_site_piter(T) typename T::site_piter
# define mln_node_piter(T) typename T::node_piter
# define mln_leaf_piter(T) typename T::leaf_piter
# define mln_preorder_piter(T) typename T::preorder_piter
# define mln_depth1st_piter(T) typename T::depth1st_piter
# define mln_up_site_piter_(T) T::up_site_piter
# define mln_dn_site_piter_(T) T::dn_site_piter
......@@ -60,7 +60,7 @@
# define mln_site_piter_(T) T::site_piter
# define mln_node_piter_(T) T::node_piter
# define mln_leaf_piter_(T) T::leaf_piter
# define mln_preorder_piter_(T) T::preorder_piter
# define mln_depth1st_piter_(T) T::depth1st_piter
namespace mln
......@@ -92,8 +92,8 @@ namespace mln
/// Iterate on tree's leaves in the same way of dn_node_piter.
template <typename T> struct dn_leaf_piter;
/// Preorder tree traversal iterator.
template <typename T> struct preorder_piter;
/// Depth1st tree traversal iterator.
template <typename T> struct depth1st_piter;
template <typename I, typename S>
......@@ -132,7 +132,7 @@ namespace mln
typedef mln::morpho::tree::dn_leaf_piter<self_> dn_leaf_piter;
typedef up_leaf_piter leaf_piter;
typedef mln::morpho::tree::preorder_piter<self_> preorder_piter;
typedef mln::morpho::tree::depth1st_piter<self_> depth1st_piter;
/// Constructor.
......@@ -337,22 +337,22 @@ namespace mln
};
template <typename T>
class preorder_piter
: public mln::internal::site_set_iterator_base< T, preorder_piter<T> >
class depth1st_piter
: public mln::internal::site_set_iterator_base< T, depth1st_piter<T> >
{
typedef preorder_piter<T> self_;
typedef depth1st_piter<T> self_;
typedef mln::internal::site_set_iterator_base<T, self_> super_;
public:
/// Constructor with no argument.
preorder_piter();
depth1st_piter();
/// Constructor.
preorder_piter(const T& t);
depth1st_piter(const T& t);
preorder_piter(const T& t,
depth1st_piter(const T& t,
const mln_psite(T::function)& p);
/// Test if the iterator is valid.
......@@ -370,6 +370,10 @@ namespace mln
/// Skip current point children. Next call to next() goes to the brother point.
void skip_children();
unsigned get_depth() {
return stack_.size() - 1;
}
protected:
using super_::p_;
using super_::s_;
......@@ -560,14 +564,14 @@ namespace mln
template <typename T>
inline
preorder_piter<T>::preorder_piter()
depth1st_piter<T>::depth1st_piter()
: root_ (0)
{
}
template <typename T>
inline
preorder_piter<T>::preorder_piter(const T& t)
depth1st_piter<T>::depth1st_piter(const T& t)
: root_ (0)
{
this->change_target(t);
......@@ -575,7 +579,7 @@ namespace mln
template <typename T>
inline
preorder_piter<T>::preorder_piter(const T& t,
depth1st_piter<T>::depth1st_piter(const T& t,
const mln_psite(T::function)& p)
: root_ (&p)
{
......@@ -586,7 +590,7 @@ namespace mln
template <typename T>
inline
bool
preorder_piter<T>::is_valid_() const
depth1st_piter<T>::is_valid_() const
{
return !stack_.empty();
}
......@@ -594,7 +598,7 @@ namespace mln
template <typename T>
inline
void
preorder_piter<T>::invalidate_()
depth1st_piter<T>::invalidate_()
{
stack_.clear();
}
......@@ -602,7 +606,7 @@ namespace mln
template <typename T>
inline
void
preorder_piter<T>::start_()
depth1st_piter<T>::start_()
{
this->invalidate();
stack_.push_back(mln_psite(T::function)()); // needed for last element.
......@@ -627,7 +631,7 @@ namespace mln
template <typename T>
inline
void
preorder_piter<T>::next_()
depth1st_piter<T>::next_()
{
p_ = stack_.back();
stack_.pop_back();
......@@ -641,7 +645,7 @@ namespace mln
template <typename T>
inline
void
preorder_piter<T>::skip_children()
depth1st_piter<T>::skip_children()
{
while (stack_.size() != 1 && s_->parent(stack_.back()) == p_)
stack_.pop_back();
......
......@@ -131,7 +131,7 @@ namespace mln {
n = t.parent(n);
mln_assertion(t.is_a_node(n));
typename T::preorder_piter pp(t, n);
typename T::depth1st_piter pp(t, n);
pp.start(); // We don't set n to v.
......
......@@ -105,7 +105,7 @@ int main(int argc, char** argv)
std::cout << "| " << std::setw(w) << "delta(n)";
std::cout << '|' << std::endl;
mln_preorder_piter_(T) n(tree);
mln_depth1st_piter_(T) n(tree);
std::stack<mln_psite_(T)> s;
for_all(n)
{
......
......@@ -284,6 +284,7 @@ mln_core_internal_complex_window_p_base \
mln_core_internal_coord_impl \
mln_core_internal_data \
mln_core_internal_exact \
mln_core_internal_exact_gcc_2_95 \
mln_core_internal_fixme \
mln_core_internal_force_exact \
mln_core_internal_geom_bbox \
......@@ -630,6 +631,7 @@ mln_io_all \
mln_io_cloud_all \
mln_io_cloud_load \
mln_io_cloud_save \
mln_io_dicom_all \
mln_io_dicom_load \
mln_io_dump_all \
mln_io_dump_load \
......@@ -667,7 +669,6 @@ mln_io_ppm_load \
mln_io_ppm_save \
mln_io_tiff_all \
mln_io_tiff_load \
mln_io_tiff_save \
mln_io_txt_all \
mln_io_txt_save \
mln_labeling_all \
......@@ -1109,10 +1110,6 @@ mln_util_greater_point \
mln_util_greater_psite \
mln_util_ignore \
mln_util_index \
mln_util_internal_boost_graph \
mln_util_internal_boost_graph_access \
mln_util_internal_boost_graph_property \
mln_util_internal_boost_graph_structure \
mln_util_internal_edge_impl \
mln_util_internal_graph_base \
mln_util_internal_graph_iter \
......@@ -1217,6 +1214,7 @@ mln_value_sign \
mln_value_stack \
mln_value_super_value \
mln_value_viter \
mln_version \
mln_win_all \
mln_win_backdiag2d \
mln_win_ball \
......@@ -1241,7 +1239,6 @@ mln_win_vline2d \
mln_world_all \
mln_world_binary_2d_all \
mln_world_binary_2d_enlarge \
mln_world_binary_2d_enlarge_hq2x \
mln_world_binary_2d_projected_histo \
mln_world_binary_2d_subsample \
mln_world_inter_pixel_all \
......@@ -1543,6 +1540,7 @@ mln_core_internal_complex_window_p_base_SOURCES = mln_core_internal_complex_wind
mln_core_internal_coord_impl_SOURCES = mln_core_internal_coord_impl.cc
mln_core_internal_data_SOURCES = mln_core_internal_data.cc
mln_core_internal_exact_SOURCES = mln_core_internal_exact.cc
mln_core_internal_exact_gcc_2_95_SOURCES = mln_core_internal_exact_gcc_2_95.cc
mln_core_internal_fixme_SOURCES = mln_core_internal_fixme.cc
mln_core_internal_force_exact_SOURCES = mln_core_internal_force_exact.cc
mln_core_internal_geom_bbox_SOURCES = mln_core_internal_geom_bbox.cc
......@@ -1889,6 +1887,7 @@ mln_io_all_SOURCES = mln_io_all.cc
mln_io_cloud_all_SOURCES = mln_io_cloud_all.cc
mln_io_cloud_load_SOURCES = mln_io_cloud_load.cc
mln_io_cloud_save_SOURCES = mln_io_cloud_save.cc
mln_io_dicom_all_SOURCES = mln_io_dicom_all.cc
mln_io_dicom_load_SOURCES = mln_io_dicom_load.cc
mln_io_dump_all_SOURCES = mln_io_dump_all.cc
mln_io_dump_load_SOURCES = mln_io_dump_load.cc
......@@ -1926,7 +1925,6 @@ mln_io_ppm_load_SOURCES = mln_io_ppm_load.cc
mln_io_ppm_save_SOURCES = mln_io_ppm_save.cc
mln_io_tiff_all_SOURCES = mln_io_tiff_all.cc
mln_io_tiff_load_SOURCES = mln_io_tiff_load.cc
mln_io_tiff_save_SOURCES = mln_io_tiff_save.cc
mln_io_txt_all_SOURCES = mln_io_txt_all.cc
mln_io_txt_save_SOURCES = mln_io_txt_save.cc
mln_labeling_all_SOURCES = mln_labeling_all.cc
......@@ -2368,10 +2366,6 @@ mln_util_greater_point_SOURCES = mln_util_greater_point.cc
mln_util_greater_psite_SOURCES = mln_util_greater_psite.cc
mln_util_ignore_SOURCES = mln_util_ignore.cc
mln_util_index_SOURCES = mln_util_index.cc
mln_util_internal_boost_graph_SOURCES = mln_util_internal_boost_graph.cc
mln_util_internal_boost_graph_access_SOURCES = mln_util_internal_boost_graph_access.cc
mln_util_internal_boost_graph_property_SOURCES = mln_util_internal_boost_graph_property.cc
mln_util_internal_boost_graph_structure_SOURCES = mln_util_internal_boost_graph_structure.cc
mln_util_internal_edge_impl_SOURCES = mln_util_internal_edge_impl.cc
mln_util_internal_graph_base_SOURCES = mln_util_internal_graph_base.cc
mln_util_internal_graph_iter_SOURCES = mln_util_internal_graph_iter.cc
......@@ -2476,6 +2470,7 @@ mln_value_sign_SOURCES = mln_value_sign.cc
mln_value_stack_SOURCES = mln_value_stack.cc
mln_value_super_value_SOURCES = mln_value_super_value.cc
mln_value_viter_SOURCES = mln_value_viter.cc
mln_version_SOURCES = mln_version.cc
mln_win_all_SOURCES = mln_win_all.cc
mln_win_backdiag2d_SOURCES = mln_win_backdiag2d.cc
mln_win_ball_SOURCES = mln_win_ball.cc
......@@ -2500,7 +2495,6 @@ mln_win_vline2d_SOURCES = mln_win_vline2d.cc
mln_world_all_SOURCES = mln_world_all.cc
mln_world_binary_2d_all_SOURCES = mln_world_binary_2d_all.cc
mln_world_binary_2d_enlarge_SOURCES = mln_world_binary_2d_enlarge.cc
mln_world_binary_2d_enlarge_hq2x_SOURCES = mln_world_binary_2d_enlarge_hq2x.cc
mln_world_binary_2d_projected_histo_SOURCES = mln_world_binary_2d_projected_histo.cc
mln_world_binary_2d_subsample_SOURCES = mln_world_binary_2d_subsample.cc
mln_world_inter_pixel_all_SOURCES = mln_world_inter_pixel_all.cc
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment