Point Cloud Library (PCL)
1.7.0
Main Page
Modules
Namespaces
Classes
io
include
pcl
io
file_grabber.h
1
2
/*
3
* Software License Agreement (BSD License)
4
*
5
* Point Cloud Library (PCL) - www.pointclouds.org
6
* Copyright (c) 2010-2011, Willow Garage, Inc.
7
* Copyright (c) 2012-, Open Perception, Inc.
8
*
9
* All rights reserved.
10
*
11
* Redistribution and use in source and binary forms, with or without
12
* modification, are permitted provided that the following conditions
13
* are met:
14
*
15
* * Redistributions of source code must retain the above copyright
16
* notice, this list of conditions and the following disclaimer.
17
* * Redistributions in binary form must reproduce the above
18
* copyright notice, this list of conditions and the following
19
* disclaimer in the documentation and/or other materials provided
20
* with the distribution.
21
* * Neither the name of the copyright holder(s) nor the names of its
22
* contributors may be used to endorse or promote products derived
23
* from this software without specific prior written permission.
24
*
25
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
28
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
29
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
30
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
31
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
32
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
33
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
35
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36
* POSSIBILITY OF SUCH DAMAGE.
37
*
38
* $Id: file_grabber.h 8413 2013-01-15 08:37:39Z sdmiller $
39
*
40
*/
41
42
#pragma once
43
#ifndef PCL_IO_FILE_GRABBER_H_
44
#define PCL_IO_FILE_GRABBER_H_
45
46
#include <pcl/point_cloud.h>
47
48
namespace
pcl
49
{
50
/** \brief FileGrabber provides a container-style interface for grabbers which operate on fixed-size input
51
* \author Stephen Miller
52
* \ingroup io
53
*/
54
template
<
typename
Po
int
T>
55
class
PCL_EXPORTS
FileGrabber
56
{
57
public
:
58
59
/** \brief Empty destructor */
60
virtual
~FileGrabber
() {}
61
62
/** \brief operator[] Returns the idx-th cloud in the dataset, without bounds checking.
63
* Note that in the future, this could easily be modified to do caching
64
* \param[in] idx The frame to load
65
*/
66
virtual
const
boost::shared_ptr< const pcl::PointCloud<PointT> >
67
operator[] (
size_t
idx)
const
= 0;
68
69
/** \brief size Returns the number of clouds currently loaded by the grabber */
70
virtual
size_t
71
size ()
const
= 0;
72
73
/** \brief at Returns the idx-th cloud in the dataset, with bounds checking
74
* \param[in] idx The frame to load
75
*/
76
virtual
const
boost::shared_ptr< const pcl::PointCloud<PointT> >
77
at (
size_t
idx)
const
78
{
79
if
(idx >= size ())
80
{
81
// Throw error
82
throw
pcl::IOException
(
"[pcl::FileGrabber] Attempted to access element which is out of bounds!"
);
83
}
84
else
85
{
86
return
(
operator
[] (idx));
87
}
88
}
89
};
90
}
91
#endif//PCL_IO_FILE_GRABBER_H_
92