mirror of https://github.com/CGAL/cgal
continue refcount
This commit is contained in:
parent
12fe1be5bb
commit
372dae5009
|
|
@ -127,6 +127,13 @@ public:
|
|||
}
|
||||
BOOST_PP_REPEAT_FROM_TO(1,11,CODE,_)
|
||||
#undef CODE
|
||||
template <class F>
|
||||
Handle_for(Eval_functor,F const&f)
|
||||
: ptr_(allocator.allocate(1))
|
||||
{
|
||||
new (&(ptr_->t)) element_type(f());
|
||||
ptr_->count = 1;
|
||||
}
|
||||
#endif // CGAL_CFG_NO_CPP0X_VARIADIC_TEMPLATES
|
||||
|
||||
Handle_for(const Handle_for& h)
|
||||
|
|
|
|||
|
|
@ -103,8 +103,8 @@ public:
|
|||
#undef CODE
|
||||
|
||||
// this one should be implicit
|
||||
Point_d(Null_vector const& v)
|
||||
: Rep(CPBase()(v)) {}
|
||||
Point_d(Origin const& o)
|
||||
: Rep(CPBase()(o)) {}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -13,15 +13,15 @@
|
|||
#endif
|
||||
#include <boost/utility/result_of.hpp>
|
||||
|
||||
// no need for a fancy interface here, people can use the Point_d wrapper on
|
||||
// top.
|
||||
|
||||
namespace CGAL {
|
||||
|
||||
template <class R_>
|
||||
class Point_rc_d
|
||||
{
|
||||
typedef typename R_::RT RT_;
|
||||
typedef typename R_::FT FT_;
|
||||
typedef typename R_::Kernel_base Kbase;
|
||||
typedef typename R_::Vector Vector_;
|
||||
typedef typename Kbase::template Construct<Construct_point_tag>::type CPBase;
|
||||
typedef typename Kbase::template Compute<Compute_cartesian_coordinate_tag>::type CCBase;
|
||||
|
||||
|
|
@ -29,6 +29,7 @@ class Point_rc_d
|
|||
BOOST_STATIC_ASSERT((boost::is_same<Self, typename R_::Point>::value));
|
||||
|
||||
public:
|
||||
typedef R_ R;
|
||||
|
||||
typedef Tag_true Is_wrapper;
|
||||
typedef typename R_::Default_ambient_dimension Ambient_dimension;
|
||||
|
|
@ -47,25 +48,13 @@ public:
|
|||
return CGAL::get(data);
|
||||
}
|
||||
|
||||
typedef R_ R;
|
||||
|
||||
#ifdef CGAL_CXX0X
|
||||
template<class...U,class=typename std::enable_if<!std::is_same<std::tuple<typename std::decay<U>::type...>,std::tuple<Point_rc_d> >::value>::type> explicit Point_rc_d(U&&...u)
|
||||
: Rep(Eval_functor(),CPBase(),std::forward<U>(u)...){}
|
||||
|
||||
// // called from Construct_point_d
|
||||
// template<class...U> explicit Point_rc_d(Eval_functor&&,U&&...u)
|
||||
// : Rep(Eval_functor(), std::forward<U>(u)...){}
|
||||
template<class F,class...U> explicit Point_rc_d(Eval_functor&&,F&&f,U&&...u)
|
||||
: Rep(Eval_functor(),std::forward<F>(f),std::forward<U>(u)...){}
|
||||
|
||||
#if 0
|
||||
// the new standard may make this necessary
|
||||
Point_d(Point_d const&)=default;
|
||||
Point_d(Point_d &);//=default;
|
||||
Point_d(Point_d &&)=default;
|
||||
#endif
|
||||
|
||||
// try not to use these
|
||||
Point_rc_d(Rep const& v) : data(v) {}
|
||||
Point_rc_d(Rep& v) : data(static_cast<Rep const&>(v)) {}
|
||||
|
|
@ -81,7 +70,7 @@ public:
|
|||
|
||||
#else
|
||||
|
||||
Point_rc_d() : data(CPBase()()) {}
|
||||
Point_rc_d() : data(Eval_functor(),CPBase()) {}
|
||||
|
||||
Point_rc_d(Rep const& v) : data(v) {} // try not to use it
|
||||
|
||||
|
|
@ -92,153 +81,17 @@ public:
|
|||
template<class F,BOOST_PP_ENUM_PARAMS(N,class T)> \
|
||||
Point_rc_d(Eval_functor,F const& f,BOOST_PP_ENUM_BINARY_PARAMS(N,T,const&t)) \
|
||||
: data(Eval_functor(),f,BOOST_PP_ENUM_PARAMS(N,t)) {}
|
||||
/*
|
||||
template<BOOST_PP_ENUM_PARAMS(N,class T)> \
|
||||
Point_d(Eval_functor,BOOST_PP_ENUM_BINARY_PARAMS(N,T,const&t)) \
|
||||
: Rep(Eval_functor(), BOOST_PP_ENUM_PARAMS(N,t)) {}
|
||||
*/
|
||||
|
||||
BOOST_PP_REPEAT_FROM_TO(1,11,CODE,_)
|
||||
#undef CODE
|
||||
|
||||
// this one should be implicit
|
||||
Point_rc_d(Null_vector const& v)
|
||||
: data(Eval_functor(),CPBase(),v) {}
|
||||
Point_rc_d(Origin const& o)
|
||||
: data(Eval_functor(),CPBase(),o) {}
|
||||
|
||||
#endif
|
||||
|
||||
typename boost::result_of<CCBase(Rep,int)>::type cartesian(int i)const{
|
||||
return CCBase()(rep(),i);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
Direction_d direction() const
|
||||
{
|
||||
return R().construct_direction_d_object()(*this);
|
||||
}
|
||||
|
||||
Vector_d transform(const Aff_transformation_d &t) const
|
||||
{
|
||||
return t.transform(*this);
|
||||
}
|
||||
|
||||
Vector_d operator/(const RT& c) const
|
||||
{
|
||||
return R().construct_divided_vector_d_object()(*this,c);
|
||||
}
|
||||
|
||||
Vector_d operator/(const typename First_if_different<FT_,RT>::Type & c) const
|
||||
{
|
||||
return R().construct_divided_vector_d_object()(*this,c);
|
||||
}
|
||||
|
||||
typename Qualified_result_of<typename R::Compute_x_3, Vector_3>::type
|
||||
x() const
|
||||
{
|
||||
return R().compute_x_3_object()(*this);
|
||||
}
|
||||
|
||||
typename Qualified_result_of<typename R::Compute_y_3, Vector_3>::type
|
||||
y() const
|
||||
{
|
||||
return R().compute_y_3_object()(*this);
|
||||
}
|
||||
|
||||
typename Qualified_result_of<typename R::Compute_z_3, Vector_3>::type
|
||||
z() const
|
||||
{
|
||||
return R().compute_z_3_object()(*this);
|
||||
}
|
||||
|
||||
typename Qualified_result_of<typename R::Compute_hx_3, Vector_3>::type
|
||||
hx() const
|
||||
{
|
||||
return R().compute_hx_3_object()(*this);
|
||||
}
|
||||
|
||||
typename Qualified_result_of<typename R::Compute_hy_3, Vector_3>::type
|
||||
hy() const
|
||||
{
|
||||
return R().compute_hy_3_object()(*this);
|
||||
}
|
||||
|
||||
typename Qualified_result_of<typename R::Compute_hz_3, Vector_3>::type
|
||||
hz() const
|
||||
{
|
||||
return R().compute_hz_3_object()(*this);
|
||||
}
|
||||
|
||||
typename Qualified_result_of<typename R::Compute_hw_3, Vector_3>::type
|
||||
hw() const
|
||||
{
|
||||
return R().compute_hw_3_object()(*this);
|
||||
}
|
||||
|
||||
typename Qualified_result_of<typename R::Compute_x_3, Vector_3>::type
|
||||
cartesian(int i) const
|
||||
{
|
||||
CGAL_kernel_precondition( (i == 0) || (i == 1) || (i == 2) );
|
||||
if (i==0) return x();
|
||||
if (i==1) return y();
|
||||
return z();
|
||||
}
|
||||
|
||||
typename Qualified_result_of<typename R::Compute_hw_3, Vector_3>::type
|
||||
homogeneous(int i) const
|
||||
{
|
||||
CGAL_kernel_precondition( (i >= 0) || (i <= 3) );
|
||||
if (i==0) return hx();
|
||||
if (i==1) return hy();
|
||||
if (i==2) return hz();
|
||||
return hw();
|
||||
}
|
||||
|
||||
int dimension() const // bad idea?
|
||||
{
|
||||
return rep.dimension();
|
||||
}
|
||||
|
||||
typename Qualified_result_of<typename R::Compute_x_3, Vector_3>::type
|
||||
operator[](int i) const
|
||||
{
|
||||
return cartesian(i);
|
||||
}
|
||||
|
||||
Cartesian_const_iterator cartesian_begin() const
|
||||
{
|
||||
return typename R::Construct_cartesian_const_iterator_3()(*this);
|
||||
}
|
||||
|
||||
Cartesian_const_iterator cartesian_end() const
|
||||
{
|
||||
return typename R::Construct_cartesian_const_iterator_3()(*this,3);
|
||||
}
|
||||
|
||||
typename Qualified_result_of<typename R::Compute_squared_length_3, Vector_3>::type
|
||||
squared_length() const
|
||||
{
|
||||
return R().compute_squared_length_3_object()(*this);
|
||||
}
|
||||
*/
|
||||
};
|
||||
#if 0
|
||||
template <class R_> Point_d<R_>::Point_d(Point_d &)=default;
|
||||
#endif
|
||||
|
||||
//TODO: IO
|
||||
|
||||
//template <class R_>
|
||||
//Vector_d<R_> operator+(const Vector_d<R_>& v,const Vector_d<R_>& w) const
|
||||
//{
|
||||
// return typename R::template Construct<Construct_sum_of_vectors_tag>::type()(v,w);
|
||||
//}
|
||||
//
|
||||
//template <class R_>
|
||||
//Vector_d<R_> operator-(const Vector_d<R_>& v,const Vector_d<R_>& w) const
|
||||
//{
|
||||
// return typename R::template Construct<Construct_difference_of_vectors_tag>::type()(v,w);
|
||||
//}
|
||||
|
||||
} //namespace CGAL
|
||||
|
||||
|
|
|
|||
|
|
@ -162,12 +162,13 @@ template<class R_> struct Compute_squared_distance {
|
|||
}
|
||||
};
|
||||
|
||||
template<class R_> struct Less_coordinate {
|
||||
template<class R_> struct Less_cartesian_coordinate {
|
||||
typedef R_ R;
|
||||
typedef typename R_::FT FT;
|
||||
typedef typename R::Comparison_result result_type;
|
||||
typedef typename R::template Compute<Compute_cartesian_coordinate_tag>::type Cc;
|
||||
// This is_exact thing should be reengineered.
|
||||
// TODO: This is_exact thing should be reengineered.
|
||||
// the goal is to have a way to tell: don't filter this
|
||||
typedef typename CGAL::Is_exact<Cc>::type Is_exact;
|
||||
|
||||
template<class V,class W,class I>
|
||||
|
|
|
|||
|
|
@ -62,6 +62,8 @@ CGAL_Kernel_comp1(Compute_cartesian_coordinate,
|
|||
|
||||
CGAL_Kernel_pred(Orientation,
|
||||
orientation_object)
|
||||
CGAL_Kernel_pred(Less_cartesian_coordinate,
|
||||
less_cartesian_coordinate_object)
|
||||
|
||||
#undef CGAL_Kernel_pred
|
||||
#undef CGAL_Kernel_comp
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ namespace CGAL {
|
|||
DECL_OBJ(Bbox);
|
||||
#undef DECL_OBJ
|
||||
|
||||
//TODO: split into _begin and _end ?
|
||||
struct Construct_point_cartesian_const_iterator_tag {};
|
||||
struct Construct_vector_cartesian_const_iterator_tag {};
|
||||
|
||||
|
|
@ -34,15 +35,18 @@ namespace CGAL {
|
|||
DECL_CONSTRUCT(Construct_opposite_vector,Vector);
|
||||
#undef DECL_CONSTRUCT
|
||||
|
||||
struct Compute_cartesian_coordinate_tag {};
|
||||
struct Compute_homogeneous_coordinate_tag {};
|
||||
struct Compute_squared_distance_tag {};
|
||||
struct Compute_squared_length_tag {};
|
||||
#define DECL_COMPUTE(X) struct X##_tag {}
|
||||
DECL_COMPUTE(Compute_cartesian_coordinate);
|
||||
DECL_COMPUTE(Compute_homogeneous_coordinate);
|
||||
DECL_COMPUTE(Compute_squared_distance);
|
||||
DECL_COMPUTE(Compute_squared_length);
|
||||
#undef DECL_COMPUTE
|
||||
|
||||
struct Predicate_less_cartesian_coordinate_tag {};
|
||||
//FIXME: choose a convention
|
||||
struct Predicate_orientation_tag {};
|
||||
struct Orientation_tag {};
|
||||
struct Predicate_in_sphere_tag {};
|
||||
//FIXME: choose a convention: prefix with Predicate_ ?
|
||||
#define DECL_PREDICATE(X) struct X##_tag {}
|
||||
DECL_PREDICATE(Less_cartesian_coordinate);
|
||||
DECL_PREDICATE(Orientation);
|
||||
DECL_PREDICATE(In_sphere);
|
||||
#undef DECL_PREDICATE
|
||||
}
|
||||
#endif // CGAL_FUNCTOR_TAGS_H
|
||||
|
|
|
|||
Loading…
Reference in New Issue