BWAPI
SPAR/AIModule/BWTA/vendors/CGAL/CGAL/Arrangement_2/Arr_traits_adaptor_2_dispatching.h
Go to the documentation of this file.
00001 // Copyright (c) 2007, 2009 Tel-Aviv University (Israel).
00002 // All rights reserved.
00003 //
00004 // This file is part of CGAL (www.cgal.org); you may redistribute it under
00005 // the terms of the Q Public License version 1.0.
00006 // See the file LICENSE.QPL distributed with CGAL.
00007 //
00008 // Licensees holding a valid commercial license may use this file in
00009 // accordance with the commercial license agreement provided with the software.
00010 //
00011 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00012 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00013 //
00014 // $URL: svn+ssh://scm.gforge.inria.fr/svn/cgal/branches/CGAL-3.5-branch/Arrangement_on_surface_2/include/CGAL/Arrangement_2/Arr_traits_adaptor_2_dispatching.h $
00015 // $Id: Arr_traits_adaptor_2_dispatching.h 49772 2009-06-03 21:25:53Z eric $
00016 // 
00017 //
00018 // Author(s): Eric Berberich    <ericb@post.tau.ac.il>
00019 
00020 #ifndef CGAL_ARR_TRAITS_ADAPTOR_2_DISPATCHING_H
00021 #define CGAL_ARR_TRAITS_ADAPTOR_2_DISPATCHING_H
00022 
00023 #include <boost/mpl/bool.hpp>
00024 #include <boost/mpl/if.hpp>
00025 #include <boost/mpl/and.hpp>
00026 #include <boost/mpl/or.hpp>
00027 #include <boost/mpl/not.hpp>
00028 #include <boost/mpl/logical.hpp>
00029 #include <boost/mpl/has_xxx.hpp>
00030 
00031 #include <CGAL/Arr_tags.h>
00032 
00037 CGAL_BEGIN_NAMESPACE
00038 
00040 struct Arr_use_dummy_tag {};
00041 
00043 struct Arr_use_traits_tag {};
00044 
00045 namespace CGALi {
00046 
00048 // left-right //
00050 
00051 namespace Parameter_space_in_x_2 {
00052 
00053   // Curve-end
00054 
00055   template < class ArrSideTag >
00056   struct Curve_end {
00057     typedef Arr_use_dummy_tag type;
00058   };
00059   
00060   template <>
00061   struct Curve_end< Arr_oblivious_side_tag > {
00062     typedef Arr_use_dummy_tag type;
00063   };
00064   
00065   template <>
00066   struct Curve_end< Arr_open_side_tag > {
00067     typedef Arr_use_traits_tag type;
00068   };
00069   
00070   template <>
00071   struct Curve_end< Arr_contracted_side_tag > {
00072     typedef Arr_use_traits_tag type;
00073   };
00074   
00075   template <>
00076   struct Curve_end< Arr_closed_side_tag > {
00077     typedef Arr_use_traits_tag type;
00078   };
00079   
00080   template <>
00081   struct Curve_end< Arr_identified_side_tag > {
00082     typedef Arr_use_traits_tag type;
00083   };
00084 
00085   // Curve
00086 
00087   template < class ArrSideTag >
00088   struct Curve {
00089     typedef Arr_use_dummy_tag type;
00090   };
00091   
00092   template <>
00093   struct Curve< Arr_oblivious_side_tag > {
00094     typedef Arr_use_dummy_tag type;
00095   };
00096   
00097   template <>
00098   struct Curve< Arr_open_side_tag > {
00099     typedef Arr_use_dummy_tag type;
00100   };
00101   
00102   template <>
00103   struct Curve< Arr_contracted_side_tag > {
00104     typedef Arr_use_dummy_tag type;
00105   };
00106   
00107   template <>
00108   struct Curve< Arr_closed_side_tag > {
00109     typedef Arr_use_traits_tag type;
00110   };
00111   
00112   template <>
00113   struct Curve< Arr_identified_side_tag > {
00114     typedef Arr_use_dummy_tag type;
00115   };
00116 
00117   // Point
00118 
00119   template < class ArrSideTag >
00120   struct Point {
00121     typedef Arr_use_dummy_tag type;
00122   };
00123 
00124   template <>
00125   struct Point< Arr_oblivious_side_tag > {
00126     typedef Arr_use_dummy_tag type;
00127   };
00128   
00129   template <>
00130   struct Point< Arr_open_side_tag > {
00131     typedef Arr_use_dummy_tag type;
00132   };
00133   
00134   template <>
00135   struct Point< Arr_contracted_side_tag > {
00136     typedef Arr_use_traits_tag type;
00137   };
00138   
00139   template <>
00140   struct Point< Arr_closed_side_tag > {
00141     typedef Arr_use_traits_tag type;
00142   };
00143   
00144   template <>
00145   struct Point< Arr_identified_side_tag > {
00146     typedef Arr_use_dummy_tag type;
00147   };
00148   
00149 } // namespace Parameter_space_in_x_2
00150 
00151 
00152 namespace Compare_y_near_boundary_2 {
00153 
00154 // Curve-ends
00155 
00156   template < class ArrSideTag >
00157   struct Curve_ends {
00158     typedef Arr_use_dummy_tag type;
00159   };
00160   
00161   template <>
00162   struct Curve_ends< Arr_oblivious_side_tag > {
00163     typedef Arr_use_dummy_tag type;
00164   };
00165   
00166   template <>
00167   struct Curve_ends< Arr_open_side_tag > {
00168     typedef Arr_use_traits_tag type;
00169   };
00170   
00171   template <>
00172   struct Curve_ends< Arr_contracted_side_tag > {
00173     typedef Arr_use_traits_tag type;
00174   };
00175   
00176   template <>
00177   struct Curve_ends< Arr_closed_side_tag > {
00178     typedef Arr_use_traits_tag type;
00179   };
00180   
00181   template <>
00182   struct Curve_ends< Arr_identified_side_tag > {
00183     typedef Arr_use_traits_tag type;
00184   };
00185 
00186 } // Compare_y_near_boundary_2
00187 
00188 namespace Compare_y_on_boundary_2 {
00189 
00190  // Poitns
00191  template < class ArrSideTag >
00192   struct Points {
00193     typedef Arr_use_dummy_tag type;
00194   };
00195 
00196   template <>
00197   struct Points< Arr_oblivious_side_tag > {
00198     typedef Arr_use_dummy_tag type;
00199   };
00200   
00201   template <>
00202   struct Points< Arr_open_side_tag > {
00203     typedef Arr_use_dummy_tag type;
00204   };
00205   
00206   template <>
00207   struct Points< Arr_contracted_side_tag > {
00208     typedef Arr_use_dummy_tag type;
00209   };
00210   
00211   template <>
00212   struct Points< Arr_closed_side_tag > {
00213     typedef Arr_use_traits_tag type;
00214   };
00215   
00216   template <>
00217   struct Points< Arr_identified_side_tag > {
00218     typedef Arr_use_traits_tag type;
00219   };
00220 
00221 } // namespace Compare_y_on_boundary_2
00222 
00223 namespace Is_on_y_identification_2 {
00224 
00225   // Curve
00226 
00227   template < class ArrSideTag >
00228   struct Curve {
00229     typedef Arr_use_dummy_tag type;
00230   };
00231   
00232   template <>
00233   struct Curve< Arr_oblivious_side_tag > {
00234     typedef Arr_use_dummy_tag type;
00235   };
00236   
00237   template <>
00238   struct Curve< Arr_open_side_tag > {
00239     typedef Arr_use_dummy_tag type;
00240   };
00241   
00242   template <>
00243   struct Curve< Arr_contracted_side_tag > {
00244     typedef Arr_use_dummy_tag type;
00245   };
00246   
00247   template <>
00248   struct Curve< Arr_closed_side_tag > {
00249     typedef Arr_use_dummy_tag type;
00250   };
00251   
00252   template <>
00253   struct Curve< Arr_identified_side_tag > {
00254     typedef Arr_use_traits_tag type;
00255   };
00256 
00257   // Point
00258 
00259   template < class ArrSideTag >
00260   struct Point {
00261     typedef Arr_use_dummy_tag type;
00262   };
00263 
00264   template <>
00265   struct Point< Arr_oblivious_side_tag > {
00266     typedef Arr_use_dummy_tag type;
00267   };
00268   
00269   template <>
00270   struct Point< Arr_open_side_tag > {
00271     typedef Arr_use_dummy_tag type;
00272   };
00273   
00274   template <>
00275   struct Point< Arr_contracted_side_tag > {
00276     typedef Arr_use_dummy_tag type;
00277   };
00278   
00279   template <>
00280   struct Point< Arr_closed_side_tag > {
00281     typedef Arr_use_dummy_tag type;
00282   };
00283   
00284   template <>
00285   struct Point< Arr_identified_side_tag > {
00286     typedef Arr_use_traits_tag type;
00287   };
00288   
00289 } // namespace Is_on_y_identification_2
00290 
00291 
00292 
00294 // bottom-top //
00296 
00297 namespace Parameter_space_in_y_2 {
00298 
00299   // Curve-end
00300 
00301   template < class ArrSideTag >
00302   struct Curve_end {
00303     typedef Arr_use_dummy_tag type;
00304   };
00305   
00306   template <>
00307   struct Curve_end< Arr_oblivious_side_tag > {
00308     typedef Arr_use_dummy_tag type;
00309   };
00310   
00311   template <>
00312   struct Curve_end< Arr_open_side_tag > {
00313     typedef Arr_use_traits_tag type;
00314   };
00315   
00316   template <>
00317   struct Curve_end< Arr_contracted_side_tag > {
00318     typedef Arr_use_traits_tag type;
00319   };
00320   
00321   template <>
00322   struct Curve_end< Arr_closed_side_tag > {
00323     typedef Arr_use_traits_tag type;
00324   };
00325   
00326   template <>
00327   struct Curve_end< Arr_identified_side_tag > {
00328     typedef Arr_use_traits_tag type;
00329   };
00330 
00331   // Curve
00332 
00333   template < class ArrSideTag >
00334   struct Curve {
00335     typedef Arr_use_dummy_tag type;
00336   };
00337   
00338   template <>
00339   struct Curve< Arr_oblivious_side_tag > {
00340     typedef Arr_use_dummy_tag type;
00341   };
00342   
00343   template <>
00344   struct Curve< Arr_open_side_tag > {
00345     typedef Arr_use_dummy_tag type;
00346   };
00347   
00348   template <>
00349   struct Curve< Arr_contracted_side_tag > {
00350     typedef Arr_use_dummy_tag type;
00351   };
00352   
00353   template <>
00354   struct Curve< Arr_closed_side_tag > {
00355     typedef Arr_use_traits_tag type;
00356   };
00357   
00358   template <>
00359   struct Curve< Arr_identified_side_tag > {
00360     typedef Arr_use_dummy_tag type;
00361   };
00362 
00363   // Point
00364 
00365   template < class ArrSideTag >
00366   struct Point {
00367     typedef Arr_use_dummy_tag type;
00368   };
00369 
00370   template <>
00371   struct Point< Arr_oblivious_side_tag > {
00372     typedef Arr_use_dummy_tag type;
00373   };
00374   
00375   template <>
00376   struct Point< Arr_open_side_tag > {
00377     typedef Arr_use_dummy_tag type;
00378   };
00379   
00380   template <>
00381   struct Point< Arr_contracted_side_tag > {
00382     typedef Arr_use_traits_tag type;
00383   };
00384   
00385   template <>
00386   struct Point< Arr_closed_side_tag > {
00387     typedef Arr_use_traits_tag type;
00388   };
00389   
00390   template <>
00391   struct Point< Arr_identified_side_tag > {
00392     typedef Arr_use_dummy_tag type;
00393   };
00394   
00395 } // namespace Parameter_space_in_y_2
00396 
00397 namespace Compare_x_near_boundary_2 {
00398 
00399   // Point_curve-end
00400 
00401   template < class ArrSideTag >
00402   struct Point_curve_end {
00403     typedef Arr_use_dummy_tag type;
00404   };
00405   
00406   template <>
00407   struct Point_curve_end< Arr_oblivious_side_tag > {
00408     typedef Arr_use_dummy_tag type;
00409   };
00410   
00411   template <>
00412   struct Point_curve_end< Arr_open_side_tag > {
00413     typedef Arr_use_traits_tag type;
00414   };
00415   
00416   template <>
00417   struct Point_curve_end< Arr_contracted_side_tag > {
00418     typedef Arr_use_traits_tag type;
00419   };
00420   
00421   template <>
00422   struct Point_curve_end< Arr_closed_side_tag > {
00423     typedef Arr_use_traits_tag type;
00424   };
00425   
00426   template <>
00427   struct Point_curve_end< Arr_identified_side_tag > {
00428     typedef Arr_use_traits_tag type;
00429   };
00430 
00431   // Curve-ends
00432 
00433   template < class ArrSideTag >
00434   struct Curve_ends {
00435     typedef Arr_use_dummy_tag type;
00436   };
00437   
00438   template <>
00439   struct Curve_ends< Arr_oblivious_side_tag > {
00440     typedef Arr_use_dummy_tag type;
00441   };
00442   
00443   template <>
00444   struct Curve_ends< Arr_open_side_tag > {
00445     typedef Arr_use_traits_tag type;
00446   };
00447   
00448   template <>
00449   struct Curve_ends< Arr_contracted_side_tag > {
00450     typedef Arr_use_traits_tag type;
00451   };
00452   
00453   template <>
00454   struct Curve_ends< Arr_closed_side_tag > {
00455     typedef Arr_use_traits_tag type;
00456   };
00457   
00458   template <>
00459   struct Curve_ends< Arr_identified_side_tag > {
00460     typedef Arr_use_traits_tag type;
00461   };
00462 
00463 } // Compare_y_near_boundary_2
00464 
00465 namespace Compare_x_on_boundary_2 {
00466 
00467  // Poitns
00468  template < class ArrSideTag >
00469   struct Points {
00470     typedef Arr_use_dummy_tag type;
00471   };
00472 
00473   template <>
00474   struct Points< Arr_oblivious_side_tag > {
00475     typedef Arr_use_dummy_tag type;
00476   };
00477   
00478   template <>
00479   struct Points< Arr_open_side_tag > {
00480     typedef Arr_use_dummy_tag type;
00481   };
00482   
00483   template <>
00484   struct Points< Arr_contracted_side_tag > {
00485     typedef Arr_use_dummy_tag type;
00486   };
00487   
00488   template <>
00489   struct Points< Arr_closed_side_tag > {
00490     typedef Arr_use_traits_tag type;
00491   };
00492   
00493   template <>
00494   struct Points< Arr_identified_side_tag > {
00495     typedef Arr_use_traits_tag type;
00496   };
00497 
00498 } // namespace Compare_x_on_boundary_2
00499 
00500 namespace Is_on_x_identification_2 {
00501 
00502   // Curve
00503 
00504   template < class ArrSideTag >
00505   struct Curve {
00506     typedef Arr_use_dummy_tag type;
00507   };
00508   
00509   template <>
00510   struct Curve< Arr_oblivious_side_tag > {
00511     typedef Arr_use_dummy_tag type;
00512   };
00513   
00514   template <>
00515   struct Curve< Arr_open_side_tag > {
00516     typedef Arr_use_dummy_tag type;
00517   };
00518   
00519   template <>
00520   struct Curve< Arr_contracted_side_tag > {
00521     typedef Arr_use_dummy_tag type;
00522   };
00523   
00524   template <>
00525   struct Curve< Arr_closed_side_tag > {
00526     typedef Arr_use_dummy_tag type;
00527   };
00528   
00529   template <>
00530   struct Curve< Arr_identified_side_tag > {
00531     typedef Arr_use_traits_tag type;
00532   };
00533 
00534   // Point
00535 
00536   template < class ArrSideTag >
00537   struct Point {
00538     typedef Arr_use_dummy_tag type;
00539   };
00540 
00541   template <>
00542   struct Point< Arr_oblivious_side_tag > {
00543     typedef Arr_use_dummy_tag type;
00544   };
00545   
00546   template <>
00547   struct Point< Arr_open_side_tag > {
00548     typedef Arr_use_dummy_tag type;
00549   };
00550   
00551   template <>
00552   struct Point< Arr_contracted_side_tag > {
00553     typedef Arr_use_dummy_tag type;
00554   };
00555   
00556   template <>
00557   struct Point< Arr_closed_side_tag > {
00558     typedef Arr_use_dummy_tag type;
00559   };
00560   
00561   template <>
00562   struct Point< Arr_identified_side_tag > {
00563     typedef Arr_use_traits_tag type;
00564   };
00565   
00566 } // namespace Is_on_x_identification_2
00567 
00568 
00570 template < class ArrSmallerImplementationTag, class ArrLargerImplementationTag >
00571 struct Or_traits {
00572   
00573 public:
00574   
00576   typedef ArrSmallerImplementationTag   Arr_smaller_implementation_tag;
00577   
00579   typedef ArrLargerImplementationTag  Arr_larger_implementation_tag;
00580   
00581   
00582 private:
00583   
00584   typedef boost::mpl::bool_< true > true_;
00585   typedef boost::mpl::bool_< false > false_;
00586   
00587   typedef boost::mpl::if_< 
00588        boost::is_same< Arr_smaller_implementation_tag, Arr_use_traits_tag >,
00589        true_, false_ > Smaller_traits;
00590 
00591   typedef boost::mpl::if_< 
00592        boost::is_same< Arr_larger_implementation_tag, Arr_use_traits_tag >,
00593        true_, false_ > Larger_traits;
00594 
00595 public:
00596 
00599   typedef typename boost::mpl::if_<
00600               boost::mpl::or_< Smaller_traits, Larger_traits >,
00601               Arr_use_traits_tag,
00602               Arr_use_dummy_tag >::type type;
00603 
00604 };
00605 
00606 template < class ArrLeftSideTag, class ArrRightSideTag >
00607 struct Arr_left_right_implementation_dispatch {
00608 
00609 public:
00610   
00612   typedef ArrLeftSideTag   Arr_left_side_tag;
00613   
00615   typedef ArrRightSideTag  Arr_right_side_tag;
00616   
00617 public:
00618   
00620   typedef typename CGALi::Or_traits<
00621     typename 
00622     CGALi::Parameter_space_in_x_2::Curve_end< Arr_left_side_tag >::type,
00623     typename 
00624     CGALi::Parameter_space_in_x_2::Curve_end< Arr_right_side_tag >::type 
00625   >::type
00626   Parameter_space_in_x_2_curve_end_tag;
00627 
00629   typedef typename CGALi::Or_traits<
00630     typename 
00631     CGALi::Parameter_space_in_x_2::Curve< Arr_left_side_tag >::type,
00632     typename 
00633     CGALi::Parameter_space_in_x_2::Curve< Arr_right_side_tag >::type 
00634   >::type
00635   Parameter_space_in_x_2_curve_tag;
00636   
00638   typedef typename CGALi::Or_traits<
00639     typename
00640     CGALi::Parameter_space_in_x_2::Point< Arr_left_side_tag >::type,
00641     typename
00642     CGALi::Parameter_space_in_x_2::Point< Arr_right_side_tag >::type >::type
00643   Parameter_space_in_x_2_point_tag;
00644 
00645   
00647   typedef typename CGALi::Or_traits<
00648     typename 
00649     CGALi::Compare_y_near_boundary_2::Curve_ends< Arr_left_side_tag >::type,
00650     typename 
00651     CGALi::Compare_y_near_boundary_2::Curve_ends< Arr_right_side_tag >::type 
00652   >::type
00653   Compare_y_near_boundary_2_curve_ends_tag;
00654 
00655   // TODO Compare_y_right_of_2 ???
00656 
00658   typedef typename CGALi::Or_traits<
00659     typename 
00660     CGALi::Compare_y_on_boundary_2::Points< Arr_left_side_tag >::type,
00661     typename 
00662     CGALi::Compare_y_on_boundary_2::Points< Arr_right_side_tag >::type 
00663   >::type
00664   Compare_y_on_boundary_2_points_tag;
00665 
00667   typedef typename CGALi::Or_traits<
00668     typename 
00669     CGALi::Is_on_y_identification_2::Point< Arr_left_side_tag >::type,
00670     typename 
00671     CGALi::Is_on_y_identification_2::Point< Arr_right_side_tag >::type 
00672   >::type
00673   Is_on_y_identification_2_point_tag;
00674 
00676   typedef typename CGALi::Or_traits<
00677     typename 
00678     CGALi::Is_on_y_identification_2::Curve< Arr_left_side_tag >::type,
00679     typename 
00680     CGALi::Is_on_y_identification_2::Curve< Arr_right_side_tag >::type 
00681   >::type
00682   Is_on_y_identification_2_curve_tag;
00683 
00684 }; // left-right-dispatch
00685 
00686 
00687 template < class ArrBottomSideTag, class ArrTopSideTag >
00688 struct Arr_bottom_top_implementation_dispatch {
00689 
00690 public:
00691   
00693   typedef ArrBottomSideTag   Arr_bottom_side_tag;
00694   
00696   typedef ArrTopSideTag  Arr_top_side_tag;
00697   
00698 public:
00699 
00701   typedef typename CGALi::Or_traits<
00702     typename 
00703     CGALi::Parameter_space_in_y_2::Curve_end< Arr_bottom_side_tag >::type,
00704     typename 
00705     CGALi::Parameter_space_in_y_2::Curve_end< Arr_top_side_tag >::type 
00706   >::type
00707   Parameter_space_in_y_2_curve_end_tag;
00708 
00710   typedef typename CGALi::Or_traits<
00711     typename 
00712     CGALi::Parameter_space_in_y_2::Curve< Arr_bottom_side_tag >::type,
00713     typename 
00714     CGALi::Parameter_space_in_y_2::Curve< Arr_top_side_tag >::type 
00715   >::type
00716   Parameter_space_in_y_2_curve_tag;
00717   
00719   typedef typename CGALi::Or_traits<
00720     typename
00721     CGALi::Parameter_space_in_y_2::Point< Arr_bottom_side_tag >::type,
00722     typename
00723     CGALi::Parameter_space_in_y_2::Point< Arr_top_side_tag >::type >::type
00724   Parameter_space_in_y_2_point_tag;
00725   
00727   typedef typename CGALi::Or_traits<
00728     typename 
00729     CGALi::Compare_x_near_boundary_2::Point_curve_end< Arr_bottom_side_tag >
00730     ::type,
00731     typename 
00732     CGALi::Compare_x_near_boundary_2::Point_curve_end< Arr_top_side_tag >::type 
00733   >::type
00734   Compare_x_near_boundary_2_point_curve_end_tag;
00735 
00737   typedef typename CGALi::Or_traits<
00738     typename 
00739     CGALi::Compare_x_near_boundary_2::Curve_ends< Arr_bottom_side_tag >::type,
00740     typename 
00741     CGALi::Compare_x_near_boundary_2::Curve_ends< Arr_top_side_tag >::type 
00742   >::type
00743   Compare_x_near_boundary_2_curve_ends_tag;
00744 
00746   typedef typename CGALi::Or_traits<
00747     typename 
00748     CGALi::Compare_x_on_boundary_2::Points< Arr_bottom_side_tag >::type,
00749     typename 
00750     CGALi::Compare_x_on_boundary_2::Points< Arr_top_side_tag >::type 
00751   >::type
00752   Compare_x_on_boundary_2_points_tag;
00753 
00755   typedef typename CGALi::Or_traits<
00756     typename 
00757     CGALi::Is_on_x_identification_2::Point< Arr_bottom_side_tag >::type,
00758     typename 
00759     CGALi::Is_on_x_identification_2::Point< Arr_top_side_tag >::type 
00760   >::type
00761   Is_on_x_identification_2_point_tag;
00762 
00764   typedef typename CGALi::Or_traits<
00765     typename 
00766     CGALi::Is_on_x_identification_2::Curve< Arr_bottom_side_tag >::type,
00767     typename 
00768     CGALi::Is_on_x_identification_2::Curve< Arr_top_side_tag >::type 
00769   >::type
00770   Is_on_x_identification_2_curve_tag;
00771   
00772 }; // bottom-top-dispatch
00773 
00774 } // namespace CGALi
00775 
00776 CGAL_END_NAMESPACE
00777 
00778 #endif // CGAL_ARR_TRAITS_ADAPTOR_2_DISPATCHING_H
00779 
00780 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines