24 #ifndef __ASPECT_POINTCLOUD_POINTCLOUD_MANAGER_H_
25 #define __ASPECT_POINTCLOUD_POINTCLOUD_MANAGER_H_
27 #include <aspect/aspect.h>
28 #include <core/exception.h>
29 #include <core/utils/refptr.h>
30 #include <core/utils/lock_map.h>
31 #include <core/threading/mutex_locker.h>
32 #include <utils/time/time.h>
41 template <
typename Po
intT>
66 template <
typename Po
intT>
69 void remove_pointcloud(
const char *
id);
71 template <
typename Po
intT>
73 bool exists_pointcloud(
const char *
id);
79 template <
typename Po
intT>
80 bool exists_pointcloud(
const char *
id);
82 template <
typename Po
intT>
89 template <
typename Po
intT>
90 bool is_pointtype()
const;
92 template <
typename Po
intT>
95 virtual const char * get_typename() = 0;
97 virtual size_t point_size()
const = 0;
98 virtual unsigned int width()
const = 0;
99 virtual unsigned int height()
const = 0;
100 virtual size_t num_points()
const = 0;
101 virtual void * data_ptr()
const = 0;
105 template <
typename Po
intT>
128 virtual unsigned int width()
const {
return cloud->width; }
129 virtual unsigned int height()
const {
return cloud->height; }
130 virtual size_t num_points()
const {
return cloud->points.size(); }
131 virtual void *
data_ptr()
const {
return &cloud->points[0]; }
135 std::vector<std::string> get_pointcloud_list()
const;
137 const StorageAdapter * get_storage_adapter(
const char *
id);
144 template <
typename Po
intT>
146 PointCloudManager::StorageAdapter::is_pointtype()
const
154 template <
typename Po
intT>
156 PointCloudManager::StorageAdapter::as_pointtype()
161 throw Exception(
"PointCloud storage adapter is not of anticipated type");
166 template <
typename Po
intT>
168 PointCloudManager::add_pointcloud(
const char *
id,
173 if (__clouds.find(
id) == __clouds.end()) {
176 throw Exception(
"Cloud %s already registered");
180 template <
typename Po
intT>
182 PointCloudManager::get_pointcloud(
const char *
id)
186 if (__clouds.find(
id) != __clouds.end()) {
192 if (strcmp(__clouds[
id]->get_typename(),
198 throw Exception(
"The desired point cloud is of a different type");
202 throw Exception(
"No point cloud with ID '%s' registered",
id);
206 template <
typename Po
intT>
208 PointCloudManager::exists_pointcloud(
const char *
id)
219 template <
typename Po
intT>
227 template <
typename Po
intT>
232 time.
set_time(cloud->header.stamp.sec, cloud->header.stamp.nsec / 1000);
virtual size_t point_size() const
Get size of a point.
virtual unsigned int height() const
Get height of point cloud.
virtual size_t num_points() const
Get numer of points in point cloud.
uint64_t sec
seconds part of time
Fawkes library namespace.
long get_usec() const
Get microseconds.
A class for handling time.
Adapter class for PCL point types.
virtual unsigned int width() const
Get width of point cloud.
PointCloudStorageAdapter(RefPtr< pcl::PointCloud< PointT > > cloud)
Constructor.
struct fawkes::PointCloudTimestamp::@0 time
Access timestamp as time.
Base class for exceptions in Fawkes.
Union to pack fawkes::Time into the pcl::PointCloud timestamp.
const RefPtr< pcl::PointCloud< PointT > > cloud
The point cloud.
virtual void * data_ptr() const
Get pointer on data.
RefPtr<> is a reference-counting shared smartpointer.
void set_time(const timeval *tv)
Sets the time.
uint64_t timestamp
Access timestamp as number only.
virtual const char * get_typename()
Get typename of storage adapter.
PointCloudStorageAdapter(const PointCloudStorageAdapter< PointT > *p)
Copy constructor.