summaryrefslogtreecommitdiff
path: root/include/gudhi_patches/CGAL/Triangulation_vertex.h
blob: f364717f46651212dcd13cd9ec7711dc90d960f6 (plain)
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
// Copyright (c) 2009-2014 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
// You can redistribute it and/or modify it under the terms of the GNU
// General Public License as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// 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$
// $Id$
//
// Author(s)    : Samuel Hornus

#ifndef CGAL_TRIANGULATION_VERTEX_H
#define CGAL_TRIANGULATION_VERTEX_H

#include <CGAL/Triangulation_ds_vertex.h>
#include <CGAL/Default.h>

namespace CGAL {

struct No_vertex_data {};

template< class TriangulationTraits, typename Data_ = No_vertex_data, class TDSVertex = Default >
class Triangulation_vertex : public Default::Get<TDSVertex, Triangulation_ds_vertex<> >::type
{
    // The default type for TDSVertex is Triangulation_ds_vertex<> :
    typedef typename Default::Get<TDSVertex, Triangulation_ds_vertex<> >::type
                                                                Base;
    typedef Triangulation_vertex<TriangulationTraits, Data_, TDSVertex>    Self;
public:
    typedef Data_                                   Data;
    typedef typename TriangulationTraits::Point_d   Point;
    typedef typename TriangulationTraits::Point_d   Point_d;
    typedef typename Base::Full_cell_handle         Full_cell_handle;

    template <typename TDS2>
    struct Rebind_TDS
    {
        typedef typename Base::template Rebind_TDS<TDS2>::Other TDSVertex2;
        typedef Triangulation_vertex<TriangulationTraits, Data_, TDSVertex2> Other;
    };

private: // DATA MEMBERS
    Point       point_;
    Data        data_;

public:
    template< typename T >
    Triangulation_vertex(Full_cell_handle s, const Point & p, const T & t)
    : Base(s), point_(p), data_(t) {}
    Triangulation_vertex(Full_cell_handle s, const Point & p)
    : Base(s), point_(p), data_() {}
    template< typename T >
    Triangulation_vertex(const Point & p, const T & t)
    : Base(), point_(p), data_(t) {}
    Triangulation_vertex(const Point & p)
    : Base(), point_(p), data_() {}
    Triangulation_vertex() : Base(), point_(), data_() {}

    ~Triangulation_vertex() {}

    /// Set the position in space of the vertex to 'p'
    void set_point(const Point & p)
    {
        point_ = p;
    }

    /// Returns the position in space of the vertex
    const Point & point() const
    {
        return point_;
    }

    const Data & data() const
    {
        return data_;
    }

    Data & data()
    {
        return data_;
    }

};  // end of Triangulation_vertex

// NON CLASS-MEMBER FUNCTIONS

inline
std::istream &
operator>>(std::istream & is, No_vertex_data &)
{
    return is;
}

inline
std::ostream &
operator<<(std::ostream & os, const No_vertex_data &)
{
    return os;
}

template < class A, typename Data, class B >
std::istream &
operator>>(std::istream & is, Triangulation_vertex<A, Data, B> & v)
{
    is >> v.point();
    return (is >> v.data());
}

template< class A, typename Data, class B >
std::ostream &
operator<<(std::ostream & os, const Triangulation_vertex<A, Data, B> & v)
{
    os << v.point();
    os << v.data();
    return os;
}

} //namespace CGAL

#endif // CGAL_TRIANGULATION_VERTEX_H