mirror of https://github.com/CGAL/cgal
Start to integrate the index class into the compact container with index.
This commit is contained in:
parent
8cd88542de
commit
7efb4bdbda
|
|
@ -389,7 +389,7 @@ namespace CGAL {
|
|||
template < unsigned int, typename>
|
||||
friend struct GMap_dart;
|
||||
|
||||
template <class, class, class>
|
||||
template <class, class, class, class>
|
||||
friend class Compact_container_with_index;
|
||||
|
||||
template<typename, unsigned int, typename>
|
||||
|
|
@ -498,7 +498,7 @@ namespace CGAL {
|
|||
template <unsigned int, typename>
|
||||
friend struct GMap_dart;
|
||||
|
||||
template <class, class, class>
|
||||
template <class, class, class, class>
|
||||
friend class Compact_container_with_index;
|
||||
|
||||
template<typename, unsigned int, typename>
|
||||
|
|
@ -610,7 +610,7 @@ namespace CGAL {
|
|||
template < unsigned int, class, class, class, class >
|
||||
friend class Combinatorial_map_base;
|
||||
|
||||
template <class, class, class>
|
||||
template <class, class, class, class>
|
||||
friend class Compact_container_with_index;
|
||||
|
||||
public:
|
||||
|
|
@ -639,7 +639,7 @@ namespace CGAL {
|
|||
template < unsigned int, class, class, class, class >
|
||||
friend class Combinatorial_map_base;
|
||||
|
||||
template <class, class, class>
|
||||
template <class, class, class, class>
|
||||
friend class Compact_container_with_index;
|
||||
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -403,26 +403,6 @@ namespace CGAL {
|
|||
// Thus we initialize null_dart_handle in the Combinatorial_map constructor
|
||||
#endif // CGAL_CMAP_DEPRECATED
|
||||
|
||||
template<typename T>
|
||||
class MyIndex
|
||||
{
|
||||
public:
|
||||
MyIndex(size_t s=-1) : idx(s)
|
||||
{}
|
||||
operator size_t() const
|
||||
{ return idx; }
|
||||
MyIndex<T>& operator++()
|
||||
{ ++idx; return *this; }
|
||||
MyIndex<T> operator++(int)
|
||||
{ MyIndex<T> res(*this); ++idx; return res; }
|
||||
MyIndex<T>& operator--()
|
||||
{ --idx; return *this; }
|
||||
MyIndex<T> operator--(int)
|
||||
{MyIndex<T> res(*this); --idx; return res;}
|
||||
private:
|
||||
T idx;
|
||||
};
|
||||
|
||||
// Storage with combinatorial maps using index
|
||||
template<unsigned int d_, class Items_, class Alloc_>
|
||||
class Combinatorial_map_storage_2
|
||||
|
|
@ -436,12 +416,13 @@ private:
|
|||
typedef typename Dart_wrapper::Dart Dart;
|
||||
typedef typename Alloc_::template rebind<Dart>::other Dart_allocator;
|
||||
|
||||
typedef unsigned int size_type; // Type used as index.
|
||||
|
||||
typedef Compact_container_with_index_2<Dart,Dart_allocator,
|
||||
Constant_size_policy_for_cc_with_size<1024> >
|
||||
Constant_size_policy_for_cc_with_size<1024>, size_type >
|
||||
Dart_container;
|
||||
|
||||
typedef CGAL::Tag_true Use_index;
|
||||
typedef typename Dart_container::size_type size_type;
|
||||
|
||||
typedef Items_ Items;
|
||||
typedef Alloc_ Alloc;
|
||||
|
|
@ -450,7 +431,7 @@ private:
|
|||
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> >
|
||||
Constant_size_policy_for_cc_with_size<1024>, size_type >
|
||||
{};
|
||||
|
||||
/// Typedef for attributes
|
||||
|
|
@ -460,17 +441,12 @@ private:
|
|||
struct Attribute_type: public Helper::template Attribute_type<i>
|
||||
{};
|
||||
template<int i>
|
||||
struct Attribute_handle: public CGAL::MyIndex<unsigned int> // public Helper::template Attribute_handle<i>
|
||||
{
|
||||
explicit Attribute_handle(size_t s=-1) : MyIndex<unsigned int>(s)
|
||||
{}
|
||||
};
|
||||
struct Attribute_handle: public Helper::template Attribute_handle<i>
|
||||
{};
|
||||
template<int i>
|
||||
struct Attribute_const_handle:public CGAL::MyIndex<unsigned int>//Helper::template Attribute_const_handle<i>
|
||||
{
|
||||
explicit Attribute_const_handle(size_t s=-1) : MyIndex<unsigned int>(s)
|
||||
{}
|
||||
};
|
||||
struct Attribute_const_handle:
|
||||
public Helper::template Attribute_const_handle<i>
|
||||
{};
|
||||
template<int i>
|
||||
struct Attribute_range: public Helper::template Attribute_range<i>
|
||||
{};
|
||||
|
|
@ -487,11 +463,7 @@ private:
|
|||
|
||||
// typedef unsigned int Dart_index;
|
||||
// typedef MyIndex<unsigned int> Dart_index;
|
||||
struct Dart_index : public CGAL::MyIndex<unsigned int>
|
||||
{
|
||||
explicit Dart_index(size_t s=-1) : MyIndex<unsigned int>(s)
|
||||
{}
|
||||
};
|
||||
typedef typename Dart_container::Index Dart_index;
|
||||
|
||||
// Definition of old types, for backward compatibility.
|
||||
typedef Dart_index Dart_handle;
|
||||
|
|
|
|||
|
|
@ -135,34 +135,21 @@ public:
|
|||
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
|
||||
static const size_type bottom;
|
||||
|
||||
class handle : public internal::Handle<T,size_type>
|
||||
class Index : public internal::MyIndex<T,size_type>
|
||||
{
|
||||
public:
|
||||
|
||||
typedef typename Compact_container_with_index::size_type size_type;
|
||||
typedef internal::MyIndex<T,size_type> Base;
|
||||
|
||||
explicit handle(size_type _idx= (std::numeric_limits<size_type>::max)()/2)
|
||||
: Handle<T,size_type>(_idx)
|
||||
explicit Index(size_type idx=(std::numeric_limits<size_type>::max)()/2)
|
||||
: Base(idx)
|
||||
{}
|
||||
|
||||
handle(const_iterator it)
|
||||
: Handle<T,size_type>(it)
|
||||
Index(const const_iterator& it) : Base(it)
|
||||
{}
|
||||
|
||||
handle(iterator it)
|
||||
: Handle<T,size_type>(it)
|
||||
Index(const iterator& it) : Base(it)
|
||||
{}
|
||||
|
||||
bool operator==(const handle& rhs) const
|
||||
{
|
||||
return idx() == rhs.idx();
|
||||
}
|
||||
|
||||
bool operator<(const handle& rhs) const
|
||||
{
|
||||
return idx() < rhs.idx();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
friend class internal::CC_iterator_with_index<Self, false>;
|
||||
|
|
@ -640,13 +627,10 @@ private:
|
|||
// Sets the pointer part and the type of the pointee.
|
||||
static void static_set_type(T& e, Type t)
|
||||
{
|
||||
// This out of range compare is always true and causes lots of
|
||||
// unnecessary warnings.
|
||||
// CGAL_precondition(0 <= t && t < 2);
|
||||
Traits::size_t(e) &= ( ~mask_type | ( ((size_type)t) <<(nbbits_size_type_m1) ) );
|
||||
}
|
||||
|
||||
// get the value of the element (removing the two bits)
|
||||
// get the value of the element (removing the used bit)
|
||||
static size_type static_get_val(const T& e)
|
||||
{ return (Traits::size_t(e) & ~mask_type); }
|
||||
|
||||
|
|
@ -692,7 +676,7 @@ private:
|
|||
All_items all_items;
|
||||
};
|
||||
template < class T, class Allocator, class Increment_policy, class IndexType >
|
||||
const typename Compact_container_with_index<T, Allocator, Increment_policy, IndexType>::size_type Compact_container_with_index<T, Allocator, Increment_policy, IndexType>::bottom = (std::numeric_limits<typename Compact_container_with_index<T, Allocator, Increment_policy, IndexType>::size_type>::max)()/2 -1;
|
||||
const typename Compact_container_with_index<T, Allocator, Increment_policy, IndexType>::size_type Compact_container_with_index<T, Allocator, Increment_policy, IndexType>::bottom = (std::numeric_limits<typename Compact_container_with_index<T, Allocator, Increment_policy, IndexType>::size_type>::max)()/2;
|
||||
|
||||
/*template < class T, class Allocator, class Increment_policy >
|
||||
void Compact_container_with_index<T, Allocator, Increment_policy>::merge(Self &d)
|
||||
|
|
@ -952,77 +936,67 @@ namespace internal {
|
|||
}*/
|
||||
|
||||
template<typename T, typename IT >
|
||||
class Handle
|
||||
class MyIndex
|
||||
{
|
||||
public:
|
||||
|
||||
typedef MyIndex<T,IT> Self;
|
||||
typedef IT size_type;
|
||||
|
||||
/// Constructor. Default construction creates an invalid handle.
|
||||
explicit Handle(size_type _idx= (std::numeric_limits<size_type>::max)()/2) : idx_(_idx) {}
|
||||
/// Constructor. Default construction creates a kind of "NULL" index.
|
||||
/// max/2 because the most significant bit must be equal to 0 (used).
|
||||
explicit MyIndex(size_type idx=(std::numeric_limits<size_type>::max)()/2)
|
||||
: m_idx(idx)
|
||||
{}
|
||||
|
||||
/// Get the underlying index of this handle
|
||||
size_type idx() const { return idx_; }
|
||||
/// Get the underlying index
|
||||
operator size_t() const
|
||||
{ return m_idx; }
|
||||
|
||||
size_type& idx() { return idx_; }
|
||||
|
||||
/// reset handle to be invalid
|
||||
void reset() { idx_= (std::numeric_limits<size_type>::max)()/2; }
|
||||
/// reset index to be NULL
|
||||
void reset()
|
||||
{ m_idx = (std::numeric_limits<size_type>::max)()/2; }
|
||||
|
||||
/// return whether the handle is valid
|
||||
bool is_valid() const { return idx_ != (std::numeric_limits<size_type>::max)()/2; }
|
||||
bool is_valid() const
|
||||
{ return m_idx != (std::numeric_limits<size_type>::max)()/2; }
|
||||
|
||||
/// are two handles equal?
|
||||
bool operator==(const T& _rhs) const {
|
||||
return idx_ == _rhs.idx_;
|
||||
}
|
||||
/// are two indices equal?
|
||||
bool operator==(const Self& rhs) const
|
||||
{ return m_idx == rhs.m_idx; }
|
||||
|
||||
/// are two handles different?
|
||||
bool operator!=(const Handle<T,IT>& _rhs) const {
|
||||
return idx_ != _rhs.idx_;
|
||||
}
|
||||
bool operator!=(const Self& rhs) const
|
||||
{ return m_idx != rhs.m_idx; }
|
||||
|
||||
/// Comparison by index.
|
||||
bool operator<(const Handle<T,IT>& _rhs) const {
|
||||
return idx_ < _rhs.idx_;
|
||||
}
|
||||
/// Comparisons
|
||||
bool operator<(const Self& rhs) const
|
||||
{ return m_idx < rhs.m_idx; }
|
||||
bool operator>(const Self& rhs) const
|
||||
{ return m_idx > rhs.m_idx; }
|
||||
bool operator<=(const Self& rhs) const
|
||||
{ return m_idx <= rhs.m_idx; }
|
||||
bool operator>=(const Self& rhs) const
|
||||
{ return m_idx >= rhs.m_idx; }
|
||||
|
||||
/// Increment the internal index. This operations does not
|
||||
/// guarantee that the index is valid or undeleted after the
|
||||
/// increment.
|
||||
Handle& operator++() { ++idx_; return *this; }
|
||||
Self& operator++() { ++m_idx; return *this; }
|
||||
/// Decrement the internal index. This operations does not
|
||||
/// guarantee that the index is valid or undeleted after the
|
||||
/// decrement.
|
||||
Handle& operator--() { --idx_; return *this; }
|
||||
Self& operator--() { --m_idx; return *this; }
|
||||
|
||||
/// Increment the internal index. This operations does not
|
||||
/// guarantee that the index is valid or undeleted after the
|
||||
/// increment.
|
||||
Handle operator++(int) { Handle tmp(*this); ++idx_; return tmp; }
|
||||
Self operator++(int) { Self tmp(*this); ++m_idx; return tmp; }
|
||||
/// Decrement the internal index. This operations does not
|
||||
/// guarantee that the index is valid or undeleted after the
|
||||
/// decrement.
|
||||
Handle operator--(int) { Handle tmp(*this); --idx_; return tmp; }
|
||||
Self operator--(int) { Self tmp(*this); --m_idx; return tmp; }
|
||||
private:
|
||||
size_type idx_;
|
||||
};
|
||||
|
||||
template<typename T, typename IT1, typename IT2 >
|
||||
class Handle2 : public Handle<T,IT2>
|
||||
{
|
||||
typedef Handle<T,IT2> Base;
|
||||
public:
|
||||
|
||||
/// Constructor. Default construction creates an invalid handle.
|
||||
explicit Handle2(size_type _cc_idx, size_type _idx = (std::numeric_limits<size_type>::max)()/2)
|
||||
: Base(_idx), cc_idx_(_cc_idx) {}
|
||||
|
||||
size_type cc_idx() const { return cc_idx_; }
|
||||
|
||||
size_type& cc_idx() { return cc_idx_; }
|
||||
public:
|
||||
size_type cc_idx_;
|
||||
size_type m_idx;
|
||||
};
|
||||
|
||||
} // namespace internal
|
||||
|
|
|
|||
|
|
@ -95,34 +95,21 @@ public:
|
|||
|
||||
static const size_type bottom;
|
||||
|
||||
class handle : public internal::Handle<T,size_type>
|
||||
class Index : public internal::MyIndex<T,size_type>
|
||||
{
|
||||
public:
|
||||
|
||||
typedef typename Compact_container_with_index_2::size_type size_type;
|
||||
typedef internal::MyIndex<T,size_type> Base;
|
||||
|
||||
explicit handle(size_type _idx= (std::numeric_limits<size_type>::max)()/2)
|
||||
: Handle<T,size_type>(_idx)
|
||||
explicit Index(size_type idx=(std::numeric_limits<size_type>::max)()/2)
|
||||
: Base(idx)
|
||||
{}
|
||||
|
||||
handle(const_iterator it)
|
||||
: Handle<T,size_type>(it)
|
||||
Index(const const_iterator& it) : Base(it)
|
||||
{}
|
||||
|
||||
handle(iterator it)
|
||||
: Handle<T,size_type>(it)
|
||||
Index(const iterator& it) : Base(it)
|
||||
{}
|
||||
|
||||
bool operator==(const handle& rhs) const
|
||||
{
|
||||
return idx() == rhs.idx();
|
||||
}
|
||||
|
||||
bool operator<(const handle& rhs) const
|
||||
{
|
||||
return idx() < rhs.idx();
|
||||
}
|
||||
|
||||
};
|
||||
friend class internal::CC_iterator_with_index<Self, false>;
|
||||
friend class internal::CC_iterator_with_index<Self, true>;
|
||||
|
|
@ -240,12 +227,12 @@ public:
|
|||
// (just forward the arguments to the constructor, to optimize a copy).
|
||||
#ifndef CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES
|
||||
template < typename... Args >
|
||||
size_type emplace(const Args&... args)
|
||||
Index emplace(const Args&... args)
|
||||
{
|
||||
if (free_list == bottom)
|
||||
allocate_new_block();
|
||||
|
||||
size_type ret = free_list;
|
||||
Index ret = free_list;
|
||||
T& e = operator[](free_list);
|
||||
static_set_type(e, USED);
|
||||
free_list = static_get_val(e);
|
||||
|
|
@ -255,12 +242,12 @@ public:
|
|||
}
|
||||
#else
|
||||
// inserts a default constructed item.
|
||||
size_type emplace()
|
||||
Index emplace()
|
||||
{
|
||||
if (free_list == bottom)
|
||||
allocate_new_block();
|
||||
|
||||
size_type ret = free_list;
|
||||
Index ret(free_list);
|
||||
T& e = operator[](free_list);
|
||||
static_set_type(e, USED);
|
||||
free_list = static_get_val(e);
|
||||
|
|
@ -271,13 +258,12 @@ public:
|
|||
}
|
||||
|
||||
template < typename T1 >
|
||||
size_type
|
||||
emplace(const T1 &t1)
|
||||
Index emplace(const T1 &t1)
|
||||
{
|
||||
if (free_list == bottom)
|
||||
allocate_new_block();
|
||||
|
||||
size_type ret = free_list;
|
||||
Index ret(free_list);
|
||||
T& e = operator[](free_list);
|
||||
static_set_type(e, USED);
|
||||
free_list = static_get_val(e);
|
||||
|
|
@ -287,13 +273,12 @@ public:
|
|||
}
|
||||
|
||||
template < typename T1, typename T2 >
|
||||
size_type
|
||||
emplace(const T1 &t1, const T2 &t2)
|
||||
Index emplace(const T1 &t1, const T2 &t2)
|
||||
{
|
||||
if (free_list == bottom)
|
||||
allocate_new_block();
|
||||
|
||||
size_type ret = free_list;
|
||||
Index ret(free_list);
|
||||
T& e = operator[](free_list);
|
||||
static_set_type(e, USED);
|
||||
free_list = static_get_val(e);
|
||||
|
|
@ -303,13 +288,12 @@ public:
|
|||
}
|
||||
|
||||
template < typename T1, typename T2, typename T3 >
|
||||
size_type
|
||||
emplace(const T1 &t1, const T2 &t2, const T3 &t3)
|
||||
Index emplace(const T1 &t1, const T2 &t2, const T3 &t3)
|
||||
{
|
||||
if (free_list == bottom)
|
||||
allocate_new_block();
|
||||
|
||||
size_type ret = free_list;
|
||||
Index ret(free_list);
|
||||
T& e = operator[](free_list);
|
||||
static_set_type(e, USED);
|
||||
free_list = static_get_val(e);
|
||||
|
|
@ -319,13 +303,12 @@ public:
|
|||
}
|
||||
|
||||
template < typename T1, typename T2, typename T3, typename T4 >
|
||||
size_type
|
||||
emplace(const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4)
|
||||
Index emplace(const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4)
|
||||
{
|
||||
if (free_list == bottom)
|
||||
allocate_new_block();
|
||||
|
||||
size_type ret = free_list;
|
||||
Index ret(free_list);
|
||||
T& e = operator[](free_list);
|
||||
static_set_type(e, USED);
|
||||
free_list = static_get_val(e);
|
||||
|
|
@ -335,14 +318,13 @@ public:
|
|||
}
|
||||
|
||||
template < typename T1, typename T2, typename T3, typename T4, typename T5 >
|
||||
size_type
|
||||
emplace(const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4,
|
||||
Index emplace(const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4,
|
||||
const T5 &t5)
|
||||
{
|
||||
if (free_list == bottom)
|
||||
allocate_new_block();
|
||||
|
||||
size_type ret = free_list;
|
||||
Index ret(free_list);
|
||||
T& e = operator[](free_list);
|
||||
static_set_type(e, USED);
|
||||
free_list = static_get_val(e);
|
||||
|
|
@ -353,14 +335,13 @@ public:
|
|||
|
||||
template < typename T1, typename T2, typename T3, typename T4,
|
||||
typename T5, typename T6 >
|
||||
size_type
|
||||
emplace(const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4,
|
||||
Index emplace(const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4,
|
||||
const T5 &t5, const T6 &t6)
|
||||
{
|
||||
if (free_list == bottom)
|
||||
allocate_new_block();
|
||||
|
||||
size_type ret = free_list;
|
||||
Index ret(free_list);
|
||||
T& e = operator[](free_list);
|
||||
static_set_type(e, USED);
|
||||
free_list = static_get_val(e);
|
||||
|
|
@ -371,14 +352,13 @@ public:
|
|||
|
||||
template < typename T1, typename T2, typename T3, typename T4,
|
||||
typename T5, typename T6, typename T7 >
|
||||
size_type
|
||||
emplace(const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4,
|
||||
Index emplace(const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4,
|
||||
const T5 &t5, const T6 &t6, const T7 &t7)
|
||||
{
|
||||
if (free_list == bottom)
|
||||
allocate_new_block();
|
||||
|
||||
size_type ret = free_list;
|
||||
Index ret(free_list);
|
||||
T& e = operator[](free_list);
|
||||
static_set_type(e, USED);
|
||||
free_list = static_get_val(e);
|
||||
|
|
@ -389,14 +369,13 @@ public:
|
|||
|
||||
template < typename T1, typename T2, typename T3, typename T4,
|
||||
typename T5, typename T6, typename T7, typename T8 >
|
||||
size_type
|
||||
emplace(const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4,
|
||||
Index emplace(const T1 &t1, const T2 &t2, const T3 &t3, const T4 &t4,
|
||||
const T5 &t5, const T6 &t6, const T7 &t7, const T8 &t8)
|
||||
{
|
||||
if (free_list == bottom)
|
||||
allocate_new_block();
|
||||
|
||||
size_type ret = free_list;
|
||||
Index ret(free_list);
|
||||
T& e = operator[](free_list);
|
||||
static_set_type(e, USED);
|
||||
free_list = static_get_val(e);
|
||||
|
|
@ -406,12 +385,12 @@ public:
|
|||
}
|
||||
#endif // CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES
|
||||
|
||||
size_type insert(const T &t)
|
||||
Index insert(const T &t)
|
||||
{
|
||||
if (free_list == bottom)
|
||||
allocate_new_block();
|
||||
|
||||
size_type ret = free_list;
|
||||
Index ret(free_list);
|
||||
T& e = operator[](free_list);
|
||||
static_set_type(e, USED);
|
||||
free_list = static_get_val(e);
|
||||
|
|
@ -434,7 +413,7 @@ public:
|
|||
insert(first, last);
|
||||
}
|
||||
|
||||
void erase(size_type x)
|
||||
void erase(Index x)
|
||||
{
|
||||
CGAL_precondition(type(x) == USED);
|
||||
T& e = operator[](x);
|
||||
|
|
@ -563,7 +542,7 @@ private:
|
|||
// Get the type of the pointee.
|
||||
static Type static_type(const T& e)
|
||||
// TODO check if this is ok for little and big endian
|
||||
{ return (Type) ((Traits::size_t(e) & mask_type)>>(nbbits_size_type_m1)); }
|
||||
{ return (Type) ((size_type(e) & mask_type)>>(nbbits_size_type_m1)); }
|
||||
|
||||
Type type(size_type e) const
|
||||
{ return static_type(operator[](e)); }
|
||||
|
|
@ -574,19 +553,19 @@ private:
|
|||
// This out of range compare is always true and causes lots of
|
||||
// unnecessary warnings.
|
||||
// CGAL_precondition(0 <= t && t < 2);
|
||||
Traits::size_t(e) &= ( ~mask_type | ( ((size_type)t) <<(nbbits_size_type_m1) ) );
|
||||
size_type(e) &= ( ~mask_type | ( ((size_type)t) <<(nbbits_size_type_m1) ) );
|
||||
}
|
||||
|
||||
// get the value of the element (removing the two bits)
|
||||
static size_type static_get_val(const T& e)
|
||||
{ return (Traits::size_t(e) & ~mask_type); }
|
||||
{ return (size_type(e) & ~mask_type); }
|
||||
|
||||
size_type get_val(size_type e) const
|
||||
{ return static_get_val(operator[](e)); }
|
||||
|
||||
// set the value of the element and its type
|
||||
static void static_set_val(T& e, size_type v, Type t)
|
||||
{ Traits::size_t(e)=v | ( ((size_type)t) <<(nbbits_size_type_m1)); }
|
||||
{ size_type(e)=v | ( ((size_type)t) <<(nbbits_size_type_m1)); }
|
||||
|
||||
void set_val(size_type e, size_type v, Type t)
|
||||
{ static_set_val(operator[](e), v, t); }
|
||||
|
|
@ -616,7 +595,7 @@ private:
|
|||
|
||||
template < class T, class Allocator, class Increment_policy, class IndexType >
|
||||
const typename Compact_container_with_index_2<T, Allocator, Increment_policy, IndexType>::size_type
|
||||
Compact_container_with_index_2<T, Allocator, Increment_policy, IndexType>::bottom = (std::numeric_limits<typename Compact_container_with_index_2<T, Allocator, Increment_policy, IndexType>::size_type>::max)()/2 -1;
|
||||
Compact_container_with_index_2<T, Allocator, Increment_policy, IndexType>::bottom = (std::numeric_limits<typename Compact_container_with_index_2<T, Allocator, Increment_policy, IndexType>::size_type>::max)()/2;
|
||||
|
||||
/*template < class T, class Allocator, class Increment_policy, class IndexType >
|
||||
void Compact_container_with_index<T, Allocator, Increment_policy, IndexType>::merge(Self &d)
|
||||
|
|
|
|||
|
|
@ -68,10 +68,10 @@ namespace CGAL {
|
|||
template <class, class, class, class>
|
||||
friend class Compact_container;
|
||||
|
||||
template <class, class, class>
|
||||
template <class, class, class, class>
|
||||
friend class Compact_container_with_index;
|
||||
|
||||
template <class, class, class>
|
||||
template <class, class, class, class>
|
||||
friend class Compact_container_with_index_2;
|
||||
|
||||
template<class, unsigned int, unsigned int>
|
||||
|
|
@ -365,10 +365,10 @@ namespace CGAL {
|
|||
template <class, class, class, class>
|
||||
friend class Compact_container;
|
||||
|
||||
template <class, class, class>
|
||||
template <class, class, class, class>
|
||||
friend class Compact_container_with_index;
|
||||
|
||||
template <class, class, class>
|
||||
template <class, class, class, class>
|
||||
friend class Compact_container_with_index_2;
|
||||
|
||||
template<class, unsigned int, unsigned int>
|
||||
|
|
@ -538,17 +538,13 @@ namespace CGAL {
|
|||
|
||||
public:
|
||||
size_type for_compact_container_with_index() const
|
||||
{ return st; }
|
||||
{ return mbeta[0]; }
|
||||
size_type& for_compact_container_with_index()
|
||||
{ return st; }
|
||||
{ return mbeta[0]; }
|
||||
|
||||
protected:
|
||||
union
|
||||
{
|
||||
size_type st;
|
||||
/// Beta for each dimension +1 (from 0 to dimension).
|
||||
Dart_handle mbeta[dimension+1];
|
||||
};
|
||||
|
||||
/// Values of Boolean marks.
|
||||
mutable std::bitset<NB_MARKS> mmarks;
|
||||
|
|
|
|||
|
|
@ -393,17 +393,27 @@ namespace CGAL
|
|||
typedef typename CMap::template Container_for_attributes<T> type;
|
||||
};
|
||||
|
||||
template<typename T, typename WithIndex=typename CMap::Use_index>
|
||||
struct GetIndexOrHandle
|
||||
{ typedef typename T::iterator type; };
|
||||
template<typename T>
|
||||
struct GetIndexOrHandle<T, Tag_true>
|
||||
{ typedef typename T::Index type; };
|
||||
template<typename T, typename WithIndex=typename CMap::Use_index>
|
||||
struct GetConstIndexOrConstHandle
|
||||
{ typedef typename T::const_iterator type; };
|
||||
template<typename T>
|
||||
struct GetConstIndexOrConstHandle<T, Tag_true>
|
||||
{ typedef typename T::Index type; };
|
||||
|
||||
// defines as type Compact_container<T>::iterator
|
||||
template <class T>
|
||||
struct Add_compact_container_iterator{
|
||||
typedef typename CMap::Alloc::template rebind<T>::other Attr_allocator;
|
||||
typedef typename CMap::template Container_for_attributes<T>::iterator
|
||||
iterator_type;
|
||||
|
||||
// TODO case when there is no Use_index typedef in CMap
|
||||
typedef typename boost::mpl::if_
|
||||
< typename boost::is_same<typename CMap::Use_index,Tag_true>::type,
|
||||
typename CMap::Dart_handle, iterator_type >::type type;
|
||||
typedef typename GetIndexOrHandle
|
||||
<typename CMap::template Container_for_attributes<T> >::type type;
|
||||
};
|
||||
|
||||
// defines as type Compact_container<T>::const_iterator
|
||||
|
|
@ -412,10 +422,8 @@ namespace CGAL
|
|||
typedef typename CMap::Alloc::template rebind<T>::other Attr_allocator;
|
||||
typedef typename CMap::template Container_for_attributes<T>::
|
||||
const_iterator iterator_type;
|
||||
|
||||
typedef typename boost::mpl::if_
|
||||
< typename boost::is_same<typename CMap::Use_index,Tag_true>::type,
|
||||
typename CMap::Dart_handle, iterator_type >::type type;
|
||||
typedef typename GetConstIndexOrConstHandle
|
||||
<typename CMap::template Container_for_attributes<T> >::type type;
|
||||
};
|
||||
|
||||
// All the attributes (with CGAL::Void)
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ namespace CGAL {
|
|||
template <class, class, class, class>
|
||||
friend class Compact_container;
|
||||
|
||||
template <class, class, class>
|
||||
template <class, class, class, class>
|
||||
friend class Compact_container_with_index;
|
||||
|
||||
template <class, class, class>
|
||||
|
|
@ -130,11 +130,11 @@ namespace CGAL {
|
|||
template <class, class, class, class>
|
||||
friend class Compact_container;
|
||||
|
||||
template <class, class, class>
|
||||
template <class, class, class, class>
|
||||
friend class Compact_container_with_index;
|
||||
|
||||
template <class, class, class>
|
||||
friend class Compact_container_2;
|
||||
template <class, class, class, class>
|
||||
friend class Compact_container_with_index_2;
|
||||
|
||||
public:
|
||||
typedef Cell_attribute<LCC, void, Tag,
|
||||
|
|
@ -182,7 +182,7 @@ namespace CGAL {
|
|||
template < unsigned int, class, class, class, class >
|
||||
friend class Combinatorial_map_base;
|
||||
|
||||
template <class, class, class>
|
||||
template <class, class, class, class>
|
||||
friend class Compact_container_with_index;
|
||||
|
||||
public:
|
||||
|
|
@ -238,7 +238,7 @@ namespace CGAL {
|
|||
template < unsigned int, class, class, class, class >
|
||||
friend class Combinatorial_map_base;
|
||||
|
||||
template <class, class, class>
|
||||
template <class, class, class, class>
|
||||
friend class Compact_container_with_index;
|
||||
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -449,12 +449,13 @@ namespace CGAL {
|
|||
typedef typename Dart_wrapper::Dart Dart;
|
||||
typedef typename Alloc_::template rebind<Dart>::other Dart_allocator;
|
||||
|
||||
typedef unsigned int size_type; // Type used as index.
|
||||
|
||||
typedef Compact_container_with_index_2<Dart,Dart_allocator,
|
||||
Constant_size_policy_for_cc_with_size<1024> >
|
||||
Constant_size_policy_for_cc_with_size<1024>, size_type >
|
||||
Dart_container;
|
||||
|
||||
typedef CGAL::Tag_true Use_index;
|
||||
typedef typename Dart_container::size_type size_type;
|
||||
|
||||
typedef Items_ Items;
|
||||
typedef Alloc_ Alloc;
|
||||
|
|
@ -463,7 +464,7 @@ namespace CGAL {
|
|||
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> >
|
||||
Constant_size_policy_for_cc_with_size<1024>, size_type >
|
||||
{};
|
||||
|
||||
/// Typedef for attributes
|
||||
|
|
@ -473,23 +474,12 @@ namespace CGAL {
|
|||
struct Attribute_type: public Helper::template Attribute_type<i>
|
||||
{};
|
||||
template<int i>
|
||||
struct MyAttribute_handle: public CGAL::MyIndex<unsigned int> // public Helper::template Attribute_handle<i>
|
||||
{
|
||||
MyAttribute_handle(size_t s=-1) : MyIndex<unsigned int>(s)
|
||||
{}
|
||||
};
|
||||
struct Attribute_handle: public Helper::template Attribute_handle<i>
|
||||
{};
|
||||
template<int i>
|
||||
struct Attribute_handle
|
||||
{typedef MyAttribute_handle<i> type;};
|
||||
template<int i>
|
||||
struct MyAttribute_const_handle:public CGAL::MyIndex<unsigned int>//Helper::template Attribute_const_handle<i>
|
||||
{
|
||||
MyAttribute_const_handle(size_t s=-1) : MyIndex<unsigned int>(s)
|
||||
{}
|
||||
};
|
||||
template<int i>
|
||||
struct Attribute_const_handle
|
||||
{typedef MyAttribute_const_handle<i> type;};
|
||||
struct Attribute_const_handle:
|
||||
public Helper::template Attribute_const_handle<i>
|
||||
{};
|
||||
template<int i>
|
||||
struct Attribute_range: public Helper::template Attribute_range<i>
|
||||
{};
|
||||
|
|
@ -505,11 +495,7 @@ namespace CGAL {
|
|||
static const unsigned int dimension = d_;
|
||||
|
||||
// typedef unsigned int Dart_index;
|
||||
struct Dart_index : public CGAL::MyIndex<unsigned int>
|
||||
{
|
||||
Dart_index(size_t s=-1) : MyIndex<unsigned int>(s)
|
||||
{}
|
||||
};
|
||||
typedef typename Dart_container::Index Dart_index;
|
||||
|
||||
// Definition of old types, for backward compatibility.
|
||||
typedef Dart_index Dart_handle;
|
||||
|
|
|
|||
Loading…
Reference in New Issue