mirror of https://github.com/CGAL/cgal
95 lines
3.1 KiB
C++
95 lines
3.1 KiB
C++
#ifndef CGAL_KERNEL_D_CARTESIAN_COMPLETE_H
|
|
#define CGAL_KERNEL_D_CARTESIAN_COMPLETE_H
|
|
|
|
#include <CGAL/Kernel_d/function_objects_cartesian.h>
|
|
#include <CGAL/Kernel_d/Segmentd.h>
|
|
#include <boost/mpl/if.hpp>
|
|
#include <boost/type_traits/is_same.hpp>
|
|
#include <boost/mpl/has_xxx.hpp>
|
|
|
|
|
|
namespace CGAL {
|
|
namespace internal {
|
|
BOOST_MPL_HAS_XXX_TRAIT_DEF(Segment)
|
|
BOOST_MPL_HAS_XXX_TRAIT_DEF(Ray)
|
|
BOOST_MPL_HAS_XXX_TRAIT_DEF(Direction)
|
|
BOOST_MPL_HAS_XXX_TRAIT_DEF(Line)
|
|
}
|
|
|
|
template<class R_,class Derived_> struct Cartesian_define_all_functors
|
|
: public R_
|
|
{
|
|
typedef R_ Kernel_base;
|
|
template<class F, class D=void> struct Functor
|
|
: Kernel_base::template Functor<F,D>
|
|
{ };
|
|
#define CGAL_Kernel_cons2(F,f) \
|
|
template<class D> struct Functor <F##_tag,D> { \
|
|
typedef CartesianDKernelFunctors::F<Derived_> type; \
|
|
};
|
|
//type f() const { return type(); }
|
|
#define CGAL_Kernel_pred(F,f) CGAL_Kernel_cons2(F,f)
|
|
#define CGAL_Kernel_comp2(F,f) CGAL_Kernel_cons2(F,f)
|
|
|
|
#include <CGAL/Kernel_d/interface_macros.h>
|
|
|
|
};
|
|
|
|
template<class R_,bool force_=false> struct Cartesian_complete_types
|
|
: public R_
|
|
{
|
|
typedef R_ Kernel_base;
|
|
#define CGAL_Kernel_obj2(X) typedef typename boost::mpl::if_c<force_||!internal::has_##X<R_>::value,X##Cd<R_>,R_>::type::X X;
|
|
#include <CGAL/Kernel_d/interface_macros.h>
|
|
};
|
|
|
|
|
|
template<class R_,bool force_=false,class Derived_=R_> struct Cartesian_complete_constructors
|
|
: public R_
|
|
{
|
|
typedef R_ Kernel_base;
|
|
template<class F,class D=void,class=typename map_functor_type<F>::type> struct Functor :
|
|
R_::template Functor<F,D> {};
|
|
template<class F,class D> struct Functor<F,D,Construct_tag> {
|
|
typedef typename Kernel_base::template Functor<F>::type Base_functor;
|
|
typedef typename boost::mpl::if_c<force_||boost::is_same<Base_functor,Null_functor>::value,
|
|
typename Cartesian_define_all_functors<R_,Derived_>::template Functor<F>::type,
|
|
Base_functor>::type type;
|
|
};
|
|
|
|
};
|
|
|
|
template<class R_,bool force_=false,class Derived_=R_> struct Cartesian_complete_predicates
|
|
: public R_
|
|
{
|
|
typedef R_ Kernel_base;
|
|
template<class F,class D=void,class=typename map_functor_type<F>::type> struct Functor :
|
|
R_::template Functor<F,D> {};
|
|
template<class F,class D> struct Functor<F,D,Predicate_tag> {
|
|
typedef typename Kernel_base::template Functor<F>::type Base_functor;
|
|
typedef typename boost::mpl::if_c<force_||boost::is_same<Base_functor,Null_functor>::value,
|
|
typename Cartesian_define_all_functors<R_,Derived_>::template Functor<F>::type,
|
|
Base_functor>::type type;
|
|
};
|
|
|
|
};
|
|
|
|
template<class R_,bool force_=false,class Derived_=R_> struct Cartesian_complete_computes
|
|
: public R_
|
|
{
|
|
typedef R_ Kernel_base;
|
|
template<class F,class D=void,class=typename map_functor_type<F>::type> struct Functor :
|
|
R_::template Functor<F,D> {};
|
|
template<class F,class D> struct Functor<F,D,Compute_tag> {
|
|
typedef typename Kernel_base::template Functor<F>::type Base_functor;
|
|
typedef typename boost::mpl::if_c<force_||boost::is_same<Base_functor,Null_functor>::value,
|
|
typename Cartesian_define_all_functors<R_,Derived_>::template Functor<F>::type,
|
|
Base_functor>::type type;
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif // CGAL_KERNEL_D_CARTESIAN_COMPLETE_H
|