/usr/include/CGAL/Tree_base.h is in libcgal-dev 4.11-2build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 | // Copyright (c) 1997 ETH Zurich (Switzerland).
// 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) : Gabriele Neyer
#ifndef CGAL_TREE_BASE_H
#define CGAL_TREE_BASE_H
#include <CGAL/license/SearchStructures.h>
#include <iterator>
#include <iostream>
#include <functional>
#include <list>
#include <vector>
#include <CGAL/assertions.h>
#include <CGAL/Tree_assertions.h>
#ifndef CGAL_TREE_BASE_NULL
#define CGAL_TREE_BASE_NULL 0
#endif
#define stlvector
namespace CGAL {
//link type definition of an ordinary vertex of the tree
template < typename Node >
struct Tree_node_base {
Node *parent_link;
Node *left_link;
Node *right_link;
Tree_node_base()
: parent_link(0), left_link(0), right_link(0)
{}
Tree_node_base(Node* ll, Node* rl)
: parent_link(0), left_link(ll), right_link(rl)
{}
};
// -------------------------------------------------------------------
// pure virtual abstract base class.
// Designed according to the Prototype Design Pattern
// A tree class has to be derived from this class.
template <class C_Data, class C_Window>
class Tree_base
{
protected:
Tree_base(Tree_base const &); // prevent access
void operator= (Tree_base const &); // prevent access
public:
typedef double vit;
typedef int lit;
typedef int lbit;
typedef double vbit;
typedef char oit;
// typedef std::vector<C_Data>::iterator vit;
//typedef std::list<C_Data>::iterator lit;
//typedef std::back_insert_iterator<lit> lbit;
//typedef std::back_insert_iterator<vit> vbit;
typedef Tree_base<C_Data, C_Window> Tree_base_type;
Tree_base() {}
virtual ~Tree_base() {}
// 'clone()' returns an object which can be used as argument to 'delete'
virtual Tree_base<C_Data, C_Window> *clone() const = 0;
//virtual Tree_base_type *clone() const = 0;
// 'make_tree()' returns an object which can be used as argument to 'delete'
virtual bool make_tree(const typename std::list<C_Data>::iterator& beg,
const typename std::list<C_Data>::iterator& end,
lit *dummy=0) =0;
#ifdef stlvector
virtual bool make_tree(const typename std::vector<C_Data>::iterator& beg,
const typename std::vector<C_Data>::iterator& end,
vit *dummy=0) =0;
#endif
#ifdef carray
virtual bool make_tree(const C_Data *beg,
const C_Data *end) =0;
#endif
virtual std::back_insert_iterator< std::list<C_Data> >
window_query(C_Window const &win, std::back_insert_iterator<
std::list<C_Data> > out,lbit *dummy=0 ) = 0;
virtual std::back_insert_iterator< std::vector<C_Data> >
window_query(C_Window const &win, std::back_insert_iterator<
std::vector<C_Data> > out,vbit *dummy=0) = 0;
#ifdef carray
virtual C_Data * window_query( C_Window const &win,
C_Data * out) = 0;
#endif
#ifdef ostreamiterator
typedef std::ostream_iterator< C_Data> oit;
virtual std::ostream_iterator< C_Data> window_query( C_Window const &win,
std::ostream_iterator< C_Data> out,
oit *dummy=0 ) = 0;
#endif
virtual std::back_insert_iterator< std::list< C_Data> >
enclosing_query( C_Window const &win, std::back_insert_iterator<
std::list< C_Data> > out, lbit *dummy=0 ) = 0;
virtual std::back_insert_iterator< std::vector< C_Data> >
enclosing_query( C_Window const &win, std::back_insert_iterator<
std::vector< C_Data> > out,vbit *dummy=0 ) = 0;
#ifdef carray
virtual C_Data * enclosing_query( C_Window const &win,
C_Data *out) = 0;
#endif
#ifdef ostreamiterator
virtual std::ostream_iterator< C_Data> enclosing_query( C_Window const &win,
std::ostream_iterator< C_Data> out,
oit *dummy=0) = 0;
#endif
virtual bool is_inside( C_Window const &win,
C_Data const& object) const =0;
virtual bool is_anchor()const =0;
virtual bool is_valid()const =0;
};
// -------------------------------------------------------------------
// Tree Anchor: this class is used as a recursion anchor.
// The derived tree classes can be nested. Use this class as the
// most inner class. This class is doing nothin exept stopping the recursion
template <class C_Data, class C_Window>
class Tree_anchor: public Tree_base< C_Data, C_Window>
{
public:
// Construct a factory with the given factory as sublayer
Tree_anchor() {}
virtual ~Tree_anchor(){}
Tree_base<C_Data, C_Window> *clone() const { return new Tree_anchor(); }
typedef Tree_base<C_Data, C_Window> tbt;
// Tree_base_type *clone() const { return new Tree_anchor(); }
bool make_tree(const typename std::list< C_Data>::iterator& /*beg*/,
const typename std::list< C_Data>::iterator& /*end*/,
typename tbt::lit * =0)
{
return true;
}
#ifdef stlvector
bool make_tree(const typename std::vector< C_Data>::iterator& /*beg*/,
const typename std::vector< C_Data>::iterator& /*end*/,
typename tbt::vit * =0)
{
return true;
}
#endif
#ifdef carray
bool make_tree(const C_Data * /*beg*/,
const C_Data * /*end*/)
{
return true;
}
#endif
std::back_insert_iterator< std::list< C_Data> >
window_query(
C_Window const &,
std::back_insert_iterator< std::list< C_Data> > out,
typename tbt::lbit * =0){
return out;
}
std::back_insert_iterator< std::vector< C_Data> >
window_query( C_Window const &,
std::back_insert_iterator< std::vector< C_Data> > out,
typename tbt::vbit * =0){
return out;
}
#ifdef carray
C_Data * window_query( C_Window const &,
C_Data * out){
return out;
}
#endif
#ifdef ostreamiterator
std::ostream_iterator< C_Data> window_query( C_Window const &,
std::ostream_iterator< C_Data> out,
typename tbt::oit *dummy=0){
return out;
}
#endif
std::back_insert_iterator< std::list< C_Data> > enclosing_query( C_Window const &,
std::back_insert_iterator< std::list< C_Data> > out,
typename tbt::lbit * =0){
return out;
}
std::back_insert_iterator< std::vector< C_Data> > enclosing_query( C_Window const &,
std::back_insert_iterator< std::vector< C_Data> > out,
typename tbt::vbit * =0){
return out;
}
#ifdef carray
C_Data * enclosing_query( C_Window const &,
C_Data * out){
return out;
}
#endif
#ifdef ostreamiterator
std::ostream_iterator< C_Data> enclosing_query( C_Window const &,
std::ostream_iterator< C_Data> out,
typename tbt::oit *dummy=0){
return out;
}
#endif
bool is_valid()const{ return true;}
protected:
bool is_inside( C_Window const &,
C_Data const&) const
{
return true;
}
bool is_anchor()const {return true;}
};
} //namespace CGAL
#endif
|