mirror of https://github.com/CGAL/cgal
Update
This commit is contained in:
parent
d95ed10d76
commit
c4090eb218
|
|
@ -9,13 +9,14 @@ struct Myitem
|
|||
template<class CMap>
|
||||
struct Dart_wrapper
|
||||
{
|
||||
typedef CGAL::Cell_attribute<CMap, double> Face_attribute; // A weight
|
||||
typedef CGAL::Index::Cell_attribute<CMap, double> Face_attribute; // A weight
|
||||
typedef std::tuple<void,void,Face_attribute> Attributes;
|
||||
};
|
||||
};
|
||||
|
||||
// Definition of my combinatorial map.
|
||||
typedef CGAL::Combinatorial_map<3,Myitem> CMap_3;
|
||||
//typedef CGAL::Combinatorial_map<3,Myitem> CMap_3;
|
||||
typedef CGAL::Index::Combinatorial_map<3,Myitem> CMap_3;
|
||||
typedef CMap_3::Dart_handle Dart_handle;
|
||||
typedef CMap_3::Attribute_type<2>::type Face_attribute;
|
||||
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@
|
|||
#include <CGAL/tags.h>
|
||||
#include <CGAL/assertions.h>
|
||||
#include <cstddef>
|
||||
#include <CGAL/Info_for_cell_attribute.h>
|
||||
#include <CGAL/Cell_attribute_with_index.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
|
|
@ -47,32 +49,6 @@ namespace CGAL {
|
|||
* Definition of cell attribute, with or without info.
|
||||
*/
|
||||
|
||||
/// Info associated with a cell_attribute.
|
||||
template <typename Info>
|
||||
class Info_for_cell_attribute
|
||||
{
|
||||
public:
|
||||
/// Contructor without parameter.
|
||||
Info_for_cell_attribute()
|
||||
{}
|
||||
|
||||
/// Contructor with an info in parameter.
|
||||
Info_for_cell_attribute(const Info& ainfo) : minfo(ainfo)
|
||||
{}
|
||||
|
||||
/// Get the info associated with the cell_attribute.
|
||||
Info& info()
|
||||
{ return minfo; }
|
||||
|
||||
/// Get the info associated with the cell_attribute.
|
||||
const Info& info() const
|
||||
{ return minfo; }
|
||||
|
||||
protected:
|
||||
/// The info associated with the cell_attribute.
|
||||
Info minfo;
|
||||
};
|
||||
|
||||
/// Id associated with a cell attribute
|
||||
template <class WithId>
|
||||
class Add_id
|
||||
|
|
@ -380,57 +356,6 @@ namespace CGAL {
|
|||
template<unsigned int, class, class, class>
|
||||
friend class Generalized_map_storage_1;
|
||||
|
||||
template <class, class, class, class>
|
||||
friend class Compact_container;
|
||||
|
||||
public:
|
||||
typedef Cell_attribute<Refs, Info_, Tag_, OnMerge, OnSplit> Self;
|
||||
|
||||
typedef Tag_ Supports_cell_dart;
|
||||
typedef typename Refs::Dart_handle Dart_handle;
|
||||
typedef typename Refs::Dart_const_handle Dart_const_handle;
|
||||
typedef typename Refs::Alloc Alloc;
|
||||
typedef OnMerge On_merge;
|
||||
typedef OnSplit On_split;
|
||||
typedef Info_ Info;
|
||||
|
||||
bool operator==(const Self& other) const
|
||||
{ return this->info()==other.info(); }
|
||||
|
||||
bool operator!=(const Self& other) const
|
||||
{ return !operator==(other); }
|
||||
|
||||
|
||||
// protected:
|
||||
/// Default contructor.
|
||||
Cell_attribute()
|
||||
{}
|
||||
|
||||
/// Contructor with an info in parameter.
|
||||
Cell_attribute(const Info_& ainfo) :
|
||||
Info_for_cell_attribute<Info_>(ainfo)
|
||||
{}
|
||||
};
|
||||
|
||||
namespace Index
|
||||
{
|
||||
// Versions to use with containers using index
|
||||
/// Cell_attribute_without_info
|
||||
template <class Refs, class Tag=Tag_true, class OnMerge=Null_functor,
|
||||
class OnSplit=Null_functor>
|
||||
class Cell_attribute_without_info;
|
||||
|
||||
// Cell_attribute_without_info without dart support.
|
||||
template <class Refs, class OnMerge, class OnSplit>
|
||||
class Cell_attribute_without_info<Refs, Tag_false,
|
||||
OnMerge, OnSplit>
|
||||
{
|
||||
template < unsigned int, class, class, class, class >
|
||||
friend class Combinatorial_map_base;
|
||||
|
||||
template < unsigned int, class, class, class, class >
|
||||
friend class Generalized_map_base;
|
||||
|
||||
template<unsigned int, unsigned int, class, class, class, class>
|
||||
friend class CMap_linear_cell_complex_storage_1;
|
||||
|
||||
|
|
@ -438,233 +363,7 @@ namespace CGAL {
|
|||
friend class GMap_linear_cell_complex_storage_1;
|
||||
|
||||
template <class, class, class, class>
|
||||
friend class Compact_container_with_index;
|
||||
|
||||
public:
|
||||
typedef Tag_false Supports_cell_dart;
|
||||
|
||||
typedef typename Refs::Dart_handle Dart_handle;
|
||||
typedef typename Refs::Dart_const_handle Dart_const_handle;
|
||||
typedef typename Refs::Alloc Alloc;
|
||||
|
||||
typedef OnMerge On_merge;
|
||||
typedef OnSplit On_split;
|
||||
|
||||
/// operator =
|
||||
Cell_attribute_without_info&
|
||||
operator=(const Cell_attribute_without_info& acell)
|
||||
{
|
||||
mrefcounting = acell.mrefcounting;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/// Get the dart associated with the cell.
|
||||
Dart_handle dart() { return Refs::null_handle; }
|
||||
|
||||
/// Get the dart associated with the cell.
|
||||
Dart_const_handle dart() const { return Refs::null_handle; }
|
||||
|
||||
/// Set the dart associated with the cell.
|
||||
void set_dart(Dart_handle) {}
|
||||
|
||||
/// Test if the cell is valid.
|
||||
/// For cell without dart, return always true.
|
||||
bool is_valid() const
|
||||
{ return true; }
|
||||
|
||||
bool operator==(const Cell_attribute_without_info&) const
|
||||
{ return true; }
|
||||
|
||||
bool operator!=(const Cell_attribute_without_info& other) const
|
||||
{ return !operator==(other); }
|
||||
|
||||
// protected:
|
||||
/// Contructor without parameter.
|
||||
Cell_attribute_without_info(): mrefcounting(0)
|
||||
{}
|
||||
|
||||
/// Copy contructor.
|
||||
Cell_attribute_without_info
|
||||
(const Cell_attribute_without_info& acell):
|
||||
mrefcounting(acell.mrefcounting)
|
||||
{}
|
||||
|
||||
protected:
|
||||
/// Increment the reference counting.
|
||||
void inc_nb_refs()
|
||||
{ ++mrefcounting; }
|
||||
|
||||
/// Decrement the reference counting.
|
||||
void dec_nb_refs()
|
||||
{
|
||||
CGAL_assertion( mrefcounting>0 );
|
||||
--mrefcounting;
|
||||
}
|
||||
|
||||
public:
|
||||
/// Get the reference counting.
|
||||
typename Refs::size_type get_nb_refs() const
|
||||
{ return mrefcounting; }
|
||||
|
||||
typename Refs::size_type for_compact_container_with_index() const
|
||||
{ return mrefcounting; }
|
||||
typename Refs::size_type & for_compact_container_with_index()
|
||||
{ return mrefcounting; }
|
||||
|
||||
private:
|
||||
/// Reference counting: the number of darts linked to this cell.
|
||||
typename Refs::size_type mrefcounting;
|
||||
};
|
||||
|
||||
/** Definition of cell attribute.
|
||||
* Cell_attribute defines what is a a cell. This is an object allowing to
|
||||
* link to a dart of the cell (when T is true).
|
||||
* The refs class must provide the type of Combinatorial_map used.
|
||||
*/
|
||||
template <class Refs, class OnMerge, class OnSplit>
|
||||
class Cell_attribute_without_info<Refs, Tag_true,
|
||||
OnMerge, OnSplit>
|
||||
{
|
||||
template < unsigned int, class, class, class, class >
|
||||
friend class Combinatorial_map_base;
|
||||
|
||||
template < unsigned int, class, class, class, class >
|
||||
friend class Generalized_map_base;
|
||||
|
||||
template <class, class, class, class>
|
||||
friend class Compact_container_with_index;
|
||||
|
||||
public:
|
||||
typedef Tag_true Supports_cell_dart;
|
||||
|
||||
typedef typename Refs::Dart_handle Dart_handle;
|
||||
typedef typename Refs::Dart_const_handle Dart_const_handle;
|
||||
typedef typename Refs::Alloc Alloc;
|
||||
|
||||
typedef OnMerge On_merge;
|
||||
typedef OnSplit On_split;
|
||||
|
||||
/// operator =
|
||||
Cell_attribute_without_info&
|
||||
operator=(const Cell_attribute_without_info& acell)
|
||||
{
|
||||
mdart = acell.mdart;
|
||||
mrefcounting = acell.mrefcounting;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/// Get the dart associated with the cell.
|
||||
Dart_handle dart() { return mdart; }
|
||||
|
||||
/// Get the dart associated with the cell.
|
||||
Dart_const_handle dart() const { return mdart; }
|
||||
|
||||
/// Set the dart associated with the cell.
|
||||
void set_dart(Dart_handle adart) { mdart = adart; }
|
||||
|
||||
/// Test if the cell is valid.
|
||||
/// A cell is valid if its dart is not NULL.
|
||||
bool is_valid() const
|
||||
{ return mdart!=Refs::null_handle; }
|
||||
|
||||
bool operator==(const Cell_attribute_without_info&) const
|
||||
{ return true; }
|
||||
|
||||
bool operator!=(const Cell_attribute_without_info& other) const
|
||||
{ return !operator==(other); }
|
||||
|
||||
// protected:
|
||||
/// Contructor without parameter.
|
||||
Cell_attribute_without_info() : mdart(Refs::null_handle),
|
||||
mrefcounting(0)
|
||||
{}
|
||||
|
||||
/// Copy contructor.
|
||||
Cell_attribute_without_info
|
||||
(const Cell_attribute_without_info& acell):
|
||||
mdart(acell.mdart),
|
||||
mrefcounting(acell.mrefcounting)
|
||||
{}
|
||||
|
||||
protected:
|
||||
/// Increment the reference counting.
|
||||
void inc_nb_refs()
|
||||
{ ++mrefcounting; }
|
||||
|
||||
/// Decrement the reference counting.
|
||||
void dec_nb_refs()
|
||||
{
|
||||
CGAL_assertion( mrefcounting>0 );
|
||||
--mrefcounting;
|
||||
}
|
||||
|
||||
public:
|
||||
/// Get the reference counting.
|
||||
typename Refs::size_type get_nb_refs() const
|
||||
{ return mrefcounting; }
|
||||
|
||||
typename Refs::size_type for_compact_container_with_index() const
|
||||
{ return mdart.for_compact_container_with_index(); }
|
||||
typename Refs::size_type & for_compact_container_with_index()
|
||||
{ return mdart.for_compact_container_with_index(); }
|
||||
|
||||
private:
|
||||
/// Reference counting: the number of darts linked to this cell.
|
||||
std::size_t mrefcounting;
|
||||
|
||||
/// The dart handle associated with the cell.
|
||||
Dart_handle mdart;
|
||||
};
|
||||
|
||||
/// Cell associated with an attribute, with or without info depending
|
||||
/// if Info==void.
|
||||
template <class Refs, class Info_=void, class Tag_=Tag_true,
|
||||
class OnMerge=Null_functor,
|
||||
class OnSplit=Null_functor>
|
||||
class Cell_attribute;
|
||||
|
||||
/// Specialization when Info==void.
|
||||
template <class Refs, class Tag_,
|
||||
class OnMerge, class OnSplit>
|
||||
class Cell_attribute<Refs, void, Tag_,
|
||||
OnSplit, OnMerge> :
|
||||
public Cell_attribute_without_info<Refs, Tag_,
|
||||
OnSplit, OnMerge>
|
||||
{
|
||||
template < unsigned int, class, class, class, class >
|
||||
friend class Combinatorial_map_base;
|
||||
|
||||
template <class, class, class, class>
|
||||
friend class Compact_container_with_index;
|
||||
|
||||
public:
|
||||
typedef Tag_ Supports_cell_dart;
|
||||
typedef typename Refs::Dart_handle Dart_handle;
|
||||
typedef typename Refs::Dart_const_handle Dart_const_handle;
|
||||
typedef typename Refs::Alloc Alloc;
|
||||
typedef OnMerge On_merge;
|
||||
typedef OnSplit On_split;
|
||||
typedef void Info;
|
||||
|
||||
// protected:
|
||||
/// Default contructor.
|
||||
Cell_attribute()
|
||||
{}
|
||||
};
|
||||
|
||||
/// Specialization when Info!=void.
|
||||
template <class Refs, class Info_, class Tag_,
|
||||
class OnMerge, class OnSplit>
|
||||
class Cell_attribute :
|
||||
public Cell_attribute_without_info<Refs, Tag_,
|
||||
OnMerge, OnSplit>,
|
||||
public Info_for_cell_attribute<Info_>
|
||||
{
|
||||
template < unsigned int, class, class, class, class >
|
||||
friend class Combinatorial_map_base;
|
||||
|
||||
template <class, class, class, class>
|
||||
friend class Compact_container_with_index;
|
||||
friend class Compact_container;
|
||||
|
||||
template <class, class>
|
||||
friend class Concurrent_compact_container;
|
||||
|
|
@ -686,7 +385,8 @@ namespace CGAL {
|
|||
bool operator!=(const Self& other) const
|
||||
{ return !operator==(other); }
|
||||
|
||||
protected:
|
||||
|
||||
// protected:
|
||||
/// Default contructor.
|
||||
Cell_attribute()
|
||||
{}
|
||||
|
|
@ -696,7 +396,6 @@ namespace CGAL {
|
|||
Info_for_cell_attribute<Info_>(ainfo)
|
||||
{}
|
||||
};
|
||||
} // namespace Index
|
||||
|
||||
} // namespace CGAL
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,304 @@
|
|||
// Copyright (c) 2010-2011 CNRS and LIRIS' Establishments (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org)
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial
|
||||
//
|
||||
// Author(s) : Guillaume Damiand <guillaume.damiand@liris.cnrs.fr>
|
||||
//
|
||||
#ifndef CGAL_CELL_ATTRIBUTE_WITH_INDEX_H
|
||||
#define CGAL_CELL_ATTRIBUTE_WITH_INDEX_H 1
|
||||
|
||||
#include <CGAL/tags.h>
|
||||
#include <CGAL/assertions.h>
|
||||
#include <CGAL/Info_for_cell_attribute.h>
|
||||
#include <cstddef>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
template <class, class, class, class>
|
||||
class Compact_container_with_index_2;
|
||||
|
||||
template<unsigned int, class, class, class>
|
||||
class Combinatorial_map_storage_2;
|
||||
|
||||
namespace Index
|
||||
{
|
||||
// Versions to use with containers using index
|
||||
/// Cell_attribute_without_info
|
||||
template <class Refs, class Tag=Tag_true, class OnMerge=Null_functor,
|
||||
class OnSplit=Null_functor>
|
||||
class Cell_attribute_without_info;
|
||||
|
||||
// Cell_attribute_without_info without dart support.
|
||||
template <class Refs, class OnMerge, class OnSplit>
|
||||
class Cell_attribute_without_info<Refs, Tag_false,
|
||||
OnMerge, OnSplit>
|
||||
{
|
||||
template<unsigned int, class, class, class>
|
||||
friend class CGAL::Combinatorial_map_storage_2;
|
||||
|
||||
template <class, class, class, class>
|
||||
friend class CGAL::Compact_container_with_index_2;
|
||||
|
||||
public:
|
||||
typedef Tag_false Supports_cell_dart;
|
||||
|
||||
typedef typename Refs::Dart_handle Dart_handle;
|
||||
typedef typename Refs::Dart_const_handle Dart_const_handle;
|
||||
typedef typename Refs::Alloc Alloc;
|
||||
typedef CGAL::Tag_false Has_id;
|
||||
|
||||
typedef OnMerge On_merge;
|
||||
typedef OnSplit On_split;
|
||||
|
||||
/// operator =
|
||||
Cell_attribute_without_info&
|
||||
operator=(const Cell_attribute_without_info& acell)
|
||||
{
|
||||
mrefcounting = acell.mrefcounting;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/// Get the dart associated with the cell.
|
||||
Dart_handle dart() { return Refs::null_handle; }
|
||||
|
||||
/// Get the dart associated with the cell.
|
||||
Dart_const_handle dart() const { return Refs::null_handle; }
|
||||
|
||||
/// Set the dart associated with the cell.
|
||||
void set_dart(Dart_handle) {}
|
||||
|
||||
/// Test if the cell is valid.
|
||||
/// For cell without dart, return always true.
|
||||
bool is_valid() const
|
||||
{ return true; }
|
||||
|
||||
bool operator==(const Cell_attribute_without_info&) const
|
||||
{ return true; }
|
||||
|
||||
bool operator!=(const Cell_attribute_without_info& other) const
|
||||
{ return !operator==(other); }
|
||||
|
||||
// protected:
|
||||
/// Contructor without parameter.
|
||||
Cell_attribute_without_info(): mrefcounting(0)
|
||||
{}
|
||||
|
||||
/// Copy contructor.
|
||||
Cell_attribute_without_info
|
||||
(const Cell_attribute_without_info& acell):
|
||||
mrefcounting(acell.mrefcounting)
|
||||
{}
|
||||
|
||||
protected:
|
||||
/// Increment the reference counting.
|
||||
void inc_nb_refs()
|
||||
{ ++mrefcounting; }
|
||||
|
||||
/// Decrement the reference counting.
|
||||
void dec_nb_refs()
|
||||
{
|
||||
CGAL_assertion( mrefcounting>0 );
|
||||
--mrefcounting;
|
||||
}
|
||||
|
||||
public:
|
||||
/// Get the reference counting.
|
||||
typename Refs::size_type get_nb_refs() const
|
||||
{ return mrefcounting; }
|
||||
|
||||
typename Refs::size_type for_compact_container_with_index() const
|
||||
{ return mrefcounting; }
|
||||
typename Refs::size_type & for_compact_container_with_index()
|
||||
{ return mrefcounting; }
|
||||
|
||||
private:
|
||||
/// Reference counting: the number of darts linked to this cell.
|
||||
typename Refs::size_type mrefcounting;
|
||||
};
|
||||
|
||||
/** Definition of cell attribute.
|
||||
* Cell_attribute defines what is a a cell. This is an object allowing to
|
||||
* link to a dart of the cell (when T is true).
|
||||
* The refs class must provide the type of Combinatorial_map used.
|
||||
*/
|
||||
template <class Refs, class OnMerge, class OnSplit>
|
||||
class Cell_attribute_without_info<Refs, Tag_true,
|
||||
OnMerge, OnSplit>
|
||||
{
|
||||
template<unsigned int, class, class, class>
|
||||
friend class CGAL::Combinatorial_map_storage_2;
|
||||
|
||||
template <class, class, class, class>
|
||||
friend class CGAL::Compact_container_with_index;
|
||||
|
||||
public:
|
||||
typedef Tag_true Supports_cell_dart;
|
||||
|
||||
typedef typename Refs::Dart_handle Dart_handle;
|
||||
typedef typename Refs::Dart_const_handle Dart_const_handle;
|
||||
typedef typename Refs::Alloc Alloc;
|
||||
typedef CGAL::Tag_false Has_id;
|
||||
|
||||
typedef OnMerge On_merge;
|
||||
typedef OnSplit On_split;
|
||||
|
||||
/// operator =
|
||||
Cell_attribute_without_info&
|
||||
operator=(const Cell_attribute_without_info& acell)
|
||||
{
|
||||
mdart = acell.mdart;
|
||||
mrefcounting = acell.mrefcounting;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/// Get the dart associated with the cell.
|
||||
Dart_handle dart() { return mdart; }
|
||||
|
||||
/// Get the dart associated with the cell.
|
||||
Dart_const_handle dart() const { return mdart; }
|
||||
|
||||
/// Set the dart associated with the cell.
|
||||
void set_dart(Dart_handle adart) { mdart = adart; }
|
||||
|
||||
/// Test if the cell is valid.
|
||||
/// A cell is valid if its dart is not NULL.
|
||||
bool is_valid() const
|
||||
{ return mdart!=Refs::null_handle; }
|
||||
|
||||
bool operator==(const Cell_attribute_without_info&) const
|
||||
{ return true; }
|
||||
|
||||
bool operator!=(const Cell_attribute_without_info& other) const
|
||||
{ return !operator==(other); }
|
||||
|
||||
// protected:
|
||||
/// Contructor without parameter.
|
||||
Cell_attribute_without_info() : mdart(Refs::null_handle),
|
||||
mrefcounting(0)
|
||||
{}
|
||||
|
||||
/// Copy contructor.
|
||||
Cell_attribute_without_info
|
||||
(const Cell_attribute_without_info& acell):
|
||||
mdart(acell.mdart),
|
||||
mrefcounting(acell.mrefcounting)
|
||||
{}
|
||||
|
||||
protected:
|
||||
/// Increment the reference counting.
|
||||
void inc_nb_refs()
|
||||
{ ++mrefcounting; }
|
||||
|
||||
/// Decrement the reference counting.
|
||||
void dec_nb_refs()
|
||||
{
|
||||
CGAL_assertion( mrefcounting>0 );
|
||||
--mrefcounting;
|
||||
}
|
||||
|
||||
public:
|
||||
/// Get the reference counting.
|
||||
typename Refs::size_type get_nb_refs() const
|
||||
{ return mrefcounting; }
|
||||
|
||||
typename Refs::size_type for_compact_container_with_index() const
|
||||
{ return mdart.for_compact_container_with_index(); }
|
||||
typename Refs::size_type & for_compact_container_with_index()
|
||||
{ return mdart.for_compact_container_with_index(); }
|
||||
|
||||
private:
|
||||
/// Reference counting: the number of darts linked to this cell.
|
||||
std::size_t mrefcounting;
|
||||
|
||||
/// The dart handle associated with the cell.
|
||||
Dart_handle mdart;
|
||||
};
|
||||
|
||||
/// Cell associated with an attribute, with or without info depending
|
||||
/// if Info==void.
|
||||
template <class Refs, class Info_=void, class Tag_=Tag_true,
|
||||
class OnMerge=Null_functor,
|
||||
class OnSplit=Null_functor>
|
||||
class Cell_attribute;
|
||||
|
||||
/// Specialization when Info==void.
|
||||
template <class Refs, class Tag_,
|
||||
class OnMerge, class OnSplit>
|
||||
class Cell_attribute<Refs, void, Tag_,
|
||||
OnSplit, OnMerge> :
|
||||
public Cell_attribute_without_info<Refs, Tag_,
|
||||
OnSplit, OnMerge>
|
||||
{
|
||||
template < unsigned int, class, class, class, class >
|
||||
friend class CGAL::Combinatorial_map_base;
|
||||
|
||||
template <class, class, class, class>
|
||||
friend class CGAL::Compact_container_with_index_2;
|
||||
|
||||
public:
|
||||
typedef Tag_ Supports_cell_dart;
|
||||
typedef typename Refs::Dart_handle Dart_handle;
|
||||
typedef typename Refs::Dart_const_handle Dart_const_handle;
|
||||
typedef typename Refs::Alloc Alloc;
|
||||
typedef OnMerge On_merge;
|
||||
typedef OnSplit On_split;
|
||||
typedef void Info;
|
||||
|
||||
// protected:
|
||||
/// Default contructor.
|
||||
Cell_attribute()
|
||||
{}
|
||||
};
|
||||
|
||||
/// Specialization when Info!=void.
|
||||
template <class Refs, class Info_, class Tag_,
|
||||
class OnMerge, class OnSplit>
|
||||
class Cell_attribute :
|
||||
public Cell_attribute_without_info<Refs, Tag_,
|
||||
OnMerge, OnSplit>,
|
||||
public CGAL::Info_for_cell_attribute<Info_>
|
||||
{
|
||||
template < unsigned int, class, class, class, class >
|
||||
friend class CGAL::Combinatorial_map_base;
|
||||
|
||||
template <class, class, class, class>
|
||||
friend class CGAL::Compact_container_with_index_2;
|
||||
|
||||
public:
|
||||
typedef Cell_attribute<Refs, Info_, Tag_, OnMerge, OnSplit> Self;
|
||||
|
||||
typedef Tag_ Supports_cell_dart;
|
||||
typedef typename Refs::Dart_handle Dart_handle;
|
||||
typedef typename Refs::Dart_const_handle Dart_const_handle;
|
||||
typedef typename Refs::Alloc Alloc;
|
||||
typedef OnMerge On_merge;
|
||||
typedef OnSplit On_split;
|
||||
typedef Info_ Info;
|
||||
|
||||
bool operator==(const Self& other) const
|
||||
{ return this->info()==other.info(); }
|
||||
|
||||
bool operator!=(const Self& other) const
|
||||
{ return !operator==(other); }
|
||||
|
||||
protected:
|
||||
/// Default contructor.
|
||||
Cell_attribute()
|
||||
{}
|
||||
|
||||
/// Contructor with an info in parameter.
|
||||
Cell_attribute(const Info_& ainfo) :
|
||||
Info_for_cell_attribute<Info_>(ainfo)
|
||||
{}
|
||||
};
|
||||
} // namespace Index
|
||||
|
||||
} // namespace CGAL
|
||||
|
||||
#endif // CGAL_CELL_ATTRIBUTE_WITH_INDEX_H //
|
||||
// EOF //
|
||||
|
|
@ -24,6 +24,7 @@
|
|||
#include <CGAL/Combinatorial_map/internal/Combinatorial_map_sewable.h>
|
||||
|
||||
#include <CGAL/Combinatorial_map_storages.h>
|
||||
#include <CGAL/Combinatorial_map_storages_with_index.h>
|
||||
#include <CGAL/Combinatorial_map_functors.h>
|
||||
#include <CGAL/Combinatorial_map_basic_operations.h>
|
||||
#include <CGAL/Combinatorial_map_operations.h>
|
||||
|
|
@ -862,7 +863,7 @@ namespace CGAL {
|
|||
Helper::template Foreach_enabled_attributes
|
||||
<internal::Init_attribute_functor<Self> >::run(*this, adart);
|
||||
|
||||
internal::Init_id<Dart_container>::run(mdarts, adart);
|
||||
// TODO internal::Init_id<Dart_container>::run(mdarts, adart);
|
||||
}
|
||||
// Initialize a given dart: all beta to null_dart_handle and all
|
||||
// attributes to null, marks are given.
|
||||
|
|
|
|||
|
|
@ -496,7 +496,7 @@ struct Init_attribute_functor
|
|||
{
|
||||
template <int i>
|
||||
static void run(CMap& amap, typename CMap::Dart_handle adart)
|
||||
{ amap.template set_dart_attribute<i>(adart, CMap::null_handle); }
|
||||
{ amap.template set_dart_attribute<i>(adart, 0/* TODO CMap::null_handle*/); }
|
||||
};
|
||||
// ****************************************************************************
|
||||
/// Functor used to set the i-attribute of a given dart.
|
||||
|
|
@ -1039,7 +1039,8 @@ struct Init_id
|
|||
template<typename Container>
|
||||
struct Init_id<Container, Tag_false>
|
||||
{
|
||||
static void run(Container&, typename Container::iterator)
|
||||
template<class Index>
|
||||
static void run(Container&, Index)
|
||||
{}
|
||||
};
|
||||
// ****************************************************************************
|
||||
|
|
|
|||
|
|
@ -526,7 +526,8 @@ namespace CGAL
|
|||
{ typedef Void type; };
|
||||
|
||||
// Helper class allowing to retreive the d-cell-handle attribute
|
||||
template<int d, class Type=typename Attribute_type<d>::type>
|
||||
template<int d, class Type=typename Attribute_type<d>::type,
|
||||
typename WithIndex=typename CMap::Use_index>
|
||||
struct Attribute_handle
|
||||
{
|
||||
typedef typename std::tuple_element
|
||||
|
|
@ -534,10 +535,14 @@ namespace CGAL
|
|||
};
|
||||
|
||||
template<int d>
|
||||
struct Attribute_handle<d, CGAL::Void>
|
||||
struct Attribute_handle<d, CGAL::Void, CGAL::Tag_false>
|
||||
{ typedef CGAL::Void* type; };
|
||||
|
||||
// Helper class allowing to retreive the d-cell-const handle attribute
|
||||
template<int d>
|
||||
struct Attribute_handle<d, CGAL::Void, CGAL::Tag_true>
|
||||
{ typedef typename CMap::Dart_index type; };
|
||||
|
||||
// Helper class allowing to retreive the d-cell-const handle attribute
|
||||
template<int d, class Type=typename Attribute_type<d>::type>
|
||||
struct Attribute_const_handle
|
||||
{
|
||||
|
|
|
|||
|
|
@ -42,8 +42,8 @@ namespace CGAL {
|
|||
class Combinatorial_map_storage_1
|
||||
{
|
||||
public:
|
||||
typedef Combinatorial_map_storage_1<d_, Items_, Alloc_, Concurrent_tag> Self;
|
||||
typedef CGAL::Tag_false Use_index;
|
||||
using Self=Combinatorial_map_storage_1<d_, Items_, Alloc_, Concurrent_tag>;
|
||||
using Use_index=CGAL::Tag_false;
|
||||
|
||||
typedef internal::Combinatorial_map_helper<Self> Helper;
|
||||
|
||||
|
|
|
|||
|
|
@ -31,6 +31,14 @@ namespace CGAL {
|
|||
|
||||
template<typename Concurrent_tag, class T, class Alloc_>
|
||||
struct Container_type;
|
||||
|
||||
struct Index_hash_function {
|
||||
typedef std::size_t result_type;
|
||||
template <class H>
|
||||
std::size_t operator() (const H& h) const {
|
||||
return h;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Storage with combinatorial maps using index
|
||||
|
|
@ -38,59 +46,25 @@ namespace CGAL {
|
|||
class Combinatorial_map_storage_2
|
||||
{
|
||||
public:
|
||||
typedef Combinatorial_map_storage_2<d_, Items_, Alloc_, Index_type_> Self;
|
||||
typedef CGAL::Tag_true Use_index;
|
||||
using Self=Combinatorial_map_storage_2<d_, Items_, Alloc_, Index_type_>;
|
||||
using Use_index=CGAL::Tag_true;
|
||||
using Index_type=Index_type_;
|
||||
|
||||
typedef internal::Combinatorial_map_helper<Self> Helper;
|
||||
|
||||
typedef typename Items_::template Dart_wrapper<Self> Dart_wrapper;
|
||||
typedef typename Dart_wrapper::Dart Dart;
|
||||
typedef typename Alloc_::template rebind<Dart>::other Dart_allocator;
|
||||
|
||||
typedef Size_type size_type; // Type used as index.
|
||||
typedef typename internal::template Get_dart_info<Dart_wrapper>::type
|
||||
Dart_info;
|
||||
typedef CGAL::Index::Dart<d_, Self, Dart_info> Dart;
|
||||
|
||||
typedef std::allocator_traits<Alloc_> Allocator_traits;
|
||||
typedef typename Allocator_traits::template rebind_alloc<Dart> Dart_allocator;
|
||||
|
||||
typedef Compact_container_with_index_2<Dart,Dart_allocator,
|
||||
Constant_size_policy_for_cc_with_size<1024>, size_type >
|
||||
Constant_size_policy_for_cc_with_size<1024>, Index_type>
|
||||
Dart_container;
|
||||
|
||||
typedef Items_ Items;
|
||||
typedef Alloc_ Alloc;
|
||||
|
||||
template <typename T>
|
||||
struct Container_for_attributes : public
|
||||
Compact_container_with_index_2<T,
|
||||
typename Alloc_::template rebind<T>::other,
|
||||
Constant_size_policy_for_cc_with_size<1024>, size_type >
|
||||
{};
|
||||
|
||||
/// Typedef for attributes
|
||||
typedef typename Dart_wrapper::Attributes Attributes;
|
||||
|
||||
template<int i>
|
||||
struct Attribute_type: public Helper::template Attribute_type<i>
|
||||
{};
|
||||
template<int i>
|
||||
struct Attribute_handle: public Helper::template Attribute_handle<i>
|
||||
{};
|
||||
template<int i>
|
||||
struct Attribute_const_handle:
|
||||
public Helper::template Attribute_const_handle<i>
|
||||
{};
|
||||
template<int i>
|
||||
struct Attribute_range: public Helper::template Attribute_range<i>
|
||||
{};
|
||||
template<int i>
|
||||
struct Attribute_const_range:
|
||||
public Helper::template Attribute_const_range<i>
|
||||
{};
|
||||
|
||||
/// Number of marks
|
||||
static const size_type NB_MARKS = 32;
|
||||
|
||||
/// The dimension of the combinatorial map.
|
||||
static const unsigned int dimension = d_;
|
||||
|
||||
// typedef unsigned int Dart_index;
|
||||
// typedef MyIndex<unsigned int> Dart_index;
|
||||
typedef typename Dart_container::Index Dart_index;
|
||||
|
|
@ -98,12 +72,47 @@ namespace CGAL {
|
|||
// Definition of old types, for backward compatibility.
|
||||
typedef Dart_index Dart_handle;
|
||||
typedef Dart_index Dart_const_handle;
|
||||
typedef typename Dart_container::size_type size_type;
|
||||
|
||||
/// Value of null handle (!= null_dart_handle !!)
|
||||
typedef size_type Null_handle_type;
|
||||
static const size_type null_handle;
|
||||
typedef Dart_index Null_handle_type;
|
||||
static Null_handle_type null_handle;
|
||||
|
||||
typedef Index_hash_function Hash_function;
|
||||
typedef Items_ Items;
|
||||
typedef Alloc_ Alloc;
|
||||
template <typename T>
|
||||
struct Container_for_attributes : public
|
||||
Compact_container_with_index_2<T,
|
||||
typename Alloc_::template rebind<T>::other,
|
||||
Constant_size_policy_for_cc_with_size<1024>, size_type >
|
||||
{};
|
||||
|
||||
/// Typedef for attributes
|
||||
typedef typename internal::template Get_attributes_tuple<Dart_wrapper>::type
|
||||
Attributes;
|
||||
|
||||
template<int i>
|
||||
struct Attribute_type: public Helper::template Attribute_type<i>
|
||||
{};
|
||||
template<int i>
|
||||
struct Attribute_range
|
||||
{ using type=Container_for_attributes<typename Attribute_type<i>::type>; };
|
||||
template<int i>
|
||||
struct Attribute_const_range
|
||||
{ using type=const typename Attribute_range<i>::type; };
|
||||
template<int i>
|
||||
struct Attribute_handle
|
||||
{ using type=typename Attribute_range<i>::type::Index; };
|
||||
template<int i>
|
||||
struct Attribute_const_handle
|
||||
{ using type=const typename Attribute_range<i>::type::Index; };
|
||||
|
||||
/// Number of marks
|
||||
static const size_type NB_MARKS = 32;
|
||||
|
||||
/// The dimension of the combinatorial map.
|
||||
static const unsigned int dimension = d_;
|
||||
|
||||
typedef internal::Index_hash_function Hash_function;
|
||||
|
||||
//**************************************************************************
|
||||
// Dart_range
|
||||
|
|
@ -123,6 +132,8 @@ namespace CGAL {
|
|||
{ return mmap.mdarts.size()-1; }
|
||||
bool empty() const
|
||||
{ return mmap.is_empty(); }
|
||||
size_type index(const_iterator cit) const
|
||||
{ return cit; }
|
||||
private:
|
||||
Self & mmap;
|
||||
};
|
||||
|
|
@ -139,11 +150,14 @@ namespace CGAL {
|
|||
void init_storage()
|
||||
{
|
||||
// Allocate a dart for null_dart_handle
|
||||
null_dart_handle = mdarts.emplace();
|
||||
assert(mdarts.empty());
|
||||
Dart_index local_null_dart_handle = mdarts.emplace();
|
||||
CGAL_USE(local_null_dart_handle);
|
||||
assert(local_null_dart_handle==0);
|
||||
}
|
||||
|
||||
void clear_storage()
|
||||
{}
|
||||
{ mdarts.clear(); }
|
||||
|
||||
/** Test if the map is empty.
|
||||
* @return true iff the map is empty.
|
||||
|
|
@ -164,12 +178,12 @@ namespace CGAL {
|
|||
bool is_free(Dart_const_handle dh) const
|
||||
{
|
||||
CGAL_assertion(i <= dimension);
|
||||
return mdarts[dh].mbeta[i]==null_dart_handle;
|
||||
return mdarts[dh].mf[i]==null_dart_handle;
|
||||
}
|
||||
bool is_free(Dart_const_handle dh, unsigned int i) const
|
||||
{
|
||||
CGAL_assertion(i <= dimension);
|
||||
return mdarts[dh].mbeta[i]==null_dart_handle;
|
||||
return mdarts[dh].mf[i]==null_dart_handle;
|
||||
}
|
||||
|
||||
/// Set simultaneously all the marks of this dart to a given value.
|
||||
|
|
@ -184,19 +198,19 @@ namespace CGAL {
|
|||
return mdarts[ADart].get_marks();
|
||||
}
|
||||
/// Return the mark value of dart a given mark number.
|
||||
bool get_dart_mark(Dart_const_handle ADart, int amark) const
|
||||
bool get_dart_mark(Dart_const_handle ADart, size_type amark) const
|
||||
{
|
||||
return mdarts[ADart].get_mark(amark);
|
||||
}
|
||||
|
||||
/// Set the mark of a given mark number to a given value.
|
||||
void set_dart_mark(Dart_const_handle ADart, int amark, bool avalue) const
|
||||
void set_dart_mark(Dart_const_handle ADart, size_type amark, bool avalue) const
|
||||
{
|
||||
mdarts[ADart].set_mark(amark, avalue);
|
||||
}
|
||||
|
||||
/// Flip the mark of a given mark number to a given value.
|
||||
void flip_dart_mark(Dart_const_handle ADart, int amark) const
|
||||
void flip_dart_mark(Dart_const_handle ADart, size_type amark) const
|
||||
{
|
||||
mdarts[ADart].flip_mark(amark);
|
||||
}
|
||||
|
|
@ -205,24 +219,24 @@ namespace CGAL {
|
|||
Dart_handle get_beta(Dart_handle ADart, int B1)
|
||||
{
|
||||
CGAL_assertion(B1>=0 && B1<=dimension);
|
||||
return mdarts[ADart].mbeta[B1];
|
||||
return mdarts[ADart].mf[B1];
|
||||
}
|
||||
Dart_const_handle get_beta(Dart_const_handle ADart, int B1) const
|
||||
{
|
||||
CGAL_assertion(B1>=0 && B1<=dimension);
|
||||
return mdarts[ADart].mbeta[B1];
|
||||
return mdarts[ADart].mf[B1];
|
||||
}
|
||||
template<int B1>
|
||||
Dart_handle get_beta(Dart_handle ADart)
|
||||
{
|
||||
CGAL_assertion(B1>=0 && B1<=dimension);
|
||||
return mdarts[ADart].mbeta[B1];
|
||||
return mdarts[ADart].mf[B1];
|
||||
}
|
||||
template<int B1>
|
||||
Dart_const_handle get_beta(Dart_const_handle ADart) const
|
||||
{
|
||||
CGAL_assertion(B1>=0 && B1<=dimension);
|
||||
return mdarts[ADart].mbeta[B1];
|
||||
return mdarts[ADart].mf[B1];
|
||||
}
|
||||
|
||||
// return a handle on the i-attribute
|
||||
|
|
@ -231,7 +245,7 @@ namespace CGAL {
|
|||
{
|
||||
CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
|
||||
"attribute<i> called but i-attributes are disabled.");
|
||||
return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
|
||||
return std::get<Helper::template Dimension_index<i>::value>
|
||||
(mdarts[ADart].mattribute_handles);
|
||||
}
|
||||
template<unsigned int i>
|
||||
|
|
@ -240,16 +254,61 @@ namespace CGAL {
|
|||
{
|
||||
CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
|
||||
"attribute<i> called but i-attributes are disabled.");
|
||||
return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
|
||||
return std::get<Helper::template Dimension_index<i>::value>
|
||||
(mdarts[ADart].mattribute_handles);
|
||||
}
|
||||
|
||||
// Copy a given attribute
|
||||
template<unsigned int i>
|
||||
typename Attribute_handle<i>::type copy_attribute
|
||||
(typename Attribute_const_handle<i>::type ah)
|
||||
{
|
||||
CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
|
||||
"copy_attribute<i> called but i-attributes are disabled.");
|
||||
typename Attribute_handle<i>::type res=
|
||||
std::get<Helper::template Dimension_index<i>::value>
|
||||
(mattribute_containers).emplace(get_attribute<i>(ah));
|
||||
this->template init_attribute_ref_counting<i>(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
// Test if a given attribute is valid
|
||||
template<unsigned int i>
|
||||
bool is_valid_attribute(typename Attribute_const_handle<i>::type ah) const
|
||||
{
|
||||
return get_attribute<i>(ah).is_valid();
|
||||
}
|
||||
|
||||
// accessors and modifiers to the attribute ref counting given its handle
|
||||
template<unsigned int i>
|
||||
std::size_t get_attribute_ref_counting
|
||||
(typename Attribute_const_handle<i>::type ah) const
|
||||
{
|
||||
return get_attribute<i>(ah).get_nb_refs();
|
||||
}
|
||||
template<unsigned int i>
|
||||
void init_attribute_ref_counting(typename Attribute_handle<i>::type ah)
|
||||
{
|
||||
get_attribute<i>(ah).mrefcounting=0;
|
||||
}
|
||||
template<unsigned int i>
|
||||
void inc_attribute_ref_counting(typename Attribute_handle<i>::type ah)
|
||||
{
|
||||
get_attribute<i>(ah).inc_nb_refs();
|
||||
}
|
||||
template<unsigned int i>
|
||||
void dec_attribute_ref_counting(typename Attribute_handle<i>::type ah)
|
||||
{
|
||||
get_attribute<i>(ah).dec_nb_refs();
|
||||
}
|
||||
|
||||
// get the attribute given its index
|
||||
template<unsigned int i>
|
||||
typename Attribute_type<i>::type&
|
||||
get_attribute(typename Attribute_handle<i>::type ah)
|
||||
{
|
||||
CGAL_assertion( ah!=null_handle );
|
||||
return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
|
||||
return std::get<Helper::template Dimension_index<i>::value>
|
||||
(mattribute_containers)[ah];
|
||||
}
|
||||
|
||||
|
|
@ -258,53 +317,23 @@ namespace CGAL {
|
|||
get_attribute(typename Attribute_const_handle<i>::type ah) const
|
||||
{
|
||||
CGAL_assertion( ah!=null_handle );
|
||||
return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
|
||||
return std::get<Helper::template Dimension_index<i>::value>
|
||||
(mattribute_containers)[ah];
|
||||
}
|
||||
|
||||
Dart & get_dart(Dart_handle ah)
|
||||
{
|
||||
CGAL_assertion( ah!=null_handle );
|
||||
return mdarts[ah];
|
||||
}
|
||||
const Dart & get_dart(Dart_const_handle ah) const
|
||||
{
|
||||
CGAL_assertion( ah!=null_handle );
|
||||
return mdarts[ah];
|
||||
}
|
||||
|
||||
// Get the attribute of a dart
|
||||
template<unsigned int i>
|
||||
typename Attribute_type<i>::type& get_attribute_of_dart(Dart_handle adart)
|
||||
{
|
||||
CGAL_assertion( adart!=null_handle );
|
||||
CGAL_assertion( attribute<i>(adart)!=null_handle );
|
||||
return get_attribute<i>(attribute<i>(adart));
|
||||
}
|
||||
template<unsigned int i>
|
||||
const typename Attribute_type<i>::type&
|
||||
get_attribute_of_dart(Dart_const_handle adart) const
|
||||
{
|
||||
CGAL_assertion( adart!=null_handle );
|
||||
CGAL_assertion( attribute<i>(adart)!=null_handle );
|
||||
return get_attribute<i>(attribute<i>(adart));
|
||||
}
|
||||
|
||||
// Get the dart of the given attribute
|
||||
template<unsigned int i>
|
||||
Dart_handle dart_of_attribute(typename Attribute_handle<i>::type ah)
|
||||
{
|
||||
CGAL_assertion( ah!=null_handle );
|
||||
return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
|
||||
(mattribute_containers)[ah].dart();
|
||||
return get_attribute<i>(ah).dart();
|
||||
}
|
||||
template<unsigned int i>
|
||||
Dart_const_handle
|
||||
dart_of_attribute(typename Attribute_const_handle<i>::type ah) const
|
||||
{
|
||||
CGAL_assertion( ah!=null_handle );
|
||||
return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
|
||||
(mattribute_containers)[ah].dart();
|
||||
return get_attribute<i>(ah).dart();
|
||||
}
|
||||
|
||||
// Set the dart of the given attribute
|
||||
|
|
@ -313,8 +342,7 @@ namespace CGAL {
|
|||
Dart_handle adart)
|
||||
{
|
||||
CGAL_assertion( ah!=null_handle );
|
||||
CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
|
||||
(mattribute_containers)[ah].set_dart(adart);
|
||||
get_attribute<i>(ah).set_dart(adart);
|
||||
}
|
||||
|
||||
// Get the information associated with a given dart
|
||||
|
|
@ -329,16 +357,14 @@ namespace CGAL {
|
|||
info_of_attribute(typename Attribute_handle<i>::type ah)
|
||||
{
|
||||
CGAL_assertion( ah!=null_handle );
|
||||
return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
|
||||
(mattribute_containers)[ah].info();
|
||||
return get_attribute<i>(ah).info();
|
||||
}
|
||||
template<unsigned int i>
|
||||
const typename Attribute_type<i>::type::Info &
|
||||
info_of_attribute(typename Attribute_const_handle<i>::type ah) const
|
||||
{
|
||||
CGAL_assertion( ah!=null_handle );
|
||||
return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
|
||||
(mattribute_containers)[ah].info();
|
||||
return get_attribute<i>(ah).info();
|
||||
}
|
||||
|
||||
// Get the info of the i-cell attribute associated with the given dart
|
||||
|
|
@ -388,7 +414,7 @@ namespace CGAL {
|
|||
void basic_set_dart_attribute(Dart_handle ADart,
|
||||
typename Attribute_handle<i>::type ah)
|
||||
{
|
||||
CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
|
||||
std::get<Helper::template Dimension_index<i>::value>
|
||||
(mdarts[ADart].mattribute_handles) = ah;
|
||||
}
|
||||
|
||||
|
|
@ -429,7 +455,7 @@ namespace CGAL {
|
|||
|
||||
public:
|
||||
/// Void dart. A dart d is i-free if beta_i(d)=null_dart_handle.
|
||||
static const Dart_index null_dart_handle; //=0;
|
||||
static Dart_index null_dart_handle; //=0;
|
||||
|
||||
protected:
|
||||
/// Dart container.
|
||||
|
|
@ -442,12 +468,13 @@ namespace CGAL {
|
|||
|
||||
/// null_dart_handle
|
||||
template<unsigned int d_, class Items_, class Alloc_, class Size_type>
|
||||
const typename Combinatorial_map_storage_2<d_, Items_, Alloc_, Size_type>::Dart_index
|
||||
typename Combinatorial_map_storage_2<d_, Items_, Alloc_, Size_type>::Dart_index
|
||||
Combinatorial_map_storage_2<d_, Items_, Alloc_, Size_type>::null_dart_handle(0);
|
||||
|
||||
/// null_handle
|
||||
template<unsigned int d_, class Items_, class Alloc_, class Size_type>
|
||||
const Size_type Combinatorial_map_storage_2<d_, Items_, Alloc_, Size_type>::null_handle((std::numeric_limits<size_type>::max)()/2);
|
||||
typename Combinatorial_map_storage_2<d_, Items_, Alloc_, Size_type>::Null_handle_type
|
||||
Combinatorial_map_storage_2<d_, Items_, Alloc_, Size_type>::null_handle((std::numeric_limits<size_type>::max)()/2);
|
||||
|
||||
} // namespace CGAL
|
||||
|
||||
|
|
|
|||
|
|
@ -105,11 +105,19 @@ public:
|
|||
: Base(idx)
|
||||
{}
|
||||
|
||||
Index(const Index& idx): Base(idx)
|
||||
{}
|
||||
|
||||
Index(const const_iterator& it) : Base(it)
|
||||
{}
|
||||
|
||||
Index(const iterator& it) : Base(it)
|
||||
{}
|
||||
|
||||
// Constructor allowing to transform an index from one container to another
|
||||
template<typename Index2>
|
||||
Index(const Index2& idx): Base(static_cast<size_t>(idx))
|
||||
{}
|
||||
};
|
||||
friend class internal::CC_iterator_with_index<Self, false>;
|
||||
friend class internal::CC_iterator_with_index<Self, true>;
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
#include <CGAL/tuple.h>
|
||||
#include <bitset>
|
||||
#include <CGAL/Cell_attribute.h>
|
||||
#include <CGAL/Dart_with_index.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
|
|
@ -70,27 +71,15 @@ namespace CGAL {
|
|||
template<unsigned int, class, class, class>
|
||||
friend class Generalized_map_storage_1;
|
||||
|
||||
template<unsigned int, class, class, class>
|
||||
friend class Combinatorial_map_storage_2;
|
||||
|
||||
template<unsigned int, unsigned int, class, class, class, class>
|
||||
friend class CMap_linear_cell_complex_storage_1;
|
||||
|
||||
template<unsigned int, unsigned int, class, class, class, class>
|
||||
friend class Linear_cell_complex_storage_2;
|
||||
|
||||
template<unsigned int, unsigned int, class, class, class, class>
|
||||
friend class GMap_linear_cell_complex_storage_1;
|
||||
|
||||
template <class, class, class, class>
|
||||
friend class Compact_container;
|
||||
|
||||
template <class, class, class, class>
|
||||
friend class Compact_container_with_index;
|
||||
|
||||
template <class, class, class, class>
|
||||
friend class Compact_container_with_index_2;
|
||||
|
||||
template <class, class>
|
||||
friend class Concurrent_compact_container;
|
||||
|
||||
|
|
@ -271,167 +260,6 @@ namespace CGAL {
|
|||
typedef CGAL::Void Info;
|
||||
};
|
||||
|
||||
namespace Index
|
||||
{
|
||||
template <unsigned int d, typename Refs>
|
||||
struct Dart
|
||||
{
|
||||
template<unsigned int, class, class>
|
||||
friend class Combinatorial_map_storage_1;
|
||||
|
||||
template<unsigned int, class, class, class>
|
||||
friend class Combinatorial_map_storage_2;
|
||||
|
||||
template<unsigned int, unsigned int, class, class, class>
|
||||
friend class Linear_cell_complex_storage_1;
|
||||
|
||||
template<unsigned int, unsigned int, class, class, class, class>
|
||||
friend class Linear_cell_complex_storage_2;
|
||||
|
||||
template <class, class, class, class>
|
||||
friend class Compact_container;
|
||||
|
||||
template <class, class>
|
||||
friend class Concurrent_compact_container;
|
||||
|
||||
template <class, class, class, class>
|
||||
friend class Compact_container_with_index;
|
||||
|
||||
template <class, class, class, class>
|
||||
friend class Compact_container_with_index_2;
|
||||
|
||||
public:
|
||||
typedef Dart<d,Refs> Self;
|
||||
typedef typename Refs::Dart_handle Dart_handle;
|
||||
typedef typename Refs::size_type size_type;
|
||||
typedef typename Refs::Dart_const_handle Dart_const_handle;
|
||||
typedef typename Refs::Helper Helper;
|
||||
/// Typedef for attributes
|
||||
template<int i>
|
||||
struct Attribute_handle: public Refs::template Attribute_handle<i>
|
||||
{};
|
||||
template<int i>
|
||||
struct Attribute_const_handle:
|
||||
public Refs::template Attribute_const_handle<i>
|
||||
{};
|
||||
|
||||
/// The number of used marks.
|
||||
static const size_type NB_MARKS = Refs::NB_MARKS;
|
||||
|
||||
/// The dimension of the combinatorial map.
|
||||
static const unsigned int dimension = d;
|
||||
|
||||
Dart_handle get_f(unsigned int i) const
|
||||
{
|
||||
assert(i<=dimension);
|
||||
return mf[i];
|
||||
}
|
||||
|
||||
/// @return a handle on the i-attribute
|
||||
template<int i>
|
||||
typename Attribute_handle<i>::type attribute()
|
||||
{
|
||||
CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
|
||||
"attribute<i> called but i-attributes are disabled.");
|
||||
return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
|
||||
(mattribute_handles);
|
||||
}
|
||||
template<int i>
|
||||
typename Attribute_const_handle<i>::type attribute() const
|
||||
{
|
||||
CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
|
||||
"attribute<i> called but i-attributes are disabled.");
|
||||
return CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
|
||||
(mattribute_handles);
|
||||
}
|
||||
|
||||
/// Set the handle on the i th attribute
|
||||
template<int i>
|
||||
void set_attribute( typename Attribute_handle<i>::type ahandle )
|
||||
{
|
||||
CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
|
||||
"set_attribute<i> called but i-attributes are disabled.");
|
||||
CGAL::cpp11::get<Helper::template Dimension_index<i>::value>
|
||||
(mattribute_handles) = ahandle;
|
||||
if (ahandle!=NULL) ahandle->inc_nb_refs();
|
||||
}
|
||||
|
||||
/** Return the mark value of a given mark number.
|
||||
* @param amark the mark number.
|
||||
* @return the value for this number.
|
||||
*/
|
||||
bool get_mark(int amark) const
|
||||
{
|
||||
CGAL_assertion(amark>=0 && (size_type)amark<NB_MARKS);
|
||||
return mmarks[(size_type)amark];
|
||||
}
|
||||
|
||||
/** Set the mark of a given mark number to a given value.
|
||||
* @param amark the mark number.
|
||||
* @param AValue the value.
|
||||
*/
|
||||
void set_mark(int amark, bool avalue) const
|
||||
{
|
||||
CGAL_assertion(amark>=0 && (size_type)amark<NB_MARKS);
|
||||
mmarks.set((size_type)amark, avalue);
|
||||
}
|
||||
|
||||
/** Flip the mark of a given mark number.
|
||||
* @param amark the mark number.
|
||||
*/
|
||||
void flip_mark(int amark) const
|
||||
{
|
||||
CGAL_assertion(amark>=0 && (size_type)amark<NB_MARKS);
|
||||
mmarks.flip((size_type)amark);
|
||||
}
|
||||
|
||||
/** Return all the marks of this dart.
|
||||
* @return the marks.
|
||||
*/
|
||||
std::bitset<NB_MARKS> get_marks() const
|
||||
{ return mmarks; }
|
||||
|
||||
/** Set simultaneously all the marks of this dart to a given value.
|
||||
* @param amarks the value of the marks.
|
||||
*/
|
||||
void set_marks(const std::bitset<NB_MARKS>& amarks) const
|
||||
{ mmarks = amarks; }
|
||||
|
||||
protected:
|
||||
/** Default constructor: no real initialisation,
|
||||
* because this is done in the combinatorial map class.
|
||||
*/
|
||||
Dart()
|
||||
{}
|
||||
|
||||
/** Copy constructor:
|
||||
* @param adart a dart.
|
||||
*/
|
||||
Dart(const Dart& adart) : mmarks(adart.mmarks),
|
||||
mattribute_handles(adart.mattribute_handles)
|
||||
{
|
||||
for (unsigned int i = 0; i <= dimension; ++i)
|
||||
mf[i] = adart.mf[i];
|
||||
}
|
||||
|
||||
public:
|
||||
size_type for_compact_container_with_index() const
|
||||
{ return mf[0].for_compact_container_with_index(); }
|
||||
size_type& for_compact_container_with_index()
|
||||
{ return mf[0].for_compact_container_with_index(); }
|
||||
|
||||
protected:
|
||||
/// Neighboors for each dimension +1 (from 0 to dimension).
|
||||
Dart_handle mf[dimension+1];
|
||||
|
||||
/// Values of Boolean marks.
|
||||
mutable std::bitset<NB_MARKS> mmarks;
|
||||
|
||||
/// Attributes enabled
|
||||
typename Helper::Attribute_handles mattribute_handles;
|
||||
};
|
||||
} // namespace Index
|
||||
|
||||
} // namespace CGAL
|
||||
|
||||
#endif // CGAL_DART_H //
|
||||
|
|
|
|||
|
|
@ -0,0 +1,206 @@
|
|||
// Copyright (c) 2010-2011 CNRS and LIRIS' Establishments (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org)
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial
|
||||
//
|
||||
// Author(s) : Guillaume Damiand <guillaume.damiand@liris.cnrs.fr>
|
||||
//
|
||||
#ifndef CGAL_DART_WITH_INDEX_H
|
||||
#define CGAL_DART_WITH_INDEX_H 1
|
||||
|
||||
#include <CGAL/assertions.h>
|
||||
#include <CGAL/tags.h>
|
||||
#include <CGAL/tuple.h>
|
||||
#include <bitset>
|
||||
#include <CGAL/Cell_attribute.h>
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
namespace Index
|
||||
{
|
||||
template <unsigned int d, typename Refs>
|
||||
struct Dart_without_info
|
||||
{
|
||||
template<unsigned int, class, class, class>
|
||||
friend class CGAL::Combinatorial_map_storage_2;
|
||||
|
||||
// TODO template<unsigned int, unsigned int, class, class, class, class>
|
||||
// friend class CGAL::CMap_linear_cell_complex_storage_2;
|
||||
|
||||
template <class, class, class, class>
|
||||
friend class CGAL::Compact_container_with_index_2;
|
||||
|
||||
typedef Dart_without_info<d,Refs> Self;
|
||||
typedef typename Refs::Dart_handle Dart_handle;
|
||||
typedef typename Refs::size_type size_type;
|
||||
typedef typename Refs::Dart_const_handle Dart_const_handle;
|
||||
typedef typename Refs::Helper Helper;
|
||||
typedef CGAL::Tag_false Has_id;
|
||||
|
||||
/// Typedef for attributes
|
||||
template<int i>
|
||||
struct Attribute_handle: public Refs::template Attribute_handle<i>
|
||||
{};
|
||||
template<int i>
|
||||
struct Attribute_const_handle:
|
||||
public Refs::template Attribute_const_handle<i>
|
||||
{};
|
||||
|
||||
/// The number of used marks.
|
||||
static const size_type NB_MARKS = Refs::NB_MARKS;
|
||||
|
||||
/// The dimension of the combinatorial map.
|
||||
static const unsigned int dimension = d;
|
||||
|
||||
size_type for_compact_container_with_index() const
|
||||
{ return mf[0].for_compact_container_with_index(); }
|
||||
size_type& for_compact_container_with_index()
|
||||
{ return mf[0].for_compact_container_with_index(); }
|
||||
|
||||
Dart_handle get_f(unsigned int i) const
|
||||
{
|
||||
assert(i<=dimension);
|
||||
return mf[i];
|
||||
}
|
||||
|
||||
protected:
|
||||
/** Default constructor: no real initialisation,
|
||||
* because this is done in the combinatorial map class.
|
||||
*/
|
||||
Dart_without_info()
|
||||
{}
|
||||
|
||||
/** Copy constructor:
|
||||
* @param adart a dart.
|
||||
*/
|
||||
Dart_without_info(const Dart_without_info& adart) : mmarks(adart.mmarks),
|
||||
mattribute_handles(adart.mattribute_handles)
|
||||
{
|
||||
for (unsigned int i = 0; i <= dimension; ++i)
|
||||
mf[i] = adart.mf[i];
|
||||
}
|
||||
|
||||
/** Return the mark value of a given mark number.
|
||||
* @param amark the mark number.
|
||||
* @return the value for this number.
|
||||
*/
|
||||
bool get_mark(size_type amark) const
|
||||
{
|
||||
CGAL_assertion(amark>=0 && amark<NB_MARKS);
|
||||
return mmarks[amark];
|
||||
}
|
||||
|
||||
/** Set the mark of a given mark number to a given value.
|
||||
* @param amark the mark number.
|
||||
* @param AValue the value.
|
||||
*/
|
||||
void set_mark(size_type amark, bool avalue) const
|
||||
{
|
||||
CGAL_assertion(amark>=0 && amark<NB_MARKS);
|
||||
mmarks.set(amark, avalue);
|
||||
}
|
||||
/** Flip the mark of a given mark number.
|
||||
* @param amark the mark number.
|
||||
*/
|
||||
void flip_mark(size_type amark) const
|
||||
{
|
||||
CGAL_assertion(amark>=0 && amark<NB_MARKS);
|
||||
mmarks.flip(amark);
|
||||
}
|
||||
|
||||
/** Return all the marks of this dart.
|
||||
* @return the marks.
|
||||
*/
|
||||
std::bitset<NB_MARKS> get_marks() const
|
||||
{ return mmarks; }
|
||||
|
||||
/** Set simultaneously all the marks of this dart to a given value.
|
||||
* @param amarks the value of the marks.
|
||||
*/
|
||||
void set_marks(const std::bitset<NB_MARKS>& amarks) const
|
||||
{ mmarks = amarks; }
|
||||
|
||||
/// @return a handle on the i-attribute
|
||||
template<int i>
|
||||
typename Attribute_handle<i>::type attribute()
|
||||
{
|
||||
CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
|
||||
"attribute<i> called but i-attributes are disabled.");
|
||||
return std::get<Helper::template Dimension_index<i>::value>
|
||||
(mattribute_handles);
|
||||
}
|
||||
template<int i>
|
||||
typename Attribute_const_handle<i>::type attribute() const
|
||||
{
|
||||
CGAL_static_assertion_msg(Helper::template Dimension_index<i>::value>=0,
|
||||
"attribute<i> called but i-attributes are disabled.");
|
||||
return std::get<Helper::template Dimension_index<i>::value>
|
||||
(mattribute_handles);
|
||||
}
|
||||
|
||||
protected:
|
||||
/// Neighboors for each dimension +1 (from 0 to dimension).
|
||||
Dart_handle mf[dimension+1];
|
||||
|
||||
/// Values of Boolean marks.
|
||||
mutable std::bitset<NB_MARKS> mmarks;
|
||||
|
||||
/// Attributes enabled
|
||||
typename Helper::Attribute_handles mattribute_handles;
|
||||
};
|
||||
|
||||
// Dart definition with an info;
|
||||
// (there is a specialization below when Info_==void)
|
||||
template <unsigned int d, typename Refs, typename Info_=void>
|
||||
struct Dart : public Dart_without_info<d, Refs>
|
||||
{
|
||||
public:
|
||||
template<unsigned int, class, class, class>
|
||||
friend class CGAL::Combinatorial_map_storage_2;
|
||||
|
||||
/* TODO template<unsigned int, unsigned int, class, class, class, class>
|
||||
friend class CMap_linear_cell_complex_storage_2; */
|
||||
|
||||
template <class, class, class, class>
|
||||
friend class CGAL::Compact_container_with_index_2;
|
||||
|
||||
typedef Dart<d, Refs, Info_> Self;
|
||||
typedef Info_ Info;
|
||||
|
||||
protected:
|
||||
/** Default constructor: no real initialisation,
|
||||
* because this is done in the combinatorial or generalized map class.
|
||||
*/
|
||||
Dart()
|
||||
{}
|
||||
|
||||
Dart(const Info_& info) : minfo(info)
|
||||
{}
|
||||
|
||||
Info_& info()
|
||||
{ return minfo; }
|
||||
const Info_& info() const
|
||||
{ return minfo; }
|
||||
|
||||
protected:
|
||||
Info minfo;
|
||||
};
|
||||
|
||||
// Specialization of Dart class when info==void
|
||||
template <unsigned int d, typename Refs>
|
||||
struct Dart<d, Refs, void> : public Dart_without_info<d, Refs>
|
||||
{
|
||||
public:
|
||||
typedef CGAL::Void Info;
|
||||
};
|
||||
|
||||
} // namespace Index
|
||||
|
||||
} // namespace CGAL
|
||||
|
||||
#endif // CGAL_DART_WITH_INDEX_H //
|
||||
// EOF //
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
// Copyright (c) 2010-2011 CNRS and LIRIS' Establishments (France).
|
||||
// All rights reserved.
|
||||
//
|
||||
// This file is part of CGAL (www.cgal.org)
|
||||
//
|
||||
// $URL$
|
||||
// $Id$
|
||||
// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial
|
||||
//
|
||||
// Author(s) : Guillaume Damiand <guillaume.damiand@liris.cnrs.fr>
|
||||
//
|
||||
#ifndef CGAL_INFO_FOR_CELL_ATTRIBUTE_H
|
||||
#define CGAL_INFO_FOR_CELL_ATTRIBUTE_H 1
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
/// Info associated with a cell_attribute.
|
||||
template <typename Info>
|
||||
class Info_for_cell_attribute
|
||||
{
|
||||
public:
|
||||
/// Contructor without parameter.
|
||||
Info_for_cell_attribute()
|
||||
{}
|
||||
|
||||
/// Contructor with an info in parameter.
|
||||
Info_for_cell_attribute(const Info& ainfo) : minfo(ainfo)
|
||||
{}
|
||||
|
||||
/// Get the info associated with the cell_attribute.
|
||||
Info& info()
|
||||
{ return minfo; }
|
||||
|
||||
/// Get the info associated with the cell_attribute.
|
||||
const Info& info() const
|
||||
{ return minfo; }
|
||||
|
||||
protected:
|
||||
/// The info associated with the cell_attribute.
|
||||
Info minfo;
|
||||
};
|
||||
|
||||
} // namespace CGAL
|
||||
|
||||
#endif // CGAL_INFO_FOR_CELL_ATTRIBUTE_H //
|
||||
// EOF //
|
||||
Loading…
Reference in New Issue