File: Param_mesh_patch_iterators.h

package info (click to toggle)
cgal 3.2.1-2
  • links: PTS
  • area: non-free
  • in suites: etch, etch-m68k
  • size: 47,752 kB
  • ctags: 72,510
  • sloc: cpp: 397,707; ansic: 10,393; sh: 4,232; makefile: 3,713; perl: 394; sed: 9
file content (165 lines) | stat: -rw-r--r-- 5,978 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
// Copyright (c) 2005  INRIA (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org); you may redistribute it under
// the terms of the Q Public License version 1.0.
// See the file LICENSE.QPL distributed with CGAL.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL: svn+ssh://scm.gforge.inria.fr/svn/cgal/branches/CGAL-3.2-branch/Surface_mesh_parameterization/include/CGAL/Param_mesh_patch_iterators.h $
// $Id: Param_mesh_patch_iterators.h 31402 2006-06-02 14:29:41Z lsaboret $
//
//
// Author(s)     : Laurent Saboret, Pierre Alliez, Bruno Levy


#ifndef CGAL_PARAM_MESH_PATCH_ITERATORS_H
#define CGAL_PARAM_MESH_PATCH_ITERATORS_H

#include <CGAL/Param_mesh_patch_vertex.h>
#include <CGAL/surface_mesh_parameterization_assertions.h>

#include <list>

CGAL_BEGIN_NAMESPACE


/// The class Param_mesh_patch_vertex_list is the type of
/// the list of all vertices of a
/// Parameterization_mesh_patch_3<ParameterizationPatchableMesh_3> mesh
template<class ParameterizationPatchableMesh_3>
class Param_mesh_patch_vertex_list
    : public std::list< Param_mesh_patch_vertex<ParameterizationPatchableMesh_3> >
{
// Public types
public:

    /// Export template parameter type
    typedef ParameterizationPatchableMesh_3 Adaptor;
};


/// Param_mesh_patch_vertex_list_iterator is an iterator of a
/// Param_mesh_patch_vertex_list list.
/// It provides the same features as
/// Param_mesh_patch_vertex_list<ParameterizationPatchableMesh_3>::iterator
/// + a conversion to Param_mesh_patch_vertex_handle
template<class ParameterizationPatchableMesh_3>
class Param_mesh_patch_vertex_list_iterator
    : public Param_mesh_patch_vertex_list<ParameterizationPatchableMesh_3>::iterator
{
// Private types
private:

    typedef typename Param_mesh_patch_vertex_list<ParameterizationPatchableMesh_3>::iterator
                                            Base;
    typedef Param_mesh_patch_vertex_list_iterator
                                            Self;
    typedef Param_mesh_patch_vertex<ParameterizationPatchableMesh_3>
                                            Vertex;

// Public types
public:

    /// Export template parameter type
    typedef ParameterizationPatchableMesh_3 Adaptor;

// Public operations
public:

    Param_mesh_patch_vertex_list_iterator() {}
    Param_mesh_patch_vertex_list_iterator(const Base& toCopy) : Base(toCopy) {}

    Param_mesh_patch_vertex_list_iterator(const Self& toCopy) : Base(toCopy) {}
    Self& operator=(const Self& toCopy) { Base::operator=(toCopy); return *this; }

    Self & operator++()     { Base::operator++(); return *this; }
    Self & operator--()     { Base::operator--(); return *this; }
    Self operator++(int)    { Self tmp(*this); ++(*this); return tmp; }
    Self operator--(int)    { Self tmp(*this); --(*this); return tmp; }

    bool operator==(const Self& it) const { return (const Base&)*this == it; }
    bool operator!=(const Self& it) const { return ! (*this == it); }

    /// Comparison to NULL pointer
    bool operator==(CGAL_NULL_TYPE ptr) const {
        CGAL_surface_mesh_parameterization_assertion(ptr == NULL);
        return (const Base&)*this == Base();
    }
    bool operator!=(CGAL_NULL_TYPE ptr) const { return ! (*this == ptr); }

    /// Conversion to handle
    operator Param_mesh_patch_vertex_handle<Adaptor>() const {
        return &*(*this);
    }
    operator Param_mesh_patch_vertex_const_handle<Adaptor>() const {
        return &*(*this);
    }
};


/// Param_mesh_patch_vertex_list_const_iterator is an iterator of a
/// Param_mesh_patch_vertex_list list.
/// It provides the same features as
/// Param_mesh_patch_vertex_list<ParameterizationPatchableMesh_3>::const_iterator
/// + a conversion to Param_mesh_patch_vertex_const_handle
template<class ParameterizationPatchableMesh_3>
class Param_mesh_patch_vertex_list_const_iterator
    : public Param_mesh_patch_vertex_list<ParameterizationPatchableMesh_3>::const_iterator
{
// Private types
private:

    typedef typename Param_mesh_patch_vertex_list<ParameterizationPatchableMesh_3>::const_iterator
                                            Base;
    typedef Param_mesh_patch_vertex_list_const_iterator
                                            Self;
    typedef Param_mesh_patch_vertex<ParameterizationPatchableMesh_3>
                                            Vertex;

// Public types
public:

    /// Export template parameter type
    typedef ParameterizationPatchableMesh_3 Adaptor;

// Public operations
public:

    Param_mesh_patch_vertex_list_const_iterator() {}
    Param_mesh_patch_vertex_list_const_iterator(const Base& toCopy) : Base(toCopy) {}

    Param_mesh_patch_vertex_list_const_iterator(const Self& toCopy) : Base(toCopy) {}
    Self& operator=(const Self& toCopy) { Base::operator=(toCopy); return *this; }

    Self & operator++()     { Base::operator++(); return *this; }
    Self & operator--()     { Base::operator--(); return *this; }
    Self operator++(int)    { Self tmp(*this); ++(*this); return tmp; }
    Self operator--(int)    { Self tmp(*this); --(*this); return tmp; }

    bool operator==(const Self& it) const { return (const Base&)*this == it; }
    bool operator!=(const Self& it) const { return ! (*this == it); }

    /// Comparison to NULL pointer
    bool operator==(CGAL_NULL_TYPE ptr) const {
        CGAL_surface_mesh_parameterization_assertion(ptr == NULL);
        return (const Base&)*this == Base();
    }
    bool operator!=(CGAL_NULL_TYPE ptr) const { return ! (*this == ptr); }

    /// Conversion to handle
    operator Param_mesh_patch_vertex_const_handle<Adaptor>() const {
        return &*(*this);
    }
};


CGAL_END_NAMESPACE

#endif //CGAL_PARAM_MESH_PATCH_ITERATORS_H