BWAPI
SPAR/AIModule/BWTA/vendors/CGAL/CGAL/enum.h
Go to the documentation of this file.
00001 // Copyright (c) 1999  Utrecht University (The Netherlands),
00002 // ETH Zurich (Switzerland), Freie Universitaet Berlin (Germany),
00003 // INRIA Sophia-Antipolis (France), Martin-Luther-University Halle-Wittenberg
00004 // (Germany), Max-Planck-Institute Saarbruecken (Germany), RISC Linz (Austria),
00005 // and Tel-Aviv University (Israel).  All rights reserved.
00006 //
00007 // This file is part of CGAL (www.cgal.org); you can redistribute it and/or
00008 // modify it under the terms of the GNU Lesser General Public License as
00009 // published by the Free Software Foundation; version 2.1 of the License.
00010 // See the file LICENSE.LGPL distributed with CGAL.
00011 //
00012 // Licensees holding a valid commercial license may use this file in
00013 // accordance with the commercial license agreement provided with the software.
00014 //
00015 // This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00016 // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00017 //
00018 // $URL: svn+ssh://scm.gforge.inria.fr/svn/cgal/branches/CGAL-3.5-branch/Kernel_23/include/CGAL/enum.h $
00019 // $Id: enum.h 44129 2008-07-12 21:09:38Z spion $
00020 // 
00021 //
00022 // Author(s)     : Stefan Schirra
00023 
00024 #ifndef CGAL_ENUM_H
00025 #define CGAL_ENUM_H
00026 
00027 #include <CGAL/config.h>
00028 #include <CGAL/Kernel/Same_uncertainty.h>
00029 
00030 // If you add/change one type here, please update Is_a_predicate.h as well.
00031 
00032 CGAL_BEGIN_NAMESPACE
00033 
00034 enum  Sign
00035 {
00036     NEGATIVE = -1, ZERO = 0, POSITIVE = 1,
00037 
00038     // Orientation constants:
00039     RIGHT_TURN = -1, LEFT_TURN = 1,
00040 
00041     CLOCKWISE = -1, COUNTERCLOCKWISE = 1,
00042 
00043     COLLINEAR = 0, COPLANAR = 0, DEGENERATE = 0,
00044 
00045     // Oriented_side constants:
00046     ON_NEGATIVE_SIDE = -1, ON_ORIENTED_BOUNDARY = 0, ON_POSITIVE_SIDE = 1,
00047 
00048     // Comparison_result constants:
00049     SMALLER = -1, EQUAL = 0, LARGER = 1
00050 };
00051 
00052 typedef Sign Orientation;
00053 typedef Sign Oriented_side;
00054 typedef Sign Comparison_result;
00055 
00056 enum  Bounded_side
00057       {
00058         ON_UNBOUNDED_SIDE = -1,
00059         ON_BOUNDARY,
00060         ON_BOUNDED_SIDE
00061       };
00062 
00063 enum  Angle
00064       {
00065           OBTUSE = -1,
00066           RIGHT,
00067           ACUTE
00068       };
00069 
00070 
00071 template <class T>
00072 inline
00073 T
00074 opposite(const T& t)
00075 { return -t; }
00076 
00077 inline
00078 Sign
00079 operator-(Sign o)
00080 { return static_cast<Sign>( - static_cast<int>(o)); }
00081 
00082 inline
00083 Bounded_side
00084 opposite(Bounded_side bs)
00085 { return static_cast<Bounded_side>( - static_cast<int>(bs)); }
00086 
00087 inline
00088 Angle
00089 opposite(Angle a)
00090 { return static_cast<Angle>( - static_cast<int>(a)); }
00091 
00092 inline Sign operator* (Sign s1, Sign s2)
00093 {
00094     return static_cast<Sign> (static_cast<int> (s1) * static_cast<int> (s2));
00095 }
00096 
00097 #ifdef CGAL_CFG_MATCHING_BUG_5
00098 
00099 template < typename T, typename U >
00100 inline
00101 T enum_cast_bug(const U& u, const T*)
00102 { return static_cast<T>(u); }
00103 
00104 template < typename T, typename U >
00105 inline
00106 typename Same_uncertainty<T,U>::type enum_cast(const U& u)
00107 { return enum_cast_bug(u, (const T*)0); }
00108 
00109 #else
00110 
00111 template < typename T, typename U >
00112 inline
00113 T enum_cast(const U& u)
00114 { return static_cast<T>(u); }
00115 
00116 #endif
00117 
00118 CGAL_END_NAMESPACE
00119 
00120 #endif // CGAL_ENUM_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines