Point Cloud Library (PCL)  1.9.1-dev
outofcore_iterator_base.h
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Point Cloud Library (PCL) - www.pointclouds.org
5  * Copyright (c) 2010-2012, Willow Garage, Inc.
6  *
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  *
13  * * Redistributions of source code must retain the above copyright
14  * notice, this list of conditions and the following disclaimer.
15  * * Redistributions in binary form must reproduce the above
16  * copyright notice, this list of conditions and the following
17  * disclaimer in the documentation and/or other materials provided
18  * with the distribution.
19  * * Neither the name of Willow Garage, Inc. nor the names of its
20  * contributors may be used to endorse or promote products derived
21  * from this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34  * POSSIBILITY OF SUCH DAMAGE.
35  *
36  * $Id$
37  */
38 
39 #pragma once
40 
41 #include <iterator>
42 
43 #include <pcl/point_types.h>
44 
45 #include <pcl/outofcore/octree_base.h>
46 #include <pcl/outofcore/octree_base_node.h>
47 #include <pcl/outofcore/octree_disk_container.h>
48 
49 namespace pcl
50 {
51  namespace outofcore
52  {
53  /** \brief Abstract octree iterator class
54  * \note This class is based on the octree_iterator written by Julius Kammerl adapted to the outofcore octree. The interface is very similar, but it does \b not inherit the \ref pcl::octree iterator base.
55  * \ingroup outofcore
56  * \author Stephen Fox (foxstephend@gmail.com)
57  */
58  template<typename PointT, typename ContainerT>
59  class OutofcoreIteratorBase : public std::iterator<std::forward_iterator_tag, /*iterator type*/
60  const OutofcoreOctreeBaseNode<ContainerT, PointT>,
61  void, /*no defined distance between iterator*/
62  const OutofcoreOctreeBaseNode<ContainerT, PointT>*,/*Pointer type*/
63  const OutofcoreOctreeBaseNode<ContainerT, PointT>&>/*Reference type*/
64  {
65  public:
68 
71 
73 
74  explicit
76  : octree_ (octree_arg), currentNode_ (nullptr)
77  {
78  reset ();
79  }
80 
81  virtual
83  {
84  }
85 
88  {
89  }
90 
91  inline OutofcoreIteratorBase&
93  {
94  octree_ = src.octree_;
97  }
98 
99 
100  inline OutofcoreNodeType*
101  operator* () const
102  {
103  return (this->getCurrentOctreeNode ());
104  }
105 
106  virtual inline OutofcoreNodeType*
108  {
109  return (currentNode_);
110  }
111 
112  virtual inline void
113  reset ()
114  {
115  currentNode_ = static_cast<OctreeDiskNode*> (octree_.getRootNode ());
117  max_depth_ = static_cast<unsigned int> (octree_.getDepth ());
118  }
119 
120  inline void
121  setMaxDepth (unsigned int max_depth)
122  {
123  if (max_depth > static_cast<unsigned int> (octree_.getDepth ()))
124  {
125  max_depth = static_cast<unsigned int> (octree_.getDepth ());
126  }
127 
128  max_depth_ = max_depth;
129  }
130 
131  protected:
134  unsigned int currentOctreeDepth_;
135  unsigned int max_depth_;
136  };
137 
138 
139 #if 0
141  {
142 
143 
144 
145 
146  };
147 
148  class PCL_EXPORTS OutofcoreLeafIterator : public OutofcoreIteratorBase
149  {
150 
151 
152 
153  };
154 #endif
155  }
156 }
This file defines compatibility wrappers for low level I/O functions.
Definition: convolution.h:45
std::uint64_t getDepth() const
Get number of LODs, which is the height of the tree.
Definition: octree_base.h:435
OutofcoreIteratorBase(const OutofcoreIteratorBase &src)
virtual OutofcoreNodeType * getCurrentOctreeNode() const
OutofcoreIteratorBase & operator=(const OutofcoreIteratorBase &src)
typename OctreeDisk::OutofcoreNodeType OutofcoreNodeType
Defines all the PCL implemented PointT point type structures.
typename pcl::outofcore::OutofcoreOctreeBase< ContainerT, PointT >::LeafNode LeafNode
OutofcoreOctreeBaseNode Class internally representing nodes of an outofcore octree, with accessors to its data via the pcl::outofcore::OutofcoreOctreeDiskContainer class or pcl::outofcore::OutofcoreOctreeRamContainer class, whichever it is templated against.
Abstract octree iterator class.
OutofcoreNodeType * getRootNode()
Definition: octree_base.h:585
This code defines the octree used for point storage at Urban Robotics.
Definition: octree_base.h:150
OutofcoreOctreeBaseNode< ContainerT, PointT > OutofcoreNodeType
Definition: octree_base.h:164
#define PCL_EXPORTS
Definition: pcl_macros.h:241
typename pcl::outofcore::OutofcoreOctreeBase< ContainerT, PointT >::BranchNode BranchNode