BWAPI
SPAR/AIModule/BWTA/vendors/CGAL/CGAL/circulator_bases.h
Go to the documentation of this file.
00001 // Copyright (c) 1997  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/Circulator/include/CGAL/circulator_bases.h $
00019 // $Id: circulator_bases.h 35787 2007-01-24 17:16:05Z spion $
00020 // 
00021 //
00022 // Author(s)     : Lutz Kettner  <kettner@inf.ethz.ch>
00023 
00024 #ifndef CGAL_CIRCULATOR_BASES_H
00025 #define CGAL_CIRCULATOR_BASES_H 1
00026 
00027 #include <cstddef>
00028 #include <iterator>
00029 
00030 CGAL_BEGIN_NAMESPACE
00031 
00032 struct Circulator_tag {};                   // any circulator.
00033 struct Iterator_tag {};                     // any iterator.
00034 
00035 struct Forward_circulator_tag
00036     : public std::forward_iterator_tag {};
00037 struct Bidirectional_circulator_tag
00038     : public std::bidirectional_iterator_tag {};
00039 struct Random_access_circulator_tag
00040     : public std::random_access_iterator_tag {};
00041 template <class T, class Dist = std::ptrdiff_t, class Size = std::size_t>
00042 struct Forward_circulator_base {
00043     typedef T                            value_type;
00044     typedef Dist                         difference_type;
00045     typedef Size                         size_type;
00046     typedef T*                           pointer;
00047     typedef T&                           reference;
00048     typedef Forward_circulator_tag       iterator_category;
00049 };
00050 template <class T, class Dist = std::ptrdiff_t, class Size = std::size_t>
00051 struct Bidirectional_circulator_base {
00052     typedef T                            value_type;
00053     typedef Dist                         difference_type;
00054     typedef Size                         size_type;
00055     typedef T*                           pointer;
00056     typedef T&                           reference;
00057     typedef Bidirectional_circulator_tag iterator_category;
00058 };
00059 template <class T, class Dist = std::ptrdiff_t, class Size = std::size_t>
00060 struct Random_access_circulator_base {
00061     typedef T                            value_type;
00062     typedef Dist                         difference_type;
00063     typedef Size                         size_type;
00064     typedef T*                           pointer;
00065     typedef T&                           reference;
00066     typedef Random_access_circulator_tag iterator_category;
00067 };
00068 template < class Category,
00069            class T,
00070            class Distance  = std::ptrdiff_t,
00071            class Size      = std::size_t,
00072            class Pointer   = T*,
00073            class Reference = T&>
00074 struct Circulator_base {
00075     typedef Category  iterator_category;
00076     typedef T         value_type;
00077     typedef Distance  difference_type;
00078     typedef Size      size_type;
00079     typedef Pointer   pointer;
00080     typedef Reference reference;
00081 };
00082 
00083 // variant base classes
00084 // ---------------------
00085 template <class T, class Dist = std::ptrdiff_t, class Size = std::size_t>
00086 class Forward_circulator_ptrbase         // forward circulator.
00087 {
00088     protected:
00089         void* _ptr;
00090     public:
00091         typedef Forward_circulator_tag  iterator_category;
00092         typedef T                           value_type;
00093         typedef Dist                        difference_type;
00094         typedef Size                        size_type;
00095         typedef T*                          pointer;
00096         typedef T&                          reference;
00097         Forward_circulator_ptrbase()        : _ptr(NULL) {}
00098         Forward_circulator_ptrbase(void* p) : _ptr(p) {}
00099 };
00100 template <class T, class Dist = std::ptrdiff_t, class Size = std::size_t>
00101 class Bidirectional_circulator_ptrbase   // bidirectional circulator.
00102 {
00103     protected:
00104         void* _ptr;
00105     public:
00106         typedef Bidirectional_circulator_tag  iterator_category;
00107         typedef T                           value_type;
00108         typedef Dist                        difference_type;
00109         typedef Size                        size_type;
00110         typedef T*                          pointer;
00111         typedef T&                          reference;
00112         Bidirectional_circulator_ptrbase()        : _ptr(NULL) {}
00113         Bidirectional_circulator_ptrbase(void* p) : _ptr(p) {}
00114 };
00115 template <class T, class Dist = std::ptrdiff_t, class Size = std::size_t>
00116 class Random_access_circulator_ptrbase   // random access circulator.
00117 {
00118     protected:
00119         void* _ptr;
00120     public:
00121         typedef Random_access_circulator_tag iterator_category;
00122         typedef T                           value_type;
00123         typedef Dist                        difference_type;
00124         typedef Size                        size_type;
00125         typedef T*                          pointer;
00126         typedef T&                          reference;
00127         Random_access_circulator_ptrbase()        : _ptr(NULL) {}
00128         Random_access_circulator_ptrbase(void* p) : _ptr(p) {}
00129 };
00130 
00131 CGAL_END_NAMESPACE
00132 
00133 #endif // CGAL_CIRCULATOR_BASES_H //
00134 // EOF //
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines