Merge pull request #7752 from gdamiand/CMap_with_index-add_missing_functions-gdamiand

Add missing functions capacity and upper bound in dart_range for cmap and lcc with index
This commit is contained in:
Laurent Rineau 2023-10-16 11:13:12 +02:00
commit 0bf60c9318
2 changed files with 26 additions and 18 deletions

View File

@ -148,6 +148,10 @@ namespace CGAL {
{ return mmap.mdarts.is_used(i); } { return mmap.mdarts.is_used(i); }
bool owns(size_type i) const bool owns(size_type i) const
{ return mmap.mdarts.owns(i); } { return mmap.mdarts.owns(i); }
size_type capacity() const
{ return mmap.mdarts.capacity(); }
size_type upper_bound() const
{ return mmap.mdarts.upper_bound(); }
private: private:
Self & mmap; Self & mmap;
}; };
@ -444,7 +448,7 @@ namespace CGAL {
(mattribute_containers).upper_bound(); (mattribute_containers).upper_bound();
} }
protected: protected:
// Set the handle on the i th attribute // Set the handle on the i th attribute
template<unsigned int i> template<unsigned int i>
void basic_set_dart_attribute(Dart_descriptor dh, void basic_set_dart_attribute(Dart_descriptor dh,

View File

@ -99,14 +99,14 @@ namespace CGAL {
{}; {};
template<int i> template<int i>
struct Attribute_const_descriptor: struct Attribute_const_descriptor:
public Helper::template Attribute_const_descriptor<i> public Helper::template Attribute_const_descriptor<i>
{}; {};
template<int i> template<int i>
struct Attribute_range: public Helper::template Attribute_range<i> struct Attribute_range: public Helper::template Attribute_range<i>
{}; {};
template<int i> template<int i>
struct Attribute_const_range: struct Attribute_const_range:
public Helper::template Attribute_const_range<i> public Helper::template Attribute_const_range<i>
{}; {};
typedef typename Attribute_type<0>::type Vertex_attribute; typedef typename Attribute_type<0>::type Vertex_attribute;
@ -169,6 +169,10 @@ namespace CGAL {
{ return mmap.mdarts.is_used(i); } { return mmap.mdarts.is_used(i); }
bool owns(size_type i) const bool owns(size_type i) const
{ return mmap.mdarts.owns(i); } { return mmap.mdarts.owns(i); }
size_type capacity() const
{ return mmap.mdarts.capacity(); }
size_type upper_bound() const
{ return mmap.mdarts.upper_bound(); }
private: private:
Self & mmap; Self & mmap;
}; };
@ -202,7 +206,7 @@ namespace CGAL {
* @return true iff the map is empty. * @return true iff the map is empty.
*/ */
bool is_empty() const bool is_empty() const
{ return darts().empty(); } { return darts().empty(); }
/// @return the number of darts. /// @return the number of darts.
size_type number_of_darts() const size_type number_of_darts() const
@ -288,18 +292,18 @@ namespace CGAL {
typename Attribute_descriptor<i>::type attribute(Dart_descriptor ADart) typename Attribute_descriptor<i>::type attribute(Dart_descriptor ADart)
{ {
static_assert(Helper::template Dimension_index<i>::value>=0, static_assert(Helper::template Dimension_index<i>::value>=0,
"attribute<i> called but i-attributes are disabled."); "attribute<i> called but i-attributes are disabled.");
return std::get<Helper::template Dimension_index<i>::value> return std::get<Helper::template Dimension_index<i>::value>
(mdarts[ADart].mattribute_descriptors); (mdarts[ADart].mattribute_descriptors);
} }
template<unsigned int i> template<unsigned int i>
typename Attribute_const_descriptor<i>::type typename Attribute_const_descriptor<i>::type
attribute(Dart_const_descriptor ADart) const attribute(Dart_const_descriptor ADart) const
{ {
static_assert(Helper::template Dimension_index<i>::value>=0, static_assert(Helper::template Dimension_index<i>::value>=0,
"attribute<i> called but i-attributes are disabled."); "attribute<i> called but i-attributes are disabled.");
return std::get<Helper::template Dimension_index<i>::value> return std::get<Helper::template Dimension_index<i>::value>
(mdarts[ADart].mattribute_descriptors); (mdarts[ADart].mattribute_descriptors);
} }
// Copy a given attribute // Copy a given attribute
@ -360,7 +364,7 @@ namespace CGAL {
{ {
CGAL_assertion( ah!=null_descriptor ); CGAL_assertion( ah!=null_descriptor );
return std::get<Helper::template Dimension_index<i>::value> return std::get<Helper::template Dimension_index<i>::value>
(mattribute_containers)[ah]; (mattribute_containers)[ah];
} }
template<unsigned int i> template<unsigned int i>
const typename Attribute_type<i>::type& const typename Attribute_type<i>::type&
@ -368,7 +372,7 @@ namespace CGAL {
{ {
CGAL_assertion( ah!=null_descriptor ); CGAL_assertion( ah!=null_descriptor );
return std::get<Helper::template Dimension_index<i>::value> return std::get<Helper::template Dimension_index<i>::value>
(mattribute_containers)[ah]; (mattribute_containers)[ah];
} }
// Get the dart of the given attribute // Get the dart of the given attribute
@ -486,14 +490,14 @@ namespace CGAL {
typename Attribute_descriptor<i>::type ah) typename Attribute_descriptor<i>::type ah)
{ {
std::get<Helper::template Dimension_index<i>::value> std::get<Helper::template Dimension_index<i>::value>
(mdarts[dh].mattribute_descriptors) = ah; (mdarts[dh].mattribute_descriptors) = ah;
} }
/** Link a dart with a given dart for a given dimension. /** Link a dart with a given dart for a given dimension.
* @param adart the dart to link. * @param adart the dart to link.
* @param adart2 the dart to link with. * @param adart2 the dart to link with.
* @param i the dimension. * @param i the dimension.
*/ */
template<unsigned int i> template<unsigned int i>
void dart_link_beta(Dart_descriptor adart, Dart_descriptor adart2) void dart_link_beta(Dart_descriptor adart, Dart_descriptor adart2)
{ {
@ -509,9 +513,9 @@ namespace CGAL {
} }
/** Unlink a dart for a given dimension. /** Unlink a dart for a given dimension.
* @param adart a dart. * @param adart a dart.
* @param i the dimension. * @param i the dimension.
*/ */
template<unsigned int i> template<unsigned int i>
void dart_unlink_beta(Dart_descriptor adart) void dart_unlink_beta(Dart_descriptor adart)
{ {