diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_tags.h b/Arrangement_on_surface_2/include/CGAL/Arr_tags.h index a59663be012..56a9c2f6183 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_tags.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_tags.h @@ -16,10 +16,18 @@ // // // Author(s): Efi Fogel +// Eric Berberich #ifndef CGAL_ARR_TAGS_H #define CGAL_ARR_TAGS_H +#include +#include +#include +#include +#include +#include + /*! \file * Definition of the tags for the arrangement package. */ @@ -41,6 +49,131 @@ struct Arr_closed_side_tag : public virtual Arr_boundary_side_tag {}; struct Arr_contracted_side_tag : public virtual Arr_boundary_side_tag {}; struct Arr_identified_side_tag : public virtual Arr_boundary_side_tag {}; + +/*!\brief Struct to determine whether all side tags are "oblivious" + */ +template < class ArrLeftSideTag, class ArrBottomSideTag, + class ArrTopSideTag, class ArrRightSideTag > +struct Arr_all_sides_oblivious_tag { + + //! This instance's first template parameter + typedef ArrLeftSideTag Arr_left_side_tag; + + //! This instance's second template parameter + typedef ArrBottomSideTag Arr_bottom_side_tag; + + //! This instance's third template parameter + typedef ArrTopSideTag Arr_top_side_tag; + + //! This instance's fourth template parameter + typedef ArrRightSideTag Arr_right_side_tag; + +private: + + typedef boost::mpl::bool_< true > true_; + typedef boost::mpl::bool_< false > false_; + + typedef boost::mpl::if_< + boost::is_same< Arr_left_side_tag, Arr_oblivious_side_tag >, + true_, false_ > + Left_oblivious; + + typedef boost::mpl::if_< + boost::is_same< Arr_bottom_side_tag, Arr_oblivious_side_tag >, + true_, false_ > + Bottom_oblivious; + + typedef boost::mpl::if_< + boost::is_same< Arr_top_side_tag, Arr_oblivious_side_tag >, + true_, false_ > + Top_oblivious; + + typedef boost::mpl::if_< + boost::is_same< Arr_right_side_tag, Arr_oblivious_side_tag >, + true_, false_ > + Right_oblivious; + +public: + + /*!\brief + * boolean tag that is bool if all sides are oblivious, + * otherwise bool + */ + typedef boost::mpl::and_< Left_oblivious, Bottom_oblivious, + Top_oblivious, Right_oblivious > result; +}; + + +/*!\brief Struct to check consistent tagging of identifications + */ +template < class ArrLeftSideTag, class ArrBottomSideTag, + class ArrTopSideTag, class ArrRightSideTag > +struct Arr_sane_identified_tagging { + + //! This instance's first template parameter + typedef ArrLeftSideTag Arr_left_side_tag; + + //! This instance's second template parameter + typedef ArrBottomSideTag Arr_bottom_side_tag; + + //! This instance's third template parameter + typedef ArrTopSideTag Arr_top_side_tag; + + //! This instance's fourth template parameter + typedef ArrRightSideTag Arr_right_side_tag; + +private: + + typedef boost::mpl::bool_< true > true_; + typedef boost::mpl::bool_< false > false_; + + typedef boost::mpl::if_< + boost::is_same< Arr_left_side_tag, Arr_identified_side_tag >, + true_, false_ > + Left_identified; + + typedef boost::mpl::if_< + boost::is_same< Arr_bottom_side_tag, Arr_identified_side_tag >, + true_, false_ > + Bottom_identified; + + typedef boost::mpl::if_< + boost::is_same< Arr_top_side_tag, Arr_identified_side_tag >, + true_, false_ > + Top_identified; + + typedef boost::mpl::if_< + boost::is_same< Arr_right_side_tag, Arr_identified_side_tag >, + true_, false_ > + Right_identified; + + typedef boost::mpl::and_< Left_identified, Right_identified > + LR_identified; + + typedef boost::mpl::and_< Bottom_identified, Top_identified > + BT_identified; + + typedef boost::mpl::and_< boost::mpl::not_< Left_identified>, + boost::mpl::not_< Right_identified > > + LR_non_identified; + + typedef boost::mpl::and_< boost::mpl::not_< Bottom_identified >, + boost::mpl::not_< Top_identified > > + BT_non_identified; + + typedef boost::mpl::or_< LR_identified, LR_non_identified > LR_ok; + typedef boost::mpl::or_< BT_identified, BT_non_identified > BT_ok; + +public: + + /*!\brief + * boolean tag that is bool if opposite sides are either + * both identified or both non-identified, + * otherwise bool + */ + typedef boost::mpl::and_< LR_ok, BT_ok > result; +}; + CGAL_END_NAMESPACE #endif