23 #ifndef _LIBS_PCL_UTILS_STORAGE_ADAPTER_H_ 24 #define _LIBS_PCL_UTILS_STORAGE_ADAPTER_H_ 26 #include <pcl/point_cloud.h> 27 #include <pcl_utils/transforms.h> 28 #include <pcl_utils/utils.h> 33 template <
typename Po
intT>
42 template <
typename Po
intT>
45 template <
typename Po
intT>
50 virtual void transform(
const std::string & target_frame,
51 const Time & target_time,
52 const std::string & fixed_frame,
58 virtual unsigned int width()
const = 0;
59 virtual unsigned int height()
const = 0;
62 virtual std::string
frame_id()
const = 0;
66 template <
typename Po
intT>
67 class PointCloudStorageAdapter :
public StorageAdapter
93 return pcl_utils::cloudptr_from_refptr(
cloud);
102 return pcl_utils::cloudptr_from_refptr(
cloud);
109 virtual void transform(
const std::string & target_frame,
110 const Time & target_time,
111 const std::string & fixed_frame,
117 return typeid(
this).name();
122 return sizeof(PointT);
132 return cloud->height;
137 return cloud->points.size();
142 return &
cloud->points[0];
147 return cloud->header.frame_id;
152 template <
typename Po
intT>
161 template <
typename Po
intT>
167 throw Exception(
"PointCloud storage adapter is not of anticipated type");
172 template <
typename Po
intT>
179 template <
typename Po
intT>
183 pcl_utils::get_time(cloud, time);
186 template <
typename Po
intT>
192 pcl_utils::transform_pointcloud(target_frame, **cloud, tmp, transformer);
196 template <
typename Po
intT>
199 const Time & target_time,
200 const std::string & fixed_frame,
204 pcl_utils::transform_pointcloud(
205 target_frame, target_time, fixed_frame, **cloud, tmp, transformer);
const RefPtr< pcl::PointCloud< PointT > > cloud
The point cloud.
virtual void get_time(fawkes::Time &time) const
Get last capture time.
Fawkes library namespace.
virtual unsigned int width() const =0
Get width of point cloud.
virtual unsigned int height() const
Get height of point cloud.
virtual StorageAdapter * clone() const =0
Clone this storage adapter.
A class for handling time.
virtual size_t num_points() const
Get numer of points in point cloud.
virtual size_t point_size() const =0
Get size of a point.
virtual unsigned int height() const =0
Get height of point cloud.
Adapter class for PCL point types.
virtual size_t point_size() const
Get size of a point.
bool is_pointtype() const
Check if storage adapter is for specified point type.
virtual std::string frame_id() const =0
Get frame ID of point cloud.
virtual std::string frame_id() const
Get frame ID of point cloud.
PointCloudStorageAdapter< PointT > * as_pointtype()
Transform to specific PointCloudStorageAdapter.
virtual unsigned int width() const
Get width of point cloud.
virtual void * data_ptr() const =0
Get pointer on data.
virtual void transform(const std::string &target_frame, const tf::Transformer &transformer)
Transform point cloud.
Base class for exceptions in Fawkes.
virtual StorageAdapter * clone() const
Clone this storage adapter.
PointCloudStorageAdapter(const PointCloudStorageAdapter< PointT > *p)
Copy constructor.
pcl::PointCloud< PointT >::Ptr cloud_ptr()
Get PCL shared pointer to cloud.
virtual void get_time(fawkes::Time &time) const =0
Get last capture time.
virtual const char * get_typename()
Get typename of storage adapter.
RefPtr<> is a reference-counting shared smartpointer.
virtual const char * get_typename()=0
Get typename of storage adapter.
virtual ~StorageAdapter()
Virtual empty destructor.
virtual void * data_ptr() const
Get pointer on data.
pcl::PointCloud< PointT >::ConstPtr cloud_const_ptr()
Get PCL const shared pointer to cloud.
virtual size_t num_points() const =0
Get numer of points in point cloud.
virtual void transform(const std::string &target_frame, const tf::Transformer &transformer)=0
Transform point cloud.
PointCloudStorageAdapter(RefPtr< pcl::PointCloud< PointT >> cloud)
Constructor.