Fawkes API  Fawkes Development Version
pcl_adapter.h
1 
2 /***************************************************************************
3  * pcl_adapter.h - Thread to exchange point clouds
4  *
5  * Created: Tue Nov 08 00:36:10 2011
6  * Copyright 2011-2014 Tim Niemueller [www.niemueller.de]
7  * 2012 Bastian Klingen
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU Library General Public License for more details.
19  *
20  * Read the full text in the LICENSE.GPL file in the doc directory.
21  */
22 
23 #ifndef __LIBS_PCL_UTILS_PCL_ADAPTER_H_
24 #define __LIBS_PCL_UTILS_PCL_ADAPTER_H_
25 
26 #include <utils/time/time.h>
27 
28 #include <map>
29 #include <vector>
30 #include <string>
31 #include <stdint.h>
32 
33 namespace fawkes {
34  class PointCloudManager;
35  class Logger;
36 }
37 
39 {
40  public:
41  /** Information about the data fields. */
43  public:
44  std::string name; ///< Name of field
45  uint32_t offset; ///< Offset from start of point struct
46  uint8_t datatype; ///< Datatype enumeration see above
47  uint32_t count; ///< How many elements in field
48 
49  /** Constructor for pre-allocation. */
51  /** Constructor.
52  * @param name field name
53  * @param offset data offset
54  * @param datatype data type ID, see sensor_msgs::PointField
55  * @param count number of data entries
56  */
57  PointFieldInfo(std::string name, uint32_t offset,
58  uint8_t datatype, uint32_t count)
59  : name(name), offset(offset), datatype(datatype), count(count) {}
60  };
61  /** Vector of PointFieldInfo. */
62  typedef std::vector<PointFieldInfo> V_PointFieldInfo;
63 
65  fawkes::Logger *logger);
67 
68  void get_info(const std::string &id,
69  unsigned int &width, unsigned int &height,
70  std::string &frame_id, bool &is_dense,
71  V_PointFieldInfo &pfi);
72 
73  void get_data(const std::string &id, std::string &frame_id,
74  unsigned int &width, unsigned int &height, fawkes::Time &time,
75  void **data_ptr, size_t &point_size, size_t &num_points);
76 
77  void get_data_and_info(const std::string &id, std::string &frame_id, bool &is_dense,
78  unsigned int &width, unsigned int &height, fawkes::Time &time,
79  V_PointFieldInfo &pfi, void **data_ptr, size_t &point_size, size_t &num_points);
80 
81  void close(const std::string &id);
82 
83  private:
84  fawkes::PointCloudManager *__pcl_manager;
85 
86  class StorageAdapter;
87  std::map<std::string, StorageAdapter *> __sas;
88 };
89 
90 
91 #endif
std::vector< PointFieldInfo > V_PointFieldInfo
Vector of PointFieldInfo.
Definition: pcl_adapter.h:62
uint8_t datatype
Datatype enumeration see above.
Definition: pcl_adapter.h:46
PointFieldInfo(std::string name, uint32_t offset, uint8_t datatype, uint32_t count)
Constructor.
Definition: pcl_adapter.h:57
PointFieldInfo()
Constructor for pre-allocation.
Definition: pcl_adapter.h:50
Fawkes library namespace.
Information about the data fields.
Definition: pcl_adapter.h:42
A class for handling time.
Definition: time.h:91
uint32_t offset
Offset from start of point struct.
Definition: pcl_adapter.h:45
Point Cloud manager.
std::string name
Name of field.
Definition: pcl_adapter.h:44
Point cloud adapter class.
Definition: pcl_adapter.h:38
uint32_t count
How many elements in field.
Definition: pcl_adapter.h:47
Interface for logging.
Definition: logger.h:34