Replace some nullptr by null_handle

This commit is contained in:
Guillaume Damiand 2022-04-08 10:16:35 +02:00
parent aefe5fb123
commit 79532a0590
6 changed files with 50 additions and 45 deletions

View File

@ -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; }

View File

@ -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<i>(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<Self, 0>::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.

View File

@ -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<i>(a) )
{
std::cout<<"ERROR: the dart associated with an "<<i
<<"-attribute is nullptr for dart ";
<<"-attribute is null_handle for dart ";
amap.display_dart(adart); std::cout<<std::endl;
valid=false;
}
if ( amap.template dart_of_attribute<i>(a)!=amap.null_handle &&
!found_dart )
{
std::cout<<"ERROR: the non nullptr dart of an "<<i
std::cout<<"ERROR: the non null_handle dart of an "<<i
<<"-attribute does not belong to the cell."<<std::endl;
valid=false;
}
@ -490,7 +490,7 @@ struct Restricted_decrease_attribute_functor
run(amap, adart); }
};
// ****************************************************************************
/// Functor used to initialize all attributes to nullptr.
/// Functor used to initialize all attributes to null_handle.
template<typename CMap>
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<CMap::dimension+1>::iterator
current_dart=amap.template darts_of_cell<CMap::dimension+1>

View File

@ -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;

View File

@ -72,8 +72,8 @@ struct Display_attribute_functor
static void run(const CMap& amap,
typename CMap::Dart_const_handle adart)
{
if ( amap.template attribute<i>(adart)==nullptr )
std::cout<<"nullptr";
if (amap.template attribute<i>(adart)==amap.null_handle)
std::cout<<"null_handle";
else
amap.template display_attribute<i>(amap.template attribute<i>(adart));
}

View File

@ -174,7 +174,7 @@ namespace CGAL {
for (auto it=amap.template one_dart_per_cell<i>().begin(),
itend=amap.template one_dart_per_cell<i>().end(); it!=itend; ++it)
{
if (amap.template attribute<i>(it)!=nullptr)
if (amap.template attribute<i>(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<i>().begin(),
itend=amap.template one_dart_per_cell<i>().end(); it!=itend; ++it)
{
if (amap.template attribute<i>(it)!=nullptr)
if (amap.template attribute<i>(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<i>().begin(),
itend=amap.template one_dart_per_cell<i>().end(); it!=itend; ++it)
{
if (amap.template attribute<i>(it)!=nullptr)
if (amap.template attribute<i>(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<i>().begin(),
itend=amap.template one_dart_per_cell<i>().end(); it!=itend; ++it)
{
if (amap.template attribute<i>(it)!=nullptr)
if (amap.template attribute<i>(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<i>(myDarts[id_dart_cellule])
==nullptr )
==amap.null_handle )
amap.template set_attribute<i>
(myDarts[id_dart_cellule],
amap.template create_attribute<i>());
@ -558,7 +558,7 @@ namespace CGAL {
if( ptype==ptype_map && v2.first == "p" )
{
if (amap.template attribute<i>(myDarts[id_dart_cellule])
==nullptr )
==amap.null_handle )
amap.template set_attribute<i>
(myDarts[id_dart_cellule],
amap.template create_attribute<i>());
@ -618,7 +618,7 @@ namespace CGAL {
if( v2.first == "p" )
{
if (amap.template attribute<i>
(myDarts[id_dart_cellule])==nullptr )
(myDarts[id_dart_cellule])==amap.null_handle )
amap.template set_attribute<i>
(myDarts[id_dart_cellule],
amap.template create_attribute<i>());
@ -679,7 +679,7 @@ namespace CGAL {
if( v2.first == "v" )
{
if (amap.template attribute<i>
(myDarts[id_dart_cellule])==nullptr)
(myDarts[id_dart_cellule])==amap.null_handle)
amap.template set_attribute<i>
(myDarts[id_dart_cellule],
amap.template create_attribute<i>());
@ -723,7 +723,8 @@ namespace CGAL {
{
id_dart_cellule=v1.second.get<unsigned int>("d")-1;
if (amap.template attribute<i>(myDarts[id_dart_cellule])==nullptr)
if (amap.template attribute<i>(myDarts[id_dart_cellule])==
amap.null_handle)
amap.template set_attribute<i>
(myDarts[id_dart_cellule],
amap.template create_attribute<i>());