mirror of https://github.com/CGAL/cgal
Now attributes and darts in CMap/GMap/LCC can have id or not depending on a template argument.
This commit is contained in:
parent
1d765e91c9
commit
bfbee1701e
|
|
@ -12,9 +12,9 @@ struct Myitem
|
||||||
template<class Refs>
|
template<class Refs>
|
||||||
struct Dart_wrapper
|
struct Dart_wrapper
|
||||||
{
|
{
|
||||||
typedef CGAL::Dart<2, Refs > Dart;
|
typedef CGAL::Tag_true Darts_with_id;
|
||||||
typedef CGAL::Cell_attribute_with_point< Refs > Vertex_attribute;
|
typedef CGAL::Cell_attribute_with_point_and_id< Refs > Vertex_attribute;
|
||||||
typedef CGAL::Cell_attribute< Refs > Face_attribute;
|
typedef CGAL::Cell_attribute_with_id< Refs > Face_attribute;
|
||||||
typedef CGAL::cpp11::tuple<Vertex_attribute, void, Face_attribute> Attributes;
|
typedef CGAL::cpp11::tuple<Vertex_attribute, void, Face_attribute> Attributes;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -46,9 +46,9 @@ struct Myitem
|
||||||
template<class Refs>
|
template<class Refs>
|
||||||
struct Dart_wrapper
|
struct Dart_wrapper
|
||||||
{
|
{
|
||||||
typedef CGAL::Dart<2, Refs > Dart;
|
typedef CGAL::Tag_true Darts_with_id;
|
||||||
typedef CGAL::Cell_attribute_with_point< Refs > Vertex_attribute;
|
typedef CGAL::Cell_attribute_with_point_and_id< Refs > Vertex_attribute;
|
||||||
typedef CGAL::Cell_attribute< Refs > Face_attribute;
|
typedef CGAL::Cell_attribute_with_id< Refs > Face_attribute;
|
||||||
typedef CGAL::cpp11::tuple<Vertex_attribute, void, Face_attribute> Attributes;
|
typedef CGAL::cpp11::tuple<Vertex_attribute, void, Face_attribute> Attributes;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ namespace CGAL {
|
||||||
|
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
template<class>
|
template<class, class>
|
||||||
struct Init_id;
|
struct Init_id;
|
||||||
|
|
||||||
} // end namespace internal
|
} // end namespace internal
|
||||||
|
|
@ -77,15 +77,41 @@ namespace CGAL {
|
||||||
Info minfo;
|
Info minfo;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// Id associated with a cell attribute
|
||||||
|
template <class WithId>
|
||||||
|
class Add_id
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// Required to have "internal" property maps.
|
||||||
|
std::size_t& id()
|
||||||
|
{ return m_id; }
|
||||||
|
const std::size_t& id() const
|
||||||
|
{ return m_id; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void set_id(std::size_t id)
|
||||||
|
{ m_id=id; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
/// id of the cell
|
||||||
|
std::size_t m_id;
|
||||||
|
};
|
||||||
|
|
||||||
|
/// If the tag WithId is false, we do not add id to cells.
|
||||||
|
template <>
|
||||||
|
class Add_id<Tag_false>
|
||||||
|
{};
|
||||||
|
|
||||||
/// Cell_attribute_without_info
|
/// Cell_attribute_without_info
|
||||||
template <class Refs, class Tag=Tag_true, class OnMerge=Null_functor,
|
template <class Refs, class Tag=Tag_true, class OnMerge=Null_functor,
|
||||||
class OnSplit=Null_functor>
|
class OnSplit=Null_functor, class WithID=Tag_false>
|
||||||
class Cell_attribute_without_info;
|
class Cell_attribute_without_info;
|
||||||
|
|
||||||
// Cell_attribute_without_info without dart support.
|
// Cell_attribute_without_info without dart support.
|
||||||
template <class Refs, class OnMerge, class OnSplit>
|
template <class Refs, class OnMerge, class OnSplit, class WithID>
|
||||||
class Cell_attribute_without_info<Refs, Tag_false,
|
class Cell_attribute_without_info<Refs, Tag_false,
|
||||||
OnMerge, OnSplit>
|
OnMerge, OnSplit, WithID>:
|
||||||
|
public Add_id<WithID>
|
||||||
{
|
{
|
||||||
template<unsigned int, class, class>
|
template<unsigned int, class, class>
|
||||||
friend class Combinatorial_map_storage_1;
|
friend class Combinatorial_map_storage_1;
|
||||||
|
|
@ -105,7 +131,7 @@ namespace CGAL {
|
||||||
template <class, class>
|
template <class, class>
|
||||||
friend class Concurrent_compact_container;
|
friend class Concurrent_compact_container;
|
||||||
|
|
||||||
template<class>
|
template<class, class>
|
||||||
friend struct internal::Init_id;
|
friend struct internal::Init_id;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
@ -117,6 +143,7 @@ namespace CGAL {
|
||||||
|
|
||||||
typedef OnMerge On_merge;
|
typedef OnMerge On_merge;
|
||||||
typedef OnSplit On_split;
|
typedef OnSplit On_split;
|
||||||
|
typedef WithID Has_id;
|
||||||
|
|
||||||
/// operator =
|
/// operator =
|
||||||
Cell_attribute_without_info&
|
Cell_attribute_without_info&
|
||||||
|
|
@ -146,14 +173,6 @@ namespace CGAL {
|
||||||
bool operator!=(const Cell_attribute_without_info& other) const
|
bool operator!=(const Cell_attribute_without_info& other) const
|
||||||
{ return !operator==(other); }
|
{ return !operator==(other); }
|
||||||
|
|
||||||
// Required to have "internal" property maps.
|
|
||||||
// TODO better (use id only when we want to use bgl ?)
|
|
||||||
// (or have an id directly in compact container ?)
|
|
||||||
std::size_t& id()
|
|
||||||
{ return m_id; }
|
|
||||||
const std::size_t& id() const
|
|
||||||
{ return m_id; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// Contructor without parameter.
|
/// Contructor without parameter.
|
||||||
Cell_attribute_without_info(): mrefcounting(0)
|
Cell_attribute_without_info(): mrefcounting(0)
|
||||||
|
|
@ -176,9 +195,6 @@ namespace CGAL {
|
||||||
mrefcounting-=4; // 4 because the two lowest bits are reserved for cc
|
mrefcounting-=4; // 4 because the two lowest bits are reserved for cc
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_id(std::size_t id)
|
|
||||||
{ m_id=id; }
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// Get the reference counting.
|
/// Get the reference counting.
|
||||||
std::size_t get_nb_refs() const
|
std::size_t get_nb_refs() const
|
||||||
|
|
@ -196,9 +212,6 @@ namespace CGAL {
|
||||||
std::size_t mrefcounting;
|
std::size_t mrefcounting;
|
||||||
void *vp;
|
void *vp;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// id of the dart // TODO better
|
|
||||||
std::size_t m_id;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Definition of cell attribute.
|
/** Definition of cell attribute.
|
||||||
|
|
@ -206,9 +219,9 @@ namespace CGAL {
|
||||||
* link to a dart of the cell (when T is true).
|
* link to a dart of the cell (when T is true).
|
||||||
* The refs class must provide the type of Combinatorial_map used.
|
* The refs class must provide the type of Combinatorial_map used.
|
||||||
*/
|
*/
|
||||||
template <class Refs, class OnMerge, class OnSplit>
|
template <class Refs, class OnMerge, class OnSplit, class WithID>
|
||||||
class Cell_attribute_without_info<Refs, Tag_true,
|
class Cell_attribute_without_info<Refs, Tag_true,
|
||||||
OnMerge, OnSplit>
|
OnMerge, OnSplit, WithID>: public Add_id<WithID>
|
||||||
{
|
{
|
||||||
template<unsigned int, class, class>
|
template<unsigned int, class, class>
|
||||||
friend class Combinatorial_map_storage_1;
|
friend class Combinatorial_map_storage_1;
|
||||||
|
|
@ -240,6 +253,7 @@ namespace CGAL {
|
||||||
|
|
||||||
typedef OnMerge On_merge;
|
typedef OnMerge On_merge;
|
||||||
typedef OnSplit On_split;
|
typedef OnSplit On_split;
|
||||||
|
typedef WithID Has_id;
|
||||||
|
|
||||||
/// operator =
|
/// operator =
|
||||||
Cell_attribute_without_info&
|
Cell_attribute_without_info&
|
||||||
|
|
@ -270,14 +284,6 @@ namespace CGAL {
|
||||||
bool operator!=(const Cell_attribute_without_info& other) const
|
bool operator!=(const Cell_attribute_without_info& other) const
|
||||||
{ return !operator==(other); }
|
{ return !operator==(other); }
|
||||||
|
|
||||||
// Required to have "internal" property maps.
|
|
||||||
// TODO better (use id only when we want to use bgl ?)
|
|
||||||
// (or have an id directly in compact container ?)
|
|
||||||
std::size_t& id()
|
|
||||||
{ return m_id; }
|
|
||||||
const std::size_t& id() const
|
|
||||||
{ return m_id; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// Contructor without parameter.
|
/// Contructor without parameter.
|
||||||
Cell_attribute_without_info() : mdart(Refs::null_handle),
|
Cell_attribute_without_info() : mdart(Refs::null_handle),
|
||||||
|
|
@ -302,9 +308,6 @@ namespace CGAL {
|
||||||
--mrefcounting;
|
--mrefcounting;
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_id(std::size_t id)
|
|
||||||
{ m_id=id; }
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// Get the reference counting.
|
/// Get the reference counting.
|
||||||
std::size_t get_nb_refs() const
|
std::size_t get_nb_refs() const
|
||||||
|
|
@ -321,23 +324,20 @@ namespace CGAL {
|
||||||
|
|
||||||
/// Reference counting: the number of darts linked to this cell.
|
/// Reference counting: the number of darts linked to this cell.
|
||||||
std::size_t mrefcounting;
|
std::size_t mrefcounting;
|
||||||
|
|
||||||
/// id of the dart // TODO better
|
|
||||||
std::size_t m_id;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Cell associated with an attribute, with or without info depending
|
/// Cell associated with an attribute, with or without info depending
|
||||||
/// if Info==void.
|
/// if Info==void.
|
||||||
template <class Refs, class Info_=void, class Tag_=Tag_true,
|
template <class Refs, class Info_=void, class Tag_=Tag_true,
|
||||||
class OnMerge=Null_functor,
|
class OnMerge=Null_functor,
|
||||||
class OnSplit=Null_functor>
|
class OnSplit=Null_functor,
|
||||||
|
class WithID=Tag_false>
|
||||||
class Cell_attribute;
|
class Cell_attribute;
|
||||||
|
|
||||||
/// Specialization when Info==void.
|
/// Specialization when Info==void.
|
||||||
template <class Refs, class Tag_,
|
template <class Refs, class Tag_, class OnMerge, class OnSplit, class WithID>
|
||||||
class OnMerge, class OnSplit>
|
class Cell_attribute<Refs, void, Tag_, OnMerge, OnSplit, WithID> :
|
||||||
class Cell_attribute<Refs, void, Tag_, OnMerge, OnSplit> :
|
public Cell_attribute_without_info<Refs, Tag_, OnMerge, OnSplit, WithID>
|
||||||
public Cell_attribute_without_info<Refs, Tag_, OnMerge, OnSplit>
|
|
||||||
{
|
{
|
||||||
template<unsigned int, class, class>
|
template<unsigned int, class, class>
|
||||||
friend class Combinatorial_map_storage_1;
|
friend class Combinatorial_map_storage_1;
|
||||||
|
|
@ -374,9 +374,9 @@ namespace CGAL {
|
||||||
|
|
||||||
/// Specialization when Info!=void.
|
/// Specialization when Info!=void.
|
||||||
template <class Refs, class Info_, class Tag_,
|
template <class Refs, class Info_, class Tag_,
|
||||||
class OnMerge, class OnSplit>
|
class OnMerge, class OnSplit, class WithID>
|
||||||
class Cell_attribute :
|
class Cell_attribute :
|
||||||
public Cell_attribute_without_info<Refs, Tag_, OnMerge, OnSplit>,
|
public Cell_attribute_without_info<Refs, Tag_, OnMerge, OnSplit, WithID>,
|
||||||
public Info_for_cell_attribute<Info_>
|
public Info_for_cell_attribute<Info_>
|
||||||
{
|
{
|
||||||
template<unsigned int, class, class>
|
template<unsigned int, class, class>
|
||||||
|
|
@ -398,7 +398,7 @@ namespace CGAL {
|
||||||
friend class Concurrent_compact_container;
|
friend class Concurrent_compact_container;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef Cell_attribute<Refs, Info_, Tag_, OnMerge, OnSplit> Self;
|
typedef Cell_attribute<Refs, Info_, Tag_, OnMerge, OnSplit, WithID> Self;
|
||||||
|
|
||||||
typedef Tag_ Supports_cell_dart;
|
typedef Tag_ Supports_cell_dart;
|
||||||
typedef typename Refs::Dart_handle Dart_handle;
|
typedef typename Refs::Dart_handle Dart_handle;
|
||||||
|
|
@ -425,6 +425,47 @@ namespace CGAL {
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// A cell attribute with an id, when Info_!=void
|
||||||
|
template <class Refs, class Info_=void, class Tag_=Tag_true,
|
||||||
|
class OnMerge=Null_functor,
|
||||||
|
class OnSplit=Null_functor>
|
||||||
|
class Cell_attribute_with_id: public Cell_attribute
|
||||||
|
<Refs, Info_, Tag_, OnMerge, OnSplit, Tag_true>
|
||||||
|
{
|
||||||
|
template <class, class, class, class>
|
||||||
|
friend class Compact_container;
|
||||||
|
|
||||||
|
template <class, class>
|
||||||
|
friend class Concurrent_compact_container;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
/// Default contructor.
|
||||||
|
Cell_attribute_with_id()
|
||||||
|
{}
|
||||||
|
|
||||||
|
/// Contructor with an info in parameter.
|
||||||
|
Cell_attribute_with_id(const Info_& ainfo) :
|
||||||
|
Cell_attribute<Refs, Info_, Tag_, OnMerge, OnSplit, Tag_true>(ainfo)
|
||||||
|
{}
|
||||||
|
};
|
||||||
|
|
||||||
|
/// Specialization when Info==void.
|
||||||
|
template <class Refs, class Tag_, class OnMerge, class OnSplit>
|
||||||
|
class Cell_attribute_with_id<Refs, void, Tag_, OnMerge, OnSplit>:
|
||||||
|
public Cell_attribute<Refs, void, Tag_, OnMerge, OnSplit, Tag_true>
|
||||||
|
{
|
||||||
|
template <class, class, class, class>
|
||||||
|
friend class Compact_container;
|
||||||
|
|
||||||
|
template <class, class>
|
||||||
|
friend class Concurrent_compact_container;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
/// Default contructor.
|
||||||
|
Cell_attribute_with_id()
|
||||||
|
{}
|
||||||
|
};
|
||||||
|
|
||||||
} // namespace CGAL
|
} // namespace CGAL
|
||||||
|
|
||||||
#endif // CGAL_CELL_ATTRIBUTE_H //
|
#endif // CGAL_CELL_ATTRIBUTE_H //
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,9 @@ namespace CGAL {
|
||||||
#else
|
#else
|
||||||
typedef typename internal::template Get_dart_info<Dart_wrapper>::type
|
typedef typename internal::template Get_dart_info<Dart_wrapper>::type
|
||||||
Dart_info;
|
Dart_info;
|
||||||
typedef CGAL::Dart<d_, Self, Dart_info> Dart;
|
typedef typename internal::template Get_darts_with_id<Dart_wrapper>::type
|
||||||
|
Darts_with_id;
|
||||||
|
typedef CGAL::Dart<d_, Self, Dart_info, Darts_with_id> Dart;
|
||||||
#endif
|
#endif
|
||||||
typedef typename Alloc_::template rebind<Dart>::other Dart_allocator;
|
typedef typename Alloc_::template rebind<Dart>::other Dart_allocator;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ namespace CGAL {
|
||||||
|
|
||||||
namespace internal {
|
namespace internal {
|
||||||
|
|
||||||
template<class>
|
template<class, class>
|
||||||
struct Init_id;
|
struct Init_id;
|
||||||
|
|
||||||
} // end namespace internal
|
} // end namespace internal
|
||||||
|
|
@ -62,8 +62,8 @@ namespace CGAL {
|
||||||
* n is the dimension of the space (2 for 2D, 3 for 3D...)
|
* n is the dimension of the space (2 for 2D, 3 for 3D...)
|
||||||
* Refs the ref class
|
* Refs the ref class
|
||||||
*/
|
*/
|
||||||
template <unsigned int d, typename Refs>
|
template <unsigned int d, typename Refs, class WithId>
|
||||||
struct Dart_without_info
|
struct Dart_without_info: public Add_id<WithId>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
template<unsigned int, class, class>
|
template<unsigned int, class, class>
|
||||||
|
|
@ -87,11 +87,12 @@ namespace CGAL {
|
||||||
template<class>
|
template<class>
|
||||||
friend struct internal::Init_id;
|
friend struct internal::Init_id;
|
||||||
|
|
||||||
typedef Dart_without_info<d,Refs> Self;
|
typedef Dart_without_info<d,Refs, WithId> Self;
|
||||||
typedef typename Refs::Dart_handle Dart_handle;
|
typedef typename Refs::Dart_handle Dart_handle;
|
||||||
typedef typename Refs::size_type size_type;
|
typedef typename Refs::size_type size_type;
|
||||||
typedef typename Refs::Dart_const_handle Dart_const_handle;
|
typedef typename Refs::Dart_const_handle Dart_const_handle;
|
||||||
typedef typename Refs::Helper Helper;
|
typedef typename Refs::Helper Helper;
|
||||||
|
typedef WithId Has_id;
|
||||||
|
|
||||||
/// Typedef for attributes
|
/// Typedef for attributes
|
||||||
template<int i>
|
template<int i>
|
||||||
|
|
@ -119,14 +120,6 @@ namespace CGAL {
|
||||||
return mf[i];
|
return mf[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Required to have "internal" property maps.
|
|
||||||
// TODO better (use id only when we want to use bgl ?)
|
|
||||||
// (or have an id directly in compact container ?)
|
|
||||||
std::size_t& id()
|
|
||||||
{ return m_id; }
|
|
||||||
const std::size_t& id() const
|
|
||||||
{ return m_id; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** Default constructor: no real initialisation,
|
/** Default constructor: no real initialisation,
|
||||||
* because this is done in the combinatorial map class.
|
* because this is done in the combinatorial map class.
|
||||||
|
|
@ -202,9 +195,6 @@ namespace CGAL {
|
||||||
(mattribute_handles);
|
(mattribute_handles);
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_id(std::size_t id)
|
|
||||||
{ m_id=id; }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// Neighboors for each dimension +1 (from 0 to dimension).
|
/// Neighboors for each dimension +1 (from 0 to dimension).
|
||||||
Dart_handle mf[dimension+1];
|
Dart_handle mf[dimension+1];
|
||||||
|
|
@ -214,9 +204,6 @@ namespace CGAL {
|
||||||
|
|
||||||
/// Attributes enabled
|
/// Attributes enabled
|
||||||
typename Helper::Attribute_handles mattribute_handles;
|
typename Helper::Attribute_handles mattribute_handles;
|
||||||
|
|
||||||
/// id of the dart // TODO better
|
|
||||||
std::size_t m_id;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#if defined(CGAL_CMAP_DART_DEPRECATED) && !defined(CGAL_NO_DEPRECATED_CODE)
|
#if defined(CGAL_CMAP_DART_DEPRECATED) && !defined(CGAL_NO_DEPRECATED_CODE)
|
||||||
|
|
@ -324,8 +311,9 @@ namespace CGAL {
|
||||||
#else // CGAL_CMAP_DART_DEPRECATED
|
#else // CGAL_CMAP_DART_DEPRECATED
|
||||||
// Dart definition with an info;
|
// Dart definition with an info;
|
||||||
// (there is a specialization below when Info_==void)
|
// (there is a specialization below when Info_==void)
|
||||||
template <unsigned int d, typename Refs, typename Info_=void>
|
template <unsigned int d, typename Refs, typename Info_=void,
|
||||||
struct Dart : public Dart_without_info<d, Refs>
|
class WithID=Tag_false>
|
||||||
|
struct Dart : public Dart_without_info<d, Refs, WithID>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
template<unsigned int, class, class>
|
template<unsigned int, class, class>
|
||||||
|
|
@ -346,7 +334,7 @@ namespace CGAL {
|
||||||
template <class, class>
|
template <class, class>
|
||||||
friend class Concurrent_compact_container;
|
friend class Concurrent_compact_container;
|
||||||
|
|
||||||
typedef Dart<d, Refs, Info_> Self;
|
typedef Dart<d, Refs, Info_, WithID> Self;
|
||||||
typedef Info_ Info;
|
typedef Info_ Info;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
@ -369,8 +357,8 @@ namespace CGAL {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Specialization of Dart class when info==void
|
// Specialization of Dart class when info==void
|
||||||
template <unsigned int d, typename Refs>
|
template <unsigned int d, typename Refs, class WithID>
|
||||||
struct Dart<d, Refs, void> : public Dart_without_info<d, Refs>
|
struct Dart<d, Refs, void, WithID> : public Dart_without_info<d, Refs, WithID>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef CGAL::Void Info;
|
typedef CGAL::Void Info;
|
||||||
|
|
|
||||||
|
|
@ -1037,7 +1037,8 @@ struct Beta_functor_static<CMap, Dart_handle, B, Betas...>
|
||||||
};
|
};
|
||||||
#endif //CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES
|
#endif //CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES
|
||||||
// ****************************************************************************
|
// ****************************************************************************
|
||||||
template<typename Container>
|
template<typename Container, class WitdId=
|
||||||
|
typename Container::value_type::Has_id>
|
||||||
struct Init_id
|
struct Init_id
|
||||||
{
|
{
|
||||||
static void run(Container& c, typename Container::iterator e)
|
static void run(Container& c, typename Container::iterator e)
|
||||||
|
|
@ -1045,6 +1046,12 @@ struct Init_id
|
||||||
e->set_id(c.index(e));
|
e->set_id(c.index(e));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
template<typename Container>
|
||||||
|
struct Init_id<Container, Tag_false>
|
||||||
|
{
|
||||||
|
static void run(Container&, typename Container::iterator)
|
||||||
|
{}
|
||||||
|
};
|
||||||
// ****************************************************************************
|
// ****************************************************************************
|
||||||
} // namespace internal
|
} // namespace internal
|
||||||
} // namespace CGAL
|
} // namespace CGAL
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,16 @@ namespace CGAL
|
||||||
struct Get_dart_info<T, true>
|
struct Get_dart_info<T, true>
|
||||||
{ typedef typename Convert_void<typename T::Dart_info>::type type; };
|
{ typedef typename Convert_void<typename T::Dart_info>::type type; };
|
||||||
|
|
||||||
|
// Get the type Darts_with_id as inner type of T.
|
||||||
|
// If T::Darts_with_id is not defined or if T::Darts_widh_id is Tag_false
|
||||||
|
BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(Has_darts_with_id,Darts_with_id,false)
|
||||||
|
template<typename T, bool typedefined=Has_darts_with_id<T>::value >
|
||||||
|
struct Get_darts_with_id
|
||||||
|
{ typedef CGAL::Tag_false type; };
|
||||||
|
template<typename T>
|
||||||
|
struct Get_darts_with_id<T, true>
|
||||||
|
{ typedef CGAL::Tag_true type; };
|
||||||
|
|
||||||
// Get the type Attributes defined as inner type of T.
|
// Get the type Attributes defined as inner type of T.
|
||||||
// If T::Attributes is not defined, defined CGAL::cpp11::tuple<> as type.
|
// If T::Attributes is not defined, defined CGAL::cpp11::tuple<> as type.
|
||||||
BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(Has_attributes_tuple,Attributes,false)
|
BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(Has_attributes_tuple,Attributes,false)
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,9 @@ namespace CGAL {
|
||||||
|
|
||||||
typedef typename internal::template Get_dart_info<Dart_wrapper>::type
|
typedef typename internal::template Get_dart_info<Dart_wrapper>::type
|
||||||
Dart_info;
|
Dart_info;
|
||||||
typedef CGAL::Dart<d_, Self, Dart_info> Dart;
|
typedef typename internal::template Get_darts_with_id<Dart_wrapper>::type
|
||||||
|
Darts_with_id;
|
||||||
|
typedef CGAL::Dart<d_, Self, Dart_info, Darts_with_id> Dart;
|
||||||
|
|
||||||
typedef typename Alloc_::template rebind<Dart>::other Dart_allocator;
|
typedef typename Alloc_::template rebind<Dart>::other Dart_allocator;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,9 @@ namespace CGAL {
|
||||||
#else
|
#else
|
||||||
typedef typename internal::template Get_dart_info<Dart_wrapper>::type
|
typedef typename internal::template Get_dart_info<Dart_wrapper>::type
|
||||||
Dart_info;
|
Dart_info;
|
||||||
typedef CGAL::Dart<d_, Self, Dart_info> Dart;
|
typedef typename internal::template Get_darts_with_id<Dart_wrapper>::type
|
||||||
|
Darts_with_id;
|
||||||
|
typedef CGAL::Dart<d_, Self, Dart_info, Darts_with_id> Dart;
|
||||||
#endif
|
#endif
|
||||||
typedef typename Alloc_::template rebind<Dart>::other Dart_allocator;
|
typedef typename Alloc_::template rebind<Dart>::other Dart_allocator;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -57,10 +57,11 @@ namespace CGAL {
|
||||||
/// Attribute associated with a point and an info.
|
/// Attribute associated with a point and an info.
|
||||||
template < class LCC, class Info_=void, class Tag=Tag_true,
|
template < class LCC, class Info_=void, class Tag=Tag_true,
|
||||||
class Functor_on_merge_=Null_functor,
|
class Functor_on_merge_=Null_functor,
|
||||||
class Functor_on_split_=Null_functor >
|
class Functor_on_split_=Null_functor,
|
||||||
|
class WithID=Tag_false >
|
||||||
class Cell_attribute_with_point :
|
class Cell_attribute_with_point :
|
||||||
public Cell_attribute<LCC, Info_, Tag,
|
public Cell_attribute<LCC, Info_, Tag,
|
||||||
Functor_on_merge_, Functor_on_split_>,
|
Functor_on_merge_, Functor_on_split_, WithID>,
|
||||||
public Point_for_cell<typename LCC::Point>
|
public Point_for_cell<typename LCC::Point>
|
||||||
{
|
{
|
||||||
template <class, class, class, class>
|
template <class, class, class, class>
|
||||||
|
|
@ -112,10 +113,13 @@ namespace CGAL {
|
||||||
/// Attribute associated with a point and without info.
|
/// Attribute associated with a point and without info.
|
||||||
template < class LCC, class Tag,
|
template < class LCC, class Tag,
|
||||||
class Functor_on_merge_,
|
class Functor_on_merge_,
|
||||||
class Functor_on_split_ >
|
class Functor_on_split_,
|
||||||
|
class WithID>
|
||||||
class Cell_attribute_with_point<LCC, void, Tag,
|
class Cell_attribute_with_point<LCC, void, Tag,
|
||||||
Functor_on_merge_, Functor_on_split_> :
|
Functor_on_merge_, Functor_on_split_,
|
||||||
public Cell_attribute<LCC, void, Tag, Functor_on_merge_, Functor_on_split_>,
|
WithID>:
|
||||||
|
public Cell_attribute<LCC, void,
|
||||||
|
Tag, Functor_on_merge_, Functor_on_split_, WithID>,
|
||||||
public Point_for_cell<typename LCC::Point>
|
public Point_for_cell<typename LCC::Point>
|
||||||
{
|
{
|
||||||
template <class, class, class, class>
|
template <class, class, class, class>
|
||||||
|
|
@ -126,7 +130,7 @@ namespace CGAL {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef Cell_attribute<LCC, void, Tag,
|
typedef Cell_attribute<LCC, void, Tag,
|
||||||
Functor_on_merge_, Functor_on_split_> Base1;
|
Functor_on_merge_, Functor_on_split_, WithID> Base1;
|
||||||
typedef Point_for_cell<typename LCC::Point> Base2;
|
typedef Point_for_cell<typename LCC::Point> Base2;
|
||||||
|
|
||||||
typedef void Info;
|
typedef void Info;
|
||||||
|
|
@ -156,6 +160,63 @@ namespace CGAL {
|
||||||
Cell_attribute_with_point(const Point& apoint) : Base2(apoint)
|
Cell_attribute_with_point(const Point& apoint) : Base2(apoint)
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// A cell attribute with point and id, when Info_!=void
|
||||||
|
template <class Refs, class Info_=void, class Tag_=Tag_true,
|
||||||
|
class OnMerge=Null_functor,
|
||||||
|
class OnSplit=Null_functor>
|
||||||
|
class Cell_attribute_with_point_and_id: public
|
||||||
|
Cell_attribute_with_point<Refs, Info_, Tag_, OnMerge, OnSplit, Tag_true>
|
||||||
|
{
|
||||||
|
typedef Cell_attribute_with_point
|
||||||
|
<Refs, Info_, Tag_, OnMerge, OnSplit, Tag_true> Base;
|
||||||
|
typedef typename Refs::Point Point;
|
||||||
|
|
||||||
|
template <class, class, class, class>
|
||||||
|
friend class Compact_container;
|
||||||
|
|
||||||
|
template <class, class>
|
||||||
|
friend class Concurrent_compact_container;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
/// Default contructor.
|
||||||
|
Cell_attribute_with_point_and_id()
|
||||||
|
{}
|
||||||
|
|
||||||
|
/// Contructor with an info in parameter.
|
||||||
|
Cell_attribute_with_point_and_id(const Point& apoint) : Base(apoint)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/// Contructor with a point and an attribute in parameters.
|
||||||
|
Cell_attribute_with_point_and_id(const Point& apoint, const Info_& ainfo) :
|
||||||
|
Base(apoint, ainfo)
|
||||||
|
{}
|
||||||
|
};
|
||||||
|
|
||||||
|
/// Specialization when Info==void.
|
||||||
|
template <class Refs, class Tag_, class OnMerge, class OnSplit>
|
||||||
|
class Cell_attribute_with_point_and_id<Refs, void, Tag_, OnMerge, OnSplit>:
|
||||||
|
public Cell_attribute_with_point<Refs, void, Tag_, OnMerge, OnSplit, Tag_true>
|
||||||
|
{
|
||||||
|
typedef Cell_attribute_with_point
|
||||||
|
<Refs, void, Tag_, OnMerge, OnSplit, Tag_true> Base;
|
||||||
|
typedef typename Refs::Point Point;
|
||||||
|
|
||||||
|
template <class, class, class, class>
|
||||||
|
friend class Compact_container;
|
||||||
|
|
||||||
|
template <class, class>
|
||||||
|
friend class Concurrent_compact_container;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
/// Default contructor.
|
||||||
|
Cell_attribute_with_point_and_id()
|
||||||
|
{}
|
||||||
|
|
||||||
|
/// Contructor with a point in parameter.
|
||||||
|
Cell_attribute_with_point_and_id(const Point& apoint) : Base(apoint)
|
||||||
|
{}
|
||||||
|
};
|
||||||
} // namespace CGAL
|
} // namespace CGAL
|
||||||
|
|
||||||
#endif // CGAL_CELL_ATTRIBUTE_WITH_POINT_H //
|
#endif // CGAL_CELL_ATTRIBUTE_WITH_POINT_H //
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,9 @@ namespace CGAL {
|
||||||
|
|
||||||
typedef typename internal::template Get_dart_info<Dart_wrapper>::type
|
typedef typename internal::template Get_dart_info<Dart_wrapper>::type
|
||||||
Dart_info;
|
Dart_info;
|
||||||
typedef CGAL::Dart<d_, Self, Dart_info> Dart;
|
typedef typename internal::template Get_darts_with_id<Dart_wrapper>::type
|
||||||
|
Darts_with_id;
|
||||||
|
typedef CGAL::Dart<d_, Self, Dart_info, Darts_with_id> Dart;
|
||||||
|
|
||||||
typedef typename Alloc_::template rebind<Dart>::other Dart_allocator;
|
typedef typename Alloc_::template rebind<Dart>::other Dart_allocator;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,9 +19,9 @@ struct Myitem
|
||||||
template<class Refs>
|
template<class Refs>
|
||||||
struct Dart_wrapper
|
struct Dart_wrapper
|
||||||
{
|
{
|
||||||
typedef CGAL::Dart<2, Refs > Dart;
|
typedef CGAL::Tag_true Darts_with_id;
|
||||||
typedef CGAL::Cell_attribute_with_point< Refs > Vertex_attribute;
|
typedef CGAL::Cell_attribute_with_point_and_id< Refs > Vertex_attribute;
|
||||||
typedef CGAL::Cell_attribute< Refs > Face_attribute;
|
typedef CGAL::Cell_attribute_with_id< Refs > Face_attribute;
|
||||||
typedef CGAL::cpp11::tuple<Vertex_attribute, void, Face_attribute> Attributes;
|
typedef CGAL::cpp11::tuple<Vertex_attribute, void, Face_attribute> Attributes;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue