From 79532a059078bd18df45cee938aa0b52a2b40a39 Mon Sep 17 00:00:00 2001 From: Guillaume Damiand Date: Fri, 8 Apr 2022 10:16:35 +0200 Subject: [PATCH] Replace some nullptr by null_handle --- .../include/CGAL/Cell_attribute.h | 2 +- .../include/CGAL/Combinatorial_map.h | 46 +++++++++---------- .../Combinatorial_map_internal_functors.h | 20 ++++---- .../CGAL/Combinatorial_map_basic_operations.h | 4 +- .../include/CGAL/Combinatorial_map_functors.h | 4 +- .../CGAL/Combinatorial_map_save_load.h | 19 ++++---- 6 files changed, 50 insertions(+), 45 deletions(-) diff --git a/Combinatorial_map/include/CGAL/Cell_attribute.h b/Combinatorial_map/include/CGAL/Cell_attribute.h index 2876f9cb4e3..c2d44f5ba11 100644 --- a/Combinatorial_map/include/CGAL/Cell_attribute.h +++ b/Combinatorial_map/include/CGAL/Cell_attribute.h @@ -245,7 +245,7 @@ namespace CGAL { void set_dart(Dart_handle adart) { mdart = adart; } /// Test if the cell is valid. - /// A cell is valid if its dart is not nullptr. + /// A cell is valid if its dart is not null_handle. bool is_valid() const { return mdart!=Refs::null_handle; } diff --git a/Combinatorial_map/include/CGAL/Combinatorial_map.h b/Combinatorial_map/include/CGAL/Combinatorial_map.h index 07adac2573e..ce852285e8e 100644 --- a/Combinatorial_map/include/CGAL/Combinatorial_map.h +++ b/Combinatorial_map/include/CGAL/Combinatorial_map.h @@ -760,7 +760,7 @@ namespace CGAL { } /** Return a dart belonging to the same edge and to the second vertex - * of the current edge (nullptr if such a dart does not exist). + * of the current edge (null_handle if such a dart does not exist). * @return An handle to the opposite dart. */ Dart_handle opposite(Dart_handle dh) @@ -778,7 +778,7 @@ namespace CGAL { /** Return a dart incident to the other extremity of the current edge, * but contrary to opposite, non necessary to the same edge - * (nullptr if such a dart does not exist). + * (null_handle if such a dart does not exist). * @return An handle to the opposite dart. */ Dart_handle other_extremity(Dart_handle dh) @@ -1804,10 +1804,10 @@ namespace CGAL { else basic_link_beta_for_involution(adart1, adart2, i); } - /** Double link two darts, and update the nullptr attributes. + /** Double link two darts, and update the null_handle attributes. * \em adart1 is 0-linked to \em adart2 and \em adart2 is 1-linked - * with \em adart1. The nullptr attributes of \em adart1 are updated to - * non nullptr attributes associated to \em adart2, and vice-versa. + * with \em adart1. The null_handle attributes of \em adart1 are updated to + * non null_handle attributes associated to \em adart2, and vice-versa. * If both darts have an attribute, the attribute of adart1 is * associated to adart2. * We can obtain a non-valid map with darts belonging to a same cell @@ -1824,10 +1824,10 @@ namespace CGAL { this->template dart_link_beta<1>(adart2, adart1); } - /** Double link two darts, and update the nullptr attributes. + /** Double link two darts, and update the null_handle attributes. * \em adart1 is 1-linked to \em adart2 and \em adart2 is 0-linked - * with \em adart1. The nullptr attributes of \em adart1 are updated to - * non nullptr attributes associated to \em adart2, and vice-versa. + * with \em adart1. The null_handle attributes of \em adart1 are updated to + * non null_handle attributes associated to \em adart2, and vice-versa. * If both darts have an attribute, the attribute of adart1 is * associated to adart2. * We can obtain a non-valid map with darts belonging to a same cell @@ -1844,10 +1844,10 @@ namespace CGAL { this->template dart_link_beta<0>(adart2, adart1); } - /** Double link two darts, and update the nullptr attributes. + /** Double link two darts, and update the null_handle attributes. * \em adart1 is i-linked to \em adart2 and \em adart2 is i^-1-linked - * with \em adart1. The nullptr attributes of \em adart1 are updated to - * non nullptr attributes associated to \em adart2, and vice-versa. + * with \em adart1. The null_handle attributes of \em adart1 are updated to + * non null_handle attributes associated to \em adart2, and vice-versa. * If both darts have an attribute, the attribute of adart1 is * associated to adart2. * We can obtain a non-valid map with darts belonging to a same cell @@ -1868,10 +1868,10 @@ namespace CGAL { this->template dart_link_beta(adart2, adart1); } - /** Double link two darts, and update the nullptr attributes. + /** Double link two darts, and update the null_handle attributes. * \em adart1 is i-linked to \em adart2 and \em adart2 is i^-1-linked - * with \em adart1. The nullptr attributes of \em adart1 are updated to - * non nullptr attributes associated to \em adart2, and vice-versa. + * with \em adart1. The null_handle attributes of \em adart1 are updated to + * non null_handle attributes associated to \em adart2, and vice-versa. * If both darts have an attribute, the attribute of adart1 is * associated to adart2. * We can obtain a non-valid map with darts belonging to a same cell @@ -1893,8 +1893,8 @@ namespace CGAL { /** Double link a dart with betai to a second dart. * \em adart1 is i-linked to \em adart2 and \em adart2 is i^-1-linked - * with \em adart1. The nullptr attributes of \em adart1 are updated to - * non nullptr attributes associated to \em adart2, and vice-versa, + * with \em adart1. The null_handle attributes of \em adart1 are updated to + * non null_handle attributes associated to \em adart2, and vice-versa, * if both darts have an attribute, the attribute of adart1 is * associated to adart2 (only if update_attributes==true). * @param adart1 a first dart. @@ -3370,8 +3370,8 @@ namespace CGAL { /** Compute the dual of a Combinatorial_map. * @param amap the cmap in which we build the dual of this map. - * @param adart a dart of the initial map, nullptr by default. - * @return adart of the dual map, the dual of adart if adart!=nullptr, + * @param adart a dart of the initial map, null_handle by default. + * @return adart of the dual map, the dual of adart if adart!=null_handle, * any dart otherwise. * As soon as we don't modify this map and amap map, we can iterate * simultaneously through all the darts of the two maps and we have @@ -4055,7 +4055,7 @@ namespace CGAL { } /** Insert a vertex in a given edge. - * @param adart a dart of the edge (!=nullptr && !=null_dart_handle). + * @param adart a dart of the edge (!=null_handle && !=null_dart_handle). * @param update_attributes a boolean to update the enabled attributes * @return a dart of the new vertex. */ @@ -4301,7 +4301,7 @@ namespace CGAL { } /** Insert a dangling edge in a 2-cell between given by a dart. - * @param adart1 a first dart of the facet (!=nullptr && !=null_dart_handle). + * @param adart1 a first dart of the facet (!=null_handle && !=null_dart_handle). * @param update_attributes a boolean to update the enabled attributes * @return a dart of the new edge, not incident to the vertex of adart1. */ @@ -4371,7 +4371,7 @@ namespace CGAL { } } if (are_attributes_automatically_managed() && - update_attributes && ah!=nullptr) + update_attributes && ah!=null_handle) { internal::Set_i_attribute_of_dart_functor::run(*this, d1, ah); } @@ -4417,8 +4417,8 @@ namespace CGAL { } /** Insert an edge in a 2-cell between two given darts. - * @param adart1 a first dart of the facet (!=nullptr && !=null_dart_handle). - * @param adart2 a second dart of the facet. If nullptr insert a dangling edge. + * @param adart1 a first dart of the facet (!=null_handle && !=null_dart_handle). + * @param adart2 a second dart of the facet. If null_handle insert a dangling edge. * @param update_attributes a boolean to update the enabled attributes * @return a dart of the new edge, and not incident to the * same vertex than adart1. diff --git a/Combinatorial_map/include/CGAL/Combinatorial_map/internal/Combinatorial_map_internal_functors.h b/Combinatorial_map/include/CGAL/Combinatorial_map/internal/Combinatorial_map_internal_functors.h index 21ea9c70175..46592f6d634 100644 --- a/Combinatorial_map/include/CGAL/Combinatorial_map/internal/Combinatorial_map_internal_functors.h +++ b/Combinatorial_map/include/CGAL/Combinatorial_map/internal/Combinatorial_map_internal_functors.h @@ -75,7 +75,7 @@ * internal::Reverse_orientation_of_connected_component_functor to reverse * the orientation of a connected component in a cmap * - * internal::Init_attribute_functor to initialize all attributes to nullptr. + * internal::Init_attribute_functor to initialize all attributes to null_handle. * * internal::Correct_invalid_attributes_functor to correct the i-attribute * associated with a given i-cell @@ -274,14 +274,14 @@ struct Test_is_valid_attribute_functor if ( !amap.template is_valid_attribute(a) ) { std::cout<<"ERROR: the dart associated with an "<(a)!=amap.null_handle && !found_dart ) { - std::cout<<"ERROR: the non nullptr dart of an "< struct Init_attribute_functor { @@ -782,9 +782,12 @@ struct Reverse_orientation_of_map_functor CGAL_precondition(amap.is_whole_map_unmarked(mymark)); CGAL_precondition(amap.is_valid()); - typename CMap::Dart_handle first=nullptr, current=nullptr, prev=nullptr, next=nullptr; + typename CMap::Dart_handle first=amap.null_handle, + current=amap.null_handle, + prev=amap.null_handle, + next=amap.null_handle; typename CMap::Helper::template Attribute_handle<0>::type - first_attribute=nullptr, next_attribute=nullptr; + first_attribute=amap.null_handle, next_attribute=amap.null_handle; for (typename CMap::Dart_range::iterator current_dart=amap.darts().begin(), last_dart = amap.darts().end(); current_dart!=last_dart; @@ -876,9 +879,10 @@ struct Reverse_orientation_of_connected_component_functor typename CMap::size_type mymark = (amark==CMap::INVALID_MARK?amap.get_new_mark():amark); - typename CMap::Dart_handle first=nullptr, current=nullptr, prev=nullptr, next=nullptr; + typename CMap::Dart_handle first=amap.null_handle, current=amap.null_handle, + prev=amap.null_handle, next=amap.null_handle; typename CMap::Helper::template Attribute_handle<0>::type - first_attribute=nullptr, next_attribute=nullptr; + first_attribute=amap.null_handle, next_attribute=amap.null_handle; for (typename CMap::template Dart_of_cell_range::iterator current_dart=amap.template darts_of_cell diff --git a/Combinatorial_map/include/CGAL/Combinatorial_map_basic_operations.h b/Combinatorial_map/include/CGAL/Combinatorial_map_basic_operations.h index 6edc5e658cb..098a7227791 100644 --- a/Combinatorial_map/include/CGAL/Combinatorial_map_basic_operations.h +++ b/Combinatorial_map/include/CGAL/Combinatorial_map_basic_operations.h @@ -409,7 +409,7 @@ namespace CGAL typename Map::size_type degree(const Map & amap, typename Map::Dart_const_handle adart) { - CGAL_assertion(adart != nullptr); + CGAL_assertion(adart!=amap.null_handle); typename Map::size_type nbIncident = 0; typename Map::size_type mark; @@ -458,7 +458,7 @@ namespace CGAL typename Map::size_type codegree(const Map & amap, typename Map::Dart_const_handle adart) { - CGAL_assertion(adart != nullptr); + CGAL_assertion(adart!=amap.null_handle); typename Map::size_type nbIncident = 0; typename Map::size_type mark; diff --git a/Combinatorial_map/include/CGAL/Combinatorial_map_functors.h b/Combinatorial_map/include/CGAL/Combinatorial_map_functors.h index a1c5cf06196..6a9f7dbd6e9 100644 --- a/Combinatorial_map/include/CGAL/Combinatorial_map_functors.h +++ b/Combinatorial_map/include/CGAL/Combinatorial_map_functors.h @@ -72,8 +72,8 @@ struct Display_attribute_functor static void run(const CMap& amap, typename CMap::Dart_const_handle adart) { - if ( amap.template attribute(adart)==nullptr ) - std::cout<<"nullptr"; + if (amap.template attribute(adart)==amap.null_handle) + std::cout<<"null_handle"; else amap.template display_attribute(amap.template attribute(adart)); } diff --git a/Combinatorial_map/include/CGAL/Combinatorial_map_save_load.h b/Combinatorial_map/include/CGAL/Combinatorial_map_save_load.h index d5847071994..b19f96fcf7e 100644 --- a/Combinatorial_map/include/CGAL/Combinatorial_map_save_load.h +++ b/Combinatorial_map/include/CGAL/Combinatorial_map_save_load.h @@ -174,7 +174,7 @@ namespace CGAL { for (auto it=amap.template one_dart_per_cell().begin(), itend=amap.template one_dart_per_cell().end(); it!=itend; ++it) { - if (amap.template attribute(it)!=nullptr) + if (amap.template attribute(it)!=amap.null_handle) { // make composant, dart and property node boost::property_tree::ptree & nattr = ndim.add("a", ""); @@ -207,7 +207,7 @@ namespace CGAL { for (auto it=amap.template one_dart_per_cell().begin(), itend=amap.template one_dart_per_cell().end(); it!=itend; ++it) { - if (amap.template attribute(it)!=nullptr) + if (amap.template attribute(it)!=amap.null_handle) { // make composant, dart and property node boost::property_tree::ptree & nattr = ndim.add("a", ""); @@ -240,7 +240,7 @@ namespace CGAL { for (auto it=amap.template one_dart_per_cell().begin(), itend=amap.template one_dart_per_cell().end(); it!=itend; ++it) { - if (amap.template attribute(it)!=nullptr) + if (amap.template attribute(it)!=amap.null_handle) { // make composant, dart and property node boost::property_tree::ptree & nattr = ndim.add("a", ""); @@ -272,7 +272,7 @@ namespace CGAL { for (auto it=amap.template one_dart_per_cell().begin(), itend=amap.template one_dart_per_cell().end(); it!=itend; ++it) { - if (amap.template attribute(it)!=nullptr) + if (amap.template attribute(it)!=amap.null_handle) { // make composant, dart and property node boost::property_tree::ptree & nattr = ndim.add("a", ""); @@ -547,7 +547,7 @@ namespace CGAL { if( type==type_map && v2.first == "v" ) { if (amap.template attribute(myDarts[id_dart_cellule]) - ==nullptr ) + ==amap.null_handle ) amap.template set_attribute (myDarts[id_dart_cellule], amap.template create_attribute()); @@ -558,7 +558,7 @@ namespace CGAL { if( ptype==ptype_map && v2.first == "p" ) { if (amap.template attribute(myDarts[id_dart_cellule]) - ==nullptr ) + ==amap.null_handle ) amap.template set_attribute (myDarts[id_dart_cellule], amap.template create_attribute()); @@ -618,7 +618,7 @@ namespace CGAL { if( v2.first == "p" ) { if (amap.template attribute - (myDarts[id_dart_cellule])==nullptr ) + (myDarts[id_dart_cellule])==amap.null_handle ) amap.template set_attribute (myDarts[id_dart_cellule], amap.template create_attribute()); @@ -679,7 +679,7 @@ namespace CGAL { if( v2.first == "v" ) { if (amap.template attribute - (myDarts[id_dart_cellule])==nullptr) + (myDarts[id_dart_cellule])==amap.null_handle) amap.template set_attribute (myDarts[id_dart_cellule], amap.template create_attribute()); @@ -723,7 +723,8 @@ namespace CGAL { { id_dart_cellule=v1.second.get("d")-1; - if (amap.template attribute(myDarts[id_dart_cellule])==nullptr) + if (amap.template attribute(myDarts[id_dart_cellule])== + amap.null_handle) amap.template set_attribute (myDarts[id_dart_cellule], amap.template create_attribute());