Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aos 2 metadata traits decorators efif #8592

Merged
merged 20 commits into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
// Copyright (c) 2005,2007,2009,2010,2011 Tel-Aviv University (Israel).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
//
// $URL$
// $Id$
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
//
// Author(s): Efi Fogel <[email protected]>
// Eric Berberich <[email protected]>

namespace CGAL {

/*! \ingroup PkgArrangementOnSurface2TraitsClasses
*
* A metadata traits-class decorator for the arrangement package. It counts the
* number of invocations of traits-class functors. It is parameterized with
* another traits class and inherits from it. For each traits method it
* maintains a counter that counts the number of invocations into the method.
*
* It models all the concepts that the original traits models.
*/

template <typename BaseTraits>
class Arr_counting_traits_2 : public BaseTraits {
public:
enum Operation_id {
COMPARE_X_2_OP = 0,
COMPARE_XY_2_OP,
CONSTRUCT_MIN_VERTEX_2_OP,
CONSTRUCT_MAX_VERTEX_2_OP,
IS_VERTICAL_2_OP,
COMPARE_Y_AT_X_2_OP,
EQUAL_2_POINTS_OP,
EQUAL_2_CURVES_OP,
COMPARE_Y_AT_X_LEFT_2_OP,
COMPARE_Y_AT_X_RIGHT_2_OP,
MAKE_X_MONOTONE_2_OP,
SPLIT_2_OP,
INTERSECT_2_OP,
ARE_MERGEABLE_2_OP,
MERGE_2_OP,
CONSTRUCT_2_OPPOSITE_2_OP,
COMPARE_ENDPOINTS_XY_2_OP,
APPROXIMATE_2_COORD_OP,
APPROXIMATE_2_POINT_OP,
APPROXIMATE_2_CURVE_OP,
PARAMETER_SPACE_IN_X_2_CURVE_END_OP,
PARAMETER_SPACE_IN_X_2_POINT_OP,
IS_ON_X_IDENTIFICATION_POINT_2_OP,
IS_ON_X_IDENTIFICATION_CURVE_2_OP,
COMPARE_Y_ON_BOUNDARY_2_OP,
COMPARE_Y_NEAR_BOUNDARY_2_OP,
PARAMETER_SPACE_IN_Y_2_CURVE_END_OP,
PARAMETER_SPACE_IN_Y_2_POINT_OP,
IS_ON_Y_IDENTIFICATION_2_POINT_OP,
IS_ON_Y_IDENTIFICATION_2_CURVE_OP,
COMPARE_X_ON_BOUNDARY_2_POINTS_OP,
COMPARE_X_ON_BOUNDARY_2_POINT_CURVE_END_OP,
COMPARE_X_ON_BOUNDARY_2_CURVE_ENDS_OP,
COMPARE_X_NEAR_BOUNDARY_2_OP,
NUMBER_OF_OPERATIONS
};

/// \name Creation
/// @{

/*! Construct default */
sloriot marked this conversation as resolved.
Show resolved Hide resolved
template <typename ... Args>
Arr_counting_traits_2(Args ... args) : Base(std::forward<Args>(args)...) {}

/*! Disable copy constructor. */
sloriot marked this conversation as resolved.
Show resolved Hide resolved
Arr_counting_traits_2(const Arr_counting_traits_2&) = delete;

/// @}

/*! Obtain the counter of the given operation */
sloriot marked this conversation as resolved.
Show resolved Hide resolved
std::size_t count(Operation_id id) const;

/*! Print the counter associated with an operation. */
sloriot marked this conversation as resolved.
Show resolved Hide resolved
template <typename OutStream>
OutStream& print(OutStream& os, Operation_id id) const;

/// \name Types and functors inherited from the base
/// @{

using Has_left_category = typename Base::Has_left_category;
using Has_merge_category = typename Base::Has_merge_category;
using Has_do_intersect_category = typename Base::Has_do_intersect_category;

using Left_side_category =
typename internal::Arr_complete_left_side_category<Base>::Category;
using Bottom_side_category =
typename internal::Arr_complete_bottom_side_category<Base>::Category;
using Top_side_category =
typename internal::Arr_complete_top_side_category<Base>::Category;
using Right_side_category =
typename internal::Arr_complete_right_side_category<Base>::Category;

using Point_2 = typename Base::Point_2;
using X_monotone_curve_2 = typename Base::X_monotone_curve_2;
using Curve_2 = typename Base::Curve_2;

/// @}

/// \name Obtain the appropriate functor
sloriot marked this conversation as resolved.
Show resolved Hide resolved
/// @{

Compare_x_2 compare_x_2_object() const;
Compare_xy_2 compare_xy_2_object() const;
Construct_min_vertex_2 construct_min_vertex_2_object() const;
Construct_max_vertex_2 construct_max_vertex_2_object() const;
Is_vertical_2 is_vertical_2_object() const;
Compare_y_at_x_2 compare_y_at_x_2_object() const;
Equal_2 equal_2_object() const;
Compare_y_at_x_left_2 compare_y_at_x_left_2_object() const;
Compare_y_at_x_right_2 compare_y_at_x_right_2_object() const;
Make_x_monotone_2 make_x_monotone_2_object() const;
Split_2 split_2_object() const;
Intersect_2 intersect_2_object() const;
Are_mergeable_2 are_mergeable_2_object() const;
Merge_2 merge_2_object() const;
Construct_opposite_2 construct_opposite_2_object() const;
Compare_endpoints_xy_2 compare_endpoints_xy_2_object() const;
Approximate_2 approximate_2_object() const;
Parameter_space_in_x_2 parameter_space_in_x_2_object() const;
Is_on_x_identification_2 is_on_x_identification_2_object() const;
Compare_y_on_boundary_2 compare_y_on_boundary_2_object() const;
Compare_y_near_boundary_2 compare_y_near_boundary_2_object() const;
Parameter_space_in_y_2 parameter_space_in_y_2_object() const;
Is_on_y_identification_2 is_on_y_identification_2_object() const;
Compare_x_on_boundary_2 compare_x_on_boundary_2_object() const;
Compare_x_near_boundary_2 compare_x_near_boundary_2_object() const;

/// @}

/*! Clean all operation counters */
void clear_counters();
};

template <typename OutStream, class BaseTraits>
inline OutStream& operator<<(OutStream& os,
const Arr_counting_traits_2<BaseTraits>& traits);
} //namespace CGAL
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
// Copyright (c) 2007,2009,2010,2011 Tel-Aviv University (Israel).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
//
// $URL$
// $Id$
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
//
// Author(s): Efi Fogel <[email protected]>

namespace CGAL {

/*! \ingroup PkgArrangementOnSurface2TraitsClasses
*
* A metadata traits-class decorator for the arrangement package. It traces the
* invocations of traits-class functors. It is parameterized with another traits
* class and inherits from it. For each traits method it prints out its input
* parameters and its output result
*
* It models all the concepts that the original traits models.
*/
template <typename BaseTraits>
class Arr_tracing_traits_2 : public BaseTraits {
public:
enum Operation_id {
COMPARE_X_2_OP = 0,
COMPARE_XY_2_OP,
CONSTRUCT_MIN_VERTEX_2_OP,
CONSTRUCT_MAX_VERTEX_2_OP,
IS_VERTICAL_2_OP,
COMPARE_Y_AT_X_2_OP,
EQUAL_POINTS_2_OP,
EQUAL_CURVES_2_OP,
COMPARE_Y_AT_X_LEFT_2_OP,
COMPARE_Y_AT_X_RIGHT_2_OP,
MAKE_X_MONOTONE_2_OP,
SPLIT_2_OP,
INTERSECT_2_OP,
ARE_MERGEABLE_2_OP,
MERGE_2_OP,
CONSTRUCT_2_OPPOSITE_2_OP,
COMPARE_ENDPOINTS_XY_2_OP,
APPROXIMATE_2_OP,
PARAMETER_SPACE_IN_X_2_OP,
IS_ON_X_IDENTIFICATION_2_OP,
COMPARE_Y_ON_BOUNDARY_2_OP,
COMPARE_Y_NEAR_BOUNDARY_2_OP,
PARAMETER_SPACE_IN_Y_2_OP,
IS_ON_Y_IDENTIFICATION_2_OP,
COMPARE_X_ON_BOUNDARY_2_OP,
COMPARE_X_NEAR_BOUNDARY_2_OP,
NUMBER_OF_OPERATIONS
};

public:
/// \name Creation
/// @{

/*! Construct default */
sloriot marked this conversation as resolved.
Show resolved Hide resolved
template<typename ... Args>
Arr_tracing_traits_2(Args ... args) : Base(std::forward<Args>(args)...) {}

/*! Disable copy constructor. */
sloriot marked this conversation as resolved.
Show resolved Hide resolved
Arr_tracing_traits_2(const Arr_tracing_traits_2&) = delete;

/// @}

/*! Enable the trace of a traits operation
sloriot marked this conversation as resolved.
Show resolved Hide resolved
* \param id the operation identifier
*/
void enable_trace(Operation_id id);

/*! Enable the trace of all traits operations
sloriot marked this conversation as resolved.
Show resolved Hide resolved
*/
void enable_all_traces();

/*! Disable the trace of a traits operation
sloriot marked this conversation as resolved.
Show resolved Hide resolved
* \param id the operation identifier
*/
void disable_trace(Operation_id id);

/*! Disable the trace of all traits operations
sloriot marked this conversation as resolved.
Show resolved Hide resolved
*/
void disable_all_traces();

/// \name Types and functors inherited from the base
sloriot marked this conversation as resolved.
Show resolved Hide resolved
sloriot marked this conversation as resolved.
Show resolved Hide resolved
/// @{

using Has_left_category = typename Base::Has_left_category;
using Has_merge_category = typename Base::Has_merge_category;
using Has_do_intersect_category = typename Base::Has_do_intersect_category;

using Left_side_category =
typename internal::Arr_complete_left_side_category< Base >::Category;
using Bottom_side_category =
typename internal::Arr_complete_bottom_side_category< Base >::Category;
using Top_side_category =
typename internal::Arr_complete_top_side_category< Base >::Category;
using Right_side_category =
typename internal::Arr_complete_right_side_category< Base >::Category;

using Point_2 = typename Base::Point_2;
using X_monotone_curve_2 = typename Base::X_monotone_curve_2;
using Curve_2 = typename Base::Curve_2;
using Multiplicity = typename Base::Multiplicity;

/// @}

/// \name Obtain the appropriate functor
sloriot marked this conversation as resolved.
Show resolved Hide resolved
/// @{

Compare_x_2 compare_x_2_object() const;
Compare_xy_2 compare_xy_2_object() const;
Construct_min_vertex_2 construct_min_vertex_2_object() const;
Construct_max_vertex_2 construct_max_vertex_2_object() const;
Is_vertical_2 is_vertical_2_object() const;
Compare_y_at_x_2 compare_y_at_x_2_object() const;
Equal_2 equal_2_object() const;
Compare_y_at_x_left_2 compare_y_at_x_left_2_object() const;
Compare_y_at_x_right_2 compare_y_at_x_right_2_object() const;
Make_x_monotone_2 make_x_monotone_2_object() const;
Split_2 split_2_object() const;
Intersect_2 intersect_2_object() const;
Are_mergeable_2 are_mergeable_2_object() const;
Merge_2 merge_2_object() const;
Construct_opposite_2 construct_opposite_2_object() const;
Compare_endpoints_xy_2 compare_endpoints_xy_2_object() const;
Approximate_2 approximate_2_object() const;
Parameter_space_in_x_2 parameter_space_in_x_2_object() const;
Is_on_x_identification_2 is_on_x_identification_2_object() const;
Compare_y_on_boundary_2 compare_y_on_boundary_2_object() const;
Compare_y_near_boundary_2 compare_y_near_boundary_2_object() const;
Parameter_space_in_y_2 parameter_space_in_y_2_object() const;
Is_on_y_identification_2 is_on_y_identification_2_object() const;
Compare_x_on_boundary_2 compare_x_on_boundary_2_object() const;
Compare_x_near_boundary_2 compare_x_near_boundary_2_object() const;

/// @}
};

template <typename OutputStream>
OutputStream& operator<<(OutputStream& os, Comparison_result cr);

} //namespace CGAL
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ class Approximate_2 {
/// A model of this concept must provide:
/// @{

/*! obtains an approximation of `p`'s \f$x\f$-coordinate (if `i == 0`), or of
* `p`'s \f$y\f$-coordinate (if `i == 1`).
/*! obtains an approximation of `p`'s \f$x\f$-coordinate (if `i` == 0), or of
* `p`'s \f$y\f$-coordinate (if `i` == 1).
*/
CGAL::Approximate_number_type operator()(ArrTraits::Point_2 p, int i);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,46 +198,48 @@ implemented as peripheral classes or as free (global) functions.
- `CGAL::Arrangement_on_surface_with_history_2<GeometryTraits_2,TopologyTraits>`
- `CGAL::Arrangement_2<Traits,Dcel>`
- `CGAL::Arrangement_with_history_2<Traits,Dcel>`
- `CGAL::Arr_accessor<Arrangement>`
- `CGAL::Aos_observer<ArrangementOnSurface_2>`
- `CGAL::Arr_observer<Arrangement_2>`
- `CGAL::Arrangement_2::Vertex`
- `CGAL::Arrangement_2::Halfedge`
- `CGAL::Arrangement_2::Face`
- `CGAL::Arr_accessor<Arrangement>`
- `CGAL::Arr_algebraic_segment_traits_2<Coefficient>`
- `CGAL::Arr_Bezier_curve_traits_2<RatKernel,AlgKernel,NtTraits>`
- `CGAL::Arr_bounded_planar_topology_traits_2<GeometryTraits_2,Dcel>`
- `CGAL::Arr_circle_segment_traits_2<Kernel>`
- `CGAL::Arr_circular_arc_traits_2<CircularKernel>`
- `CGAL::Arr_circular_line_arc_traits_2<CircularKernel>`
- `CGAL::Arr_conic_traits_2<RatKernel,AlgKernel,NtTraits>`
- `CGAL::Arr_consolidated_curve_data_traits_2<Traits,Data>`
- `CGAL::Arr_counting_traits_2<BaseTraits>`
- `CGAL::Arr_curve_data_traits_2<Tr,XData,Mrg,CData,Cnv>`
- `CGAL::Arr_dcel_base<V,H,F>`
- `CGAL::Arr_dcel<Traits,V,H,F>`
- `CGAL::Arr_default_dcel<Traits>`
- `CGAL::Arr_face_extended_dcel<Traits,FData,V,H,F>`
- `CGAL::Arr_face_index_map<Arrangement>`
- `CGAL::Arr_extended_dcel<Traits,VData,HData,FData,V,H,F>`
- `CGAL::Arr_segment_traits_2<Kernel>`
- `CGAL::Arr_non_caching_segment_traits_2<Kernel>`
- `CGAL::Arr_extended_dcel_text_formatter<Arrangement>`
- `CGAL::Arr_face_extended_text_formatter<Arrangement>`
- `CGAL::Arr_geodesic_arc_on_sphere_traits_2<Kernel,x,y>`
- `CGAL::Arr_landmarks_point_location<Arrangement,Generator>`
- `CGAL::Arr_line_arc_traits_2<CircularKernel>`
- `CGAL::Arr_linear_traits_2<Kernel>`
- `CGAL::Arr_naive_point_location<Arrangement>`
- `CGAL::Arr_non_caching_segment_traits_2<Kernel>`
- `CGAL::Arr_observer<Arrangement_2>`
- `CGAL::Arr_polyline_traits_2<SegmentTraits>`
- `CGAL::Arr_circle_segment_traits_2<Kernel>`
- `CGAL::Arr_line_arc_traits_2<CircularKernel>`
- `CGAL::Arr_circular_arc_traits_2<CircularKernel>`
- `CGAL::Arr_circular_line_arc_traits_2<CircularKernel>`
- `CGAL::Arr_conic_traits_2<RatKernel,AlgKernel,NtTraits>`
- `CGAL::Arr_point_location_result<Arrangement>`
- `CGAL::Arr_rational_function_traits_2<AlgebraicKernel_d_1>`
- `CGAL::Arr_Bezier_curve_traits_2<RatKernel,AlgKernel,NtTraits>`
- `CGAL::Arr_algebraic_segment_traits_2<Coefficient>`
- `CGAL::Arr_geodesic_arc_on_sphere_traits_2<Kernel,x,y>`
- `CGAL::Arr_curve_data_traits_2<Tr,XData,Mrg,CData,Cnv>`
- `CGAL::Arr_consolidated_curve_data_traits_2<Traits,Data>`
- `CGAL::Arr_segment_traits_2<Kernel>`
- `CGAL::Arr_spherical_topology_traits_2<GeometryTraits_2,Dcel>`
- `CGAL::Arr_text_formatter<Arrangement>`
- `CGAL::Arr_face_extended_text_formatter<Arrangement>`
- `CGAL::Arr_extended_dcel_text_formatter<Arrangement>`
- `CGAL::Arr_with_history_text_formatter<ArrFormatter>`
- `CGAL::Arr_naive_point_location<Arrangement>`
- `CGAL::Arr_walk_along_line_point_location<Arrangement>`
- `CGAL::Arr_tracing_traits_2<BaseTraits>`
- `CGAL::Arr_trapezoid_ric_point_location<Arrangement>`
- `CGAL::Arr_landmarks_point_location<Arrangement,Generator>`
- `CGAL::Arr_vertex_index_map<Arrangement>`
- `CGAL::Arr_face_index_map<Arrangement>`
- `CGAL::Arr_point_location_result<Arrangement>`
- `CGAL::Arr_bounded_planar_topology_traits_2<GeometryTraits_2,Dcel>`
- `CGAL::Arr_unb_planar_topology_traits_2<GeometryTraits_2,Dcel>`
- `CGAL::Arr_spherical_topology_traits_2<GeometryTraits_2,Dcel>`
- `CGAL::Arr_vertex_index_map<Arrangement>`
- `CGAL::Arr_walk_along_line_point_location<Arrangement>`
- `CGAL::Arr_with_history_text_formatter<ArrFormatter>`
- `CGAL::Aos_observer<ArrangementOnSurface_2>`
- `CGAL::CORE_algebraic_number_traits`

\cgalCRPSection{Functions}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
\example Arrangement_on_surface_2/conics.cpp
\example Arrangement_on_surface_2/conic_multiplicities.cpp
\example Arrangement_on_surface_2/consolidated_curve_data.cpp
\example Arrangement_on_surface_2/count_and_trace.cpp
\example Arrangement_on_surface_2/curve_history.cpp
\example Arrangement_on_surface_2/dcel_extension.cpp
\example Arrangement_on_surface_2/dcel_extension_io.cpp
Expand Down
Loading
Loading