Point Cloud Library (PCL)  1.14.0-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>
60  {
61  public:
62  using iterator_category = std::forward_iterator_tag;
64  using difference_type = void;
67 
70 
73 
75 
76  explicit
78  : octree_ (octree_arg), currentNode_ (nullptr)
79  {
80  reset ();
81  }
82 
83  virtual
84  ~OutofcoreIteratorBase () = default;
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 }
OutofcoreIteratorBase & operator=(const OutofcoreIteratorBase &src)
typename pcl::outofcore::OutofcoreOctreeBase< ContainerT, PointT >::BranchNode BranchNode
typename OctreeDisk::OutofcoreNodeType OutofcoreNodeType
typename pcl::outofcore::OutofcoreOctreeBase< ContainerT, PointT >::LeafNode LeafNode
OutofcoreIteratorBase(const OutofcoreIteratorBase &src)
virtual OutofcoreNodeType * getCurrentOctreeNode() const
This code defines the octree used for point storage at Urban Robotics.
Definition: octree_base.h:151
std::uint64_t getDepth() const
Get number of LODs, which is the height of the tree.
Definition: octree_base.h:435
OutofcoreOctreeBaseNode< ContainerT, PointT > OutofcoreNodeType
Definition: octree_base.h:164
OutofcoreNodeType * getRootNode()
Definition: octree_base.h:585
OutofcoreOctreeBaseNode Class internally representing nodes of an outofcore octree,...
Defines all the PCL implemented PointT point type structures.
#define PCL_EXPORTS
Definition: pcl_macros.h:323