octree_ram_container.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) 2010-2012, Willow Garage, Inc.
00006  *  Copyright (c) 2012, Urban Robotics, Inc.
00007  *
00008  *  All rights reserved.
00009  *
00010  *  Redistribution and use in source and binary forms, with or without
00011  *  modification, are permitted provided that the following conditions
00012  *  are met:
00013  *
00014  *   * Redistributions of source code must retain the above copyright
00015  *     notice, this list of conditions and the following disclaimer.
00016  *   * Redistributions in binary form must reproduce the above
00017  *     copyright notice, this list of conditions and the following
00018  *     disclaimer in the documentation and/or other materials provided
00019  *     with the distribution.
00020  *   * Neither the name of Willow Garage, Inc. nor the names of its
00021  *     contributors may be used to endorse or promote products derived
00022  *     from this software without specific prior written permission.
00023  *
00024  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00025  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00026  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00027  *  FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00028  *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00029  *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00030  *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00031  *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00032  *  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00033  *  LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00034  *  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00035  *  POSSIBILITY OF SUCH DAMAGE.
00036  *
00037  *  $Id$
00038  */
00039 
00040 #ifndef PCL_OUTOFCORE_OCTREE_RAM_CONTAINER_H_
00041 #define PCL_OUTOFCORE_OCTREE_RAM_CONTAINER_H_
00042 
00043 // C++
00044 #include <vector>
00045 
00046 #include <pcl/outofcore/boost.h>
00047 #include <pcl/outofcore/octree_abstract_node_container.h>
00048 
00049 namespace pcl
00050 {
00051   namespace outofcore
00052   {
00062     template<typename PointT>
00063     class OutofcoreOctreeRamContainer : public OutofcoreAbstractNodeContainer<PointT>
00064     {
00065       public:
00066         typedef typename OutofcoreAbstractNodeContainer<PointT>::AlignedPointTVector AlignedPointTVector;
00067 
00070         OutofcoreOctreeRamContainer (const boost::filesystem::path&) : container_ () { }
00071         
00076         void
00077         insertRange (const PointT* start, const uint64_t count);
00078 
00083         void
00084         insertRange (const PointT* const * start, const uint64_t count);
00085 
00086         void
00087         insertRange (AlignedPointTVector &p)
00088         {
00089           PCL_ERROR ("[pcl::outofcore::OutofcoreOctreeRamContainer] Inserting eigen-aligned point vectors is not implemented using the ram containers\n");
00090           //insertRange (&(p.begin ()), p.size ());
00091         }
00092 
00093         void
00094         insertRange (const AlignedPointTVector &p)
00095         {
00096           PCL_ERROR ("[pcl::outofcore::OutofcoreOctreeRamContainer] Inserting eigen-aligned point vectors is not implemented using the ram containers\n");
00097         }
00098         
00104         void
00105         readRange (const uint64_t start, const uint64_t count, AlignedPointTVector &v);
00106 
00116         void
00117         readRangeSubSample (const uint64_t start, const uint64_t count, const double percent, AlignedPointTVector &v);
00118 
00120         inline uint64_t
00121         size () const
00122         {
00123           return container_.size ();
00124         }
00125 
00126         inline bool
00127         empty () const
00128         {
00129           return container_.empty ();
00130         }
00131         
00132 
00134         inline void
00135         clear ()
00136         {
00137           //clear the elements in the vector of points
00138           container_.clear ();
00139         }
00140 
00144         void
00145         convertToXYZ (const boost::filesystem::path &path);
00146 
00147         inline PointT
00148         operator[] (uint64_t index) const
00149         {
00150           assert ( index < container_.size () );
00151           return ( container_[index] );
00152         }
00153         
00154 
00155       protected:
00156         //no copy construction
00157         OutofcoreOctreeRamContainer (const OutofcoreOctreeRamContainer &rval) { }
00158 
00159         OutofcoreOctreeRamContainer&
00160         operator= (const OutofcoreOctreeRamContainer& rval) { }
00161 
00162         //the actual container
00163         //std::deque<PointT> container;
00164 
00166         AlignedPointTVector container_;
00167 
00168         static boost::mutex rng_mutex_;
00169         static boost::mt19937 rand_gen_;
00170     };
00171   }
00172 }
00173 
00174 #endif //PCL_OUTOFCORE_OCTREE_RAM_CONTAINER_H_


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