added mpl-tag-tests

This commit is contained in:
Eric Berberich 2009-05-19 09:37:23 +00:00
parent d4df610002
commit cbcf9e034e
1 changed files with 133 additions and 0 deletions

View File

@ -16,10 +16,18 @@
//
//
// Author(s): Efi Fogel <efif@post.tau.ac.il>
// Eric Berberich <ericb@post.tau.ac.il>
#ifndef CGAL_ARR_TAGS_H
#define CGAL_ARR_TAGS_H
#include <boost/mpl/bool.hpp>
#include <boost/mpl/if.hpp>
#include <boost/mpl/and.hpp>
#include <boost/mpl/or.hpp>
#include <boost/mpl/not.hpp>
#include <boost/mpl/logical.hpp>
/*! \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<true> if all sides are oblivious,
* otherwise bool<false>
*/
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<true> if opposite sides are either
* both identified or both non-identified,
* otherwise bool<false>
*/
typedef boost::mpl::and_< LR_ok, BT_ok > result;
};
CGAL_END_NAMESPACE
#endif