Point Cloud Library (PCL)  1.11.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 }
pcl
Definition: convolution.h:46
point_types.h
pcl::outofcore::OutofcoreIteratorBase
Abstract octree iterator class.
Definition: outofcore_iterator_base.h:59
pcl::outofcore::OutofcoreIteratorBase::OutofcoreIteratorBase
OutofcoreIteratorBase(OctreeDisk &octree_arg)
Definition: outofcore_iterator_base.h:75
pcl::outofcore::OutofcoreBreadthFirstIterator
Definition: outofcore_breadth_first_iterator.h:54
pcl::outofcore::OutofcoreIteratorBase::max_depth_
unsigned int max_depth_
Definition: outofcore_iterator_base.h:135
pcl::outofcore::OutofcoreOctreeBaseNode
OutofcoreOctreeBaseNode Class internally representing nodes of an outofcore octree,...
Definition: octree_base_node.h:62
pcl::outofcore::OutofcoreIteratorBase::OutofcoreIteratorBase
OutofcoreIteratorBase(const OutofcoreIteratorBase &src)
Definition: outofcore_iterator_base.h:86
pcl::outofcore::OutofcoreOctreeBase::getDepth
std::uint64_t getDepth() const
Get number of LODs, which is the height of the tree.
Definition: octree_base.h:435
pcl::outofcore::OutofcoreIteratorBase::operator*
OutofcoreNodeType * operator*() const
Definition: outofcore_iterator_base.h:101
pcl::outofcore::OutofcoreOctreeBase::OutofcoreNodeType
OutofcoreOctreeBaseNode< ContainerT, PointT > OutofcoreNodeType
Definition: octree_base.h:164
pcl::outofcore::OutofcoreIteratorBase< pcl::PointXYZ, OutofcoreOctreeDiskContainer< pcl::PointXYZ > >::LeafNode
typename pcl::outofcore::OutofcoreOctreeBase< OutofcoreOctreeDiskContainer< pcl::PointXYZ >, pcl::PointXYZ >::LeafNode LeafNode
Definition: outofcore_iterator_base.h:70
pcl::outofcore::OutofcoreIteratorBase::getCurrentOctreeNode
virtual OutofcoreNodeType * getCurrentOctreeNode() const
Definition: outofcore_iterator_base.h:107
pcl::outofcore::OutofcoreIteratorBase::reset
virtual void reset()
Definition: outofcore_iterator_base.h:113
pcl::outofcore::OutofcoreIteratorBase::operator=
OutofcoreIteratorBase & operator=(const OutofcoreIteratorBase &src)
Definition: outofcore_iterator_base.h:92
pcl::outofcore::OutofcoreIteratorBase::octree_
OctreeDisk & octree_
Definition: outofcore_iterator_base.h:132
pcl::outofcore::OutofcoreOctreeBase::getRootNode
OutofcoreNodeType * getRootNode()
Definition: octree_base.h:585
pcl::outofcore::OutofcoreIteratorBase< pcl::PointXYZ, OutofcoreOctreeDiskContainer< pcl::PointXYZ > >::OutofcoreNodeType
typename OctreeDisk::OutofcoreNodeType OutofcoreNodeType
Definition: outofcore_iterator_base.h:72
pcl::outofcore::OutofcoreIteratorBase< pcl::PointXYZ, OutofcoreOctreeDiskContainer< pcl::PointXYZ > >::BranchNode
typename pcl::outofcore::OutofcoreOctreeBase< OutofcoreOctreeDiskContainer< pcl::PointXYZ >, pcl::PointXYZ >::BranchNode BranchNode
Definition: outofcore_iterator_base.h:69
pcl::outofcore::OutofcoreIteratorBase::currentOctreeDepth_
unsigned int currentOctreeDepth_
Definition: outofcore_iterator_base.h:134
pcl::outofcore::OutofcoreIteratorBase::~OutofcoreIteratorBase
virtual ~OutofcoreIteratorBase()
Definition: outofcore_iterator_base.h:82
pcl::outofcore::OutofcoreOctreeBase
This code defines the octree used for point storage at Urban Robotics.
Definition: octree_base.h:150
pcl::outofcore::OutofcoreIteratorBase::currentNode_
OctreeDiskNode * currentNode_
Definition: outofcore_iterator_base.h:133
pcl::outofcore::OutofcoreIteratorBase::setMaxDepth
void setMaxDepth(unsigned int max_depth)
Definition: outofcore_iterator_base.h:121
PCL_EXPORTS
#define PCL_EXPORTS
Definition: pcl_macros.h:323