Skip to content

Commit

Permalink
remoce stupid code
Browse files Browse the repository at this point in the history
  • Loading branch information
171930433 committed Mar 9, 2024
1 parent 685f5e3 commit 7348722
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/struct_pb/protoc-plugin/example/zpointcloud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ ::inner_class::ZPointCloudXYZIT StructToClass(inner_struct::sp_cZPointCloudXYZIT
// ClassToStruct declaration
inner_struct::spZPointCloudXYZIT ClassToStruct(::inner_class::ZPointCloudXYZIT const& in) {
::inner_struct::spZPointCloudXYZIT result = std::make_shared<inner_struct::ZPointCloudXYZIT>();
pcl::PointCloud<pcl::PointXYZIT>::Ptr pc_result = result; // stupid code , need solve
*(std::shared_ptr<::inner_struct::ZFrame>)result = ClassToStruct(in.header());
// 解压点云
std::stringstream compressed_pcl_pointcloud(in.pcl_compressed_pc());
s_compress.decodePointCloud(compressed_pcl_pointcloud, pc_result);
// decodePointCloud 的参数定义成了智能指针的引用, 所以不能存在转换. 只有是 const T& 和 std::shared_ptr<T>, 可以使用多态,即直接使用子类对象或者子类智能指针
s_compress.decodePointCloud(compressed_pcl_pointcloud, (pcl::PointCloud<pcl::PointXYZIT>::Ptr&)result);

return result;
}
Expand Down
7 changes: 6 additions & 1 deletion src/struct_pb/protoc-plugin/example/zpointcloud.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@

namespace inner_struct {

// template <typename _PointType>
// struct ZPointCloud : public ZFrame, public pcl::PointCloud<_PointType> {

// };

template <typename _PointType>
struct ZPointCloud : public ZFrame, public pcl::PointCloud<_PointType> {
struct ZPointCloud : public pcl::PointCloud<_PointType>, public ZFrame {

};

Expand Down

0 comments on commit 7348722

Please sign in to comment.