From 0bc40dcdc63de75697ac81a7f6ce8a653740fd8f Mon Sep 17 00:00:00 2001 From: Sven Oesau Date: Thu, 21 Mar 2024 15:14:57 +0100 Subject: [PATCH] moving AABB_traits_base and Remove_optional into separate files --- AABB_tree/include/CGAL/AABB_traits_2.h | 5 ++- AABB_tree/include/CGAL/AABB_traits_3.h | 28 ++---------- .../AABB_tree/internal/AABB_traits_base.h | 45 +++++++++++++++++++ .../CGAL/AABB_tree/internal/Remove_optional.h | 33 ++++++++++++++ 4 files changed, 84 insertions(+), 27 deletions(-) create mode 100644 AABB_tree/include/CGAL/AABB_tree/internal/AABB_traits_base.h create mode 100644 AABB_tree/include/CGAL/AABB_tree/internal/Remove_optional.h diff --git a/AABB_tree/include/CGAL/AABB_traits_2.h b/AABB_tree/include/CGAL/AABB_traits_2.h index 8ccc73fbcf3..a1136e492f6 100644 --- a/AABB_tree/include/CGAL/AABB_traits_2.h +++ b/AABB_tree/include/CGAL/AABB_traits_2.h @@ -21,11 +21,12 @@ #include #include #include +#include #include #include #include +#include #include -#include // for Remove_optional #include #include @@ -172,7 +173,7 @@ public: std::declval())) Intersection_type; typedef std::pair< - typename internal::AABB_tree::Remove_optional::type, + typename internal::Remove_optional::type, typename Primitive::Id > Type; }; diff --git a/AABB_tree/include/CGAL/AABB_traits_3.h b/AABB_tree/include/CGAL/AABB_traits_3.h index 97d1a156def..070e95eca38 100644 --- a/AABB_tree/include/CGAL/AABB_traits_3.h +++ b/AABB_tree/include/CGAL/AABB_traits_3.h @@ -21,9 +21,11 @@ #include #include #include +#include #include #include #include +#include #include #include @@ -35,30 +37,6 @@ namespace CGAL { namespace internal{ namespace AABB_tree { -template -struct Remove_optional { typedef T type; }; - -template -struct Remove_optional< ::std::optional > { typedef T type; }; - -//helper controlling whether extra data should be stored in the AABB_tree traits class -template ::value> -struct AABB_traits_base; - -template -struct AABB_traits_base{}; - -template -struct AABB_traits_base{ - typename Primitive::Shared_data m_primitive_data; - - template - void set_shared_data(T&& ... t){ - m_primitive_data=Primitive::construct_shared_data(std::forward(t)...); - } - const typename Primitive::Shared_data& shared_data() const {return m_primitive_data;} -}; - // AABB_traits_intersection_base brings in the Intersection_distance predicate, // if GeomTraits is a model RayIntersectionGeomTraits. template ::value> @@ -195,7 +173,7 @@ public: std::declval())) Intersection_type; typedef std::pair< - typename internal::AABB_tree::Remove_optional::type, + typename internal::Remove_optional::type, typename Primitive::Id > Type; }; diff --git a/AABB_tree/include/CGAL/AABB_tree/internal/AABB_traits_base.h b/AABB_tree/include/CGAL/AABB_tree/internal/AABB_traits_base.h new file mode 100644 index 00000000000..a7d0e3ebcac --- /dev/null +++ b/AABB_tree/include/CGAL/AABB_tree/internal/AABB_traits_base.h @@ -0,0 +1,45 @@ +// Copyright (c) 2024 INRIA Sophia-Antipolis (France). +// 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) : Stéphane Tayeb, Pierre Alliez, Camille Wormser +// + +#include + +#ifndef CGAL_AABB_TRAITS_BASE_H +#define CGAL_AABB_TRAITS_BASE_H + +namespace CGAL { +namespace internal { +namespace AABB_tree { + +//helper controlling whether extra data should be stored in the AABB_tree traits class +template ::value> +struct AABB_traits_base; + +template +struct AABB_traits_base {}; + +template +struct AABB_traits_base { + typename Primitive::Shared_data m_primitive_data; + + template + void set_shared_data(T&& ... t) { + m_primitive_data = Primitive::construct_shared_data(std::forward(t)...); + } + const typename Primitive::Shared_data& shared_data() const { return m_primitive_data; } +}; + +} +} +} + +#endif \ No newline at end of file diff --git a/AABB_tree/include/CGAL/AABB_tree/internal/Remove_optional.h b/AABB_tree/include/CGAL/AABB_tree/internal/Remove_optional.h new file mode 100644 index 00000000000..18657f179cf --- /dev/null +++ b/AABB_tree/include/CGAL/AABB_tree/internal/Remove_optional.h @@ -0,0 +1,33 @@ +// Copyright (c) 2024 INRIA Sophia-Antipolis (France). +// 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) : Stéphane Tayeb, Pierre Alliez, Camille Wormser +// + +#ifndef CGAL_REMOVE_OPTIONAL_H_ +#define CGAL_REMOVE_OPTIONAL_H_ + +#include +#include + + +namespace CGAL { +namespace internal { + +template +struct Remove_optional { typedef T type; }; + +template +struct Remove_optional< ::std::optional > { typedef T type; }; + +} // end namespace internal +} // end namespace CGAL + +#endif \ No newline at end of file