cloud_iterator.h
Go to the documentation of this file.
00001 /*
00002  * Software License Agreement (BSD License)
00003  *
00004  *  Point Cloud Library (PCL) - www.pointclouds.org
00005  *  Copyright (c) 2012-, Open Perception, Inc.
00006  *
00007  *  All rights reserved.
00008  *
00009  *  Redistribution and use in source and binary forms, with or without
00010  *  modification, are permitted provided that the following conditions
00011  *  are met:
00012  *
00013  *   * Redistributions of source code must retain the above copyright
00014  *     notice, this list of conditions and the following disclaimer.
00015  *   * Redistributions in binary form must reproduce the above
00016  *     copyright notice, this list of conditions and the following
00017  *     disclaimer in the documentation and/or other materials provided
00018  *     with the distribution.
00019  *   * Neither the name of the copyright holder(s) nor the names of its
00020  *     contributors may be used to endorse or promote products derived
00021  *     from this software without specific prior written permission.
00022  *
00023  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00024  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00025  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00026  *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00027  *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00028  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00029  *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00030  *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00031  *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00032  *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00033  *  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00034  *  POSSIBILITY OF SUCH DAMAGE.
00035  *
00036  *
00037  */
00038 
00039 #ifndef PCL_POINT_CLOUD_ITERATOR_H_
00040 #define PCL_POINT_CLOUD_ITERATOR_H_
00041 
00042 #include <pcl/point_cloud.h>
00043 #include <pcl/PointIndices.h>
00044 #include <pcl/correspondence.h>
00045 
00046 namespace pcl
00047 {
00051   template <typename PointT>
00052   class CloudIterator
00053   {
00054     public:
00055       CloudIterator (PointCloud<PointT>& cloud);
00056 
00057       CloudIterator (PointCloud<PointT>& cloud, const std::vector<int>& indices);
00058 
00059       CloudIterator (PointCloud<PointT>& cloud, const PointIndices& indices);
00060 
00061       CloudIterator (PointCloud<PointT>& cloud, const Correspondences& corrs, bool source);
00062 
00063       ~CloudIterator ();
00064 
00065       void operator ++ ();
00066 
00067       void operator ++ (int);
00068 
00069       PointT& operator* () const;
00070 
00071       PointT* operator-> () const;
00072 
00073       unsigned getCurrentPointIndex () const;
00074 
00075       unsigned getCurrentIndex () const;
00076 
00078       size_t size () const;
00079 
00080       void reset ();
00081 
00082       bool isValid () const;
00083 
00084       operator bool () const
00085       {
00086         return isValid ();
00087       }
00088     private:
00089 
00090       class Iterator
00091       {
00092         public:
00093           virtual ~Iterator ()  {}
00094 
00095           virtual void operator ++ () = 0;
00096 
00097           virtual void operator ++ (int) = 0;
00098 
00099           virtual PointT& operator* () const = 0;
00100 
00101           virtual PointT* operator-> () const = 0;
00102 
00103           virtual unsigned getCurrentPointIndex () const = 0;
00104 
00105           virtual unsigned getCurrentIndex () const = 0;
00106 
00108           virtual size_t size () const = 0;
00109 
00110           virtual void reset () = 0;
00111 
00112           virtual bool isValid () const = 0;
00113       };
00114       Iterator* iterator_;
00115   };
00116 
00120   template <typename PointT>
00121   class ConstCloudIterator
00122   {
00123     public:
00124       ConstCloudIterator (const PointCloud<PointT>& cloud);
00125 
00126       ConstCloudIterator (const PointCloud<PointT>& cloud, const std::vector<int>& indices);
00127 
00128       ConstCloudIterator (const PointCloud<PointT>& cloud, const PointIndices& indices);
00129 
00130       ConstCloudIterator (const PointCloud<PointT>& cloud, const Correspondences& corrs, bool source);
00131 
00132       ~ConstCloudIterator ();
00133 
00134       void operator ++ ();
00135 
00136       void operator ++ (int);
00137 
00138       const PointT& operator* () const;
00139 
00140       const PointT* operator-> () const;
00141 
00142       unsigned getCurrentPointIndex () const;
00143 
00144       unsigned getCurrentIndex () const;
00145 
00147       size_t size () const;
00148 
00149       void reset ();
00150 
00151       bool isValid () const;
00152 
00153       operator bool () const
00154       {
00155         return isValid ();
00156       }
00157     private:
00158 
00159       class Iterator
00160       {
00161         public:
00162           virtual ~Iterator ()  {}
00163 
00164           virtual void operator ++ () = 0;
00165 
00166           virtual void operator ++ (int) = 0;
00167 
00168           virtual const PointT& operator* () const = 0;
00169 
00170           virtual const PointT* operator-> () const = 0;
00171 
00172           virtual unsigned getCurrentPointIndex () const = 0;
00173 
00174           virtual unsigned getCurrentIndex () const = 0;
00175 
00177           virtual size_t size () const = 0;
00178 
00179           virtual void reset () = 0;
00180 
00181           virtual bool isValid () const = 0;
00182       };
00183 
00184       class DefaultConstIterator;
00185       class ConstIteratorIdx;
00186       Iterator* iterator_;
00187   };
00188 
00189 } // namespace pcl
00190 
00191 #include <pcl/impl/cloud_iterator.hpp>
00192 
00193 #endif    // PCL_POINT_CLOUD_ITERATOR_H_


pcl
Author(s): Open Perception
autogenerated on Wed Aug 26 2015 15:22:43