Simplify 'Hash_handles_with_or_without_timestamps' (use 'Get_time_stamper')

This commit is contained in:
Mael Rouxel-Labbé 2019-10-28 11:29:08 +01:00
parent b9e320659e
commit 53d4c9b580
19 changed files with 29 additions and 71 deletions

View File

@ -15,7 +15,7 @@
#include <CGAL/license/Mesh_3.h>
#include <CGAL/Hash_handles_with_or_without_timestamps.h>
#include <CGAL/Time_stamper.h>
#include <vtkPoints.h>
#include <vtkUnstructuredGrid.h>

View File

@ -14,7 +14,7 @@
#include <CGAL/license/Mesh_3.h>
#include <CGAL/Hash_handles_with_or_without_timestamps.h>
#include <CGAL/Time_stamper.h>
#include <CGAL/utility.h>
#include <boost/unordered_map.hpp>

View File

@ -15,7 +15,7 @@
#include <CGAL/license/Mesh_3.h>
#include <CGAL/Hash_handles_with_or_without_timestamps.h>
#include <CGAL/Time_stamper.h>
#include <CGAL/IO/File_medit.h>
#include <iostream>

View File

@ -18,9 +18,9 @@
#include <CGAL/array.h>
#include <CGAL/boost/graph/Euler_operations.h>
#include <CGAL/Hash_handles_with_or_without_timestamps.h>
#include <CGAL/Polygon_mesh_processing/orient_polygon_soup.h>
#include <CGAL/Polygon_mesh_processing/polygon_soup_to_polygon_mesh.h>
#include <CGAL/Time_stamper.h>
#include <boost/unordered_map.hpp>
#include <boost/tuple/tuple.hpp>

View File

@ -26,7 +26,7 @@
#include <CGAL/linear_least_squares_fitting_3.h>
#include <CGAL/Mesh_3/Triangulation_helpers.h>
#include <CGAL/Hash_handles_with_or_without_timestamps.h>
#include <CGAL/Time_stamper.h>
#include <CGAL/tuple.h>
#include <CGAL/iterator.h>
#include <CGAL/array.h>

View File

@ -19,7 +19,7 @@
#include <CGAL/Compare_handles_with_or_without_timestamps.h>
#include <CGAL/Mesh_3/Detect_polylines_in_polyhedra_fwd.h>
#include <CGAL/Default.h>
#include <CGAL/Hash_handles_with_or_without_timestamps.h>
#include <CGAL/Time_stamper.h>
#include <boost/mpl/if.hpp>
#include <boost/unordered_map.hpp>

View File

@ -23,7 +23,7 @@
#include <CGAL/Mesh_3/config.h>
#include <CGAL/Mesh_3/Uniform_sizing_field.h>
#include <CGAL/Hash_handles_with_or_without_timestamps.h>
#include <CGAL/Time_stamper.h>
#include <CGAL/convex_hull_2.h>
#include <CGAL/ch_graham_andrew.h>

View File

@ -31,7 +31,7 @@
#include <CGAL/Bbox_3.h>
#include <CGAL/Mesh_3/io_signature.h>
#include <CGAL/Union_find.h>
#include <CGAL/Hash_handles_with_or_without_timestamps.h>
#include <CGAL/Time_stamper.h>
#include <boost/functional/hash.hpp>
#include <boost/unordered_map.hpp>

View File

@ -29,8 +29,8 @@
#include <CGAL/Origin.h>
#include <CGAL/Mesh_optimization_return_code.h>
#include <CGAL/Mesh_3/Null_global_optimizer_visitor.h>
#include <CGAL/Time_stamper.h>
#include <CGAL/Hash_handles_with_or_without_timestamps.h>
#include <CGAL/iterator.h>
#include <CGAL/tuple.h>

View File

@ -41,8 +41,7 @@
#endif
#include <CGAL/enum.h>
#include <CGAL/Has_timestamp.h>
#include <CGAL/Hash_handles_with_or_without_timestamps.h>
#include <CGAL/Time_stamper.h>
#include <CGAL/internal/Has_member_visited.h>
#include <CGAL/iterator.h>
#include <CGAL/number_utils.h>

View File

@ -19,9 +19,9 @@
#include <CGAL/Mesh_facet_topology.h>
#include <CGAL/Hash_handles_with_or_without_timestamps.h>
#include <CGAL/utility.h>
#include <CGAL/atomic.h>
#include <CGAL/utility.h>
#include <CGAL/Time_stamper.h>
#include <boost/bimap.hpp>
#include <boost/bimap/unordered_set_of.hpp>

View File

@ -42,8 +42,7 @@
#include <CGAL/Real_timer.h>
#include <CGAL/Mesh_3/Null_perturber_visitor.h>
#include <CGAL/Mesh_3/sliver_criteria.h>
#include <CGAL/Has_timestamp.h>
#include <CGAL/Hash_handles_with_or_without_timestamps.h>
#include <CGAL/Time_stamper.h>
#include <CGAL/Mesh_3/Concurrent_mesher_config.h>
#include <CGAL/Mesh_3/Worksharing_data_structures.h>

View File

@ -21,7 +21,7 @@
#include <CGAL/enum.h>
#include <CGAL/internal/Has_nested_type_Bare_point.h>
#include <CGAL/Hash_handles_with_or_without_timestamps.h>
#include <CGAL/Time_stamper.h>
#include <boost/mpl/if.hpp>
#include <boost/mpl/identity.hpp>

View File

@ -24,6 +24,7 @@
#include <CGAL/Mesh_3/C3T3_helpers.h>
#include <CGAL/Mesh_3/Triangulation_helpers.h>
#include <CGAL/Time_stamper.h>
#ifdef CGAL_MESH_3_PERTURBER_VERBOSE
#include <CGAL/Timer.h>

View File

@ -22,10 +22,10 @@
#include <CGAL/disable_warnings.h>
#include <CGAL/iterator.h>
#include <CGAL/Hash_handles_with_or_without_timestamps.h>
#include <CGAL/Mesh_3/utilities.h>
#include <CGAL/Mesh_3/Mesh_complex_3_in_triangulation_3_base.h>
#include <CGAL/internal/Mesh_3/Boundary_of_subdomain_of_complex_3_in_triangulation_3_to_off.h>
#include <CGAL/Time_stamper.h>
#include <boost/bimap/bimap.hpp>
#include <boost/bimap/multiset_of.hpp>

View File

@ -40,13 +40,12 @@
#include <CGAL/Mesh_3/Triangulation_helpers.h>
#include <CGAL/enum.h>
#include <CGAL/Has_timestamp.h>
#include <CGAL/Hash_handles_with_or_without_timestamps.h>
#include <CGAL/internal/Has_member_visited.h>
#include <CGAL/iterator.h>
#include <CGAL/number_utils.h>
#include <CGAL/Periodic_3_Delaunay_triangulation_traits_3.h>
#include <CGAL/Periodic_3_Delaunay_triangulation_3.h>
#include <CGAL/Time_stamper.h>
#include <CGAL/boost/iterator/transform_iterator.hpp>

View File

@ -24,8 +24,7 @@
#include <CGAL/Mesh_3/Dump_c3t3.h>
#include <CGAL/Mesh_3/Triangulation_helpers.h>
#include <CGAL/refine_mesh_3.h>
#include <CGAL/Hash_handles_with_or_without_timestamps.h>
#include <CGAL/Time_stamper.h>
#include <boost/parameter/preprocessor.hpp>
#include <boost/unordered_set.hpp>

View File

@ -1,50 +0,0 @@
// Copyright (c) 2014-2017 GeometryFactory Sarl (France)
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org)
//
// $URL$
// $Id$
// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial
//
// Author(s) : Laurent Rineau,
// Mael Rouxel-Labbé
#ifndef CGAL_HASH_HANDLES_WITH_OR_WITHOUT_TIMESTAMPS_H
#define CGAL_HASH_HANDLES_WITH_OR_WITHOUT_TIMESTAMPS_H
#include <CGAL/Has_timestamp.h>
#include <boost/functional/hash.hpp>
#include <cstddef>
#include <iterator>
namespace CGAL {
struct Hash_handles_with_or_without_timestamps
{
template <typename Handle>
std::size_t operator()(const Handle h) const
{
typedef typename std::iterator_traits<Handle>::value_type Type;
return hash(h, Boolean_tag<CGAL::internal::Has_timestamp<Type>::value>());
}
template<typename Handle>
std::size_t hash(const Handle h, Tag_false) const
{
return boost::hash_value(&*h);
}
template<typename Handle>
std::size_t hash(const Handle h, Tag_true) const
{
return h->time_stamp();
}
};
} // namespace CGAL
#endif // CGAL_HASH_HANDLES_WITH_OR_WITHOUT_TIMESTAMPS_H

View File

@ -149,6 +149,17 @@ struct Get_time_stamper<T,false>{
template <class T>
struct Time_stamper_impl : public Get_time_stamper<T>::type {};
struct Hash_handles_with_or_without_timestamps
{
template <typename Handle>
std::size_t operator()(const Handle h) const
{
typedef typename std::iterator_traits<Handle>::value_type Type;
return Get_time_stamper<Type>::type::hash_value(&*h);
}
};
} //end of namespace CGAL
#endif // CGAL_TIME_STAMPER_H