SheafSystem  0.0.0.0
d_tree_point_locator_node.h
Go to the documentation of this file.
1 
2 //
3 // Copyright (c) 2014 Limit Point Systems, Inc.
4 //
5 // Licensed under the Apache License, Version 2.0 (the "License");
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17 
20 
21 #ifndef D_TREE_POINT_LOCATOR_NODE_H
22 #define D_TREE_POINT_LOCATOR_NODE_H
23 
24 #ifndef SHEAF_DLL_SPEC_H
25 #include "SheafSystem/sheaf_dll_spec.h"
26 #endif
27 
28 #ifndef SHEAF_H
29 #include "SheafSystem/sheaf.h"
30 #endif
31 
32 #ifndef SINGLY_LINKED_LIST_H
33 #include "SheafSystem/singly_linked_list.h"
34 #endif
35 
36 //#undef DIAGNOSTIC_OUTPUT
37 //#define DIAGNOSTIC_OUTPUT
38 
39 namespace sheaf
40 {
41 template <class T>
43 
44 }
45 
46 namespace geometry
47 {
48 
49 using namespace sheaf;
50 
51 template <int DC, int DB>
52 class d_bounding_box;
53 template <int DC, int DB>
55 
59 template <int DC, int DB>
60 class SHEAF_DLL_SPEC d_tree_point_locator_node
61 {
62  friend class ptr_linked_pool< d_tree_point_locator_node<DC, DB> >;
63 
64  // ===========================================================
66  // ===========================================================
68 
69 public:
70 
75 
79  d_tree_point_locator_node();
80 
84  d_tree_point_locator_node(const d_tree_point_locator_node<DC, DB>& xother);
85 
90  (const d_tree_point_locator_node<DC, DB>& xother);
91 
96 
100  ~d_tree_point_locator_node();
101 
105  bool invariant() const;
106 
110  d_tree_point_locator_node<DC, DB>* branch(int xindex) const;
111 
115  bool is_leaf() const;
116 
120  bool is_empty() const;
121 
125  void insert_box(const d_bounding_box<DC, DB>* xbox,
127 
131  void remove_box(const d_bounding_box<DC, DB>* xbox,
133 
137  bool contains_box(const d_bounding_box<DC, DB>* xbox,
138  d_tree_point_locator_path<DC, DB>& xpath) const;
139 
145  void clear();
146 
151 
155  const box_list_type& box_list(d_tree_point_locator_path<DC, DB>& xpath) const;
156 
160  const box_list_type& box_list() const;
161 
165  std::string* to_string() const;
166 
170  static size_type degree();
171 
175  size_type branch_ct() const;
176 
177 protected:
178 
182  box_list_type _box_list;
183 
187  static const size_type DEGREE = 1<<DC;
188 
193 
197  size_type _branch_ct;
198 
203  d_tree_point_locator_node<DC, DB>* next() const;
204 
209  void put_next(d_tree_point_locator_node<DC, DB>* xnode);
210 
212 
213 };
214 
215 // ===========================================================
216 // NON-MEMBER FUNCTIONS
217 // ===========================================================
218 
222 template <int DC, int DB>
223 SHEAF_DLL_SPEC
224 std::ostream&
225 operator<<(std::ostream& xos, const d_tree_point_locator_node<DC, DB>& xnode);
226 
227 } // namespace geometry
228 
229 #endif // D_TREE_POINT_LOCATOR_NODE_H
A reallocatable pool of objects of type T. Objects in the pool are either "allocated" or linked toget...
box_list_type _box_list
The list of bounding boxes associated with this.
size_type _branch_ct
The number of non-null branches.
unsigned long size_type
An unsigned integral type used to represent sizes and capacities.
Definition: sheaf.h:52
sheaf::size_type size_type
An unsigned integral type used to represent sizes and capacities.
A bounding box that can be strung together into a list.
bool operator==(const singly_linked_list< T, Alloc > &lhs, const singly_linked_list< T, Alloc > &rhs)
Checks if the contents of lhs and rhs are equal, that is, whether lhs.size() == rhs.size() and each element in lhs compares equal with the element in rhs at the same position.
A path in an d_tree_point_locator search structure.
Namespace for the sheaves component of the sheaf system.
singly_linked_list< const d_bounding_box< DC, DB > * > box_list_type
The type of box list.
A node in a d_tree_point_locator search structure.
Namespace for geometry component of sheaf system.
Definition: field_vd.h:54
Wrapper class for forward_list or slist depending on compiler. The class replicates the minimum subse...