27 #include <SimoxUtility/meta/type_name.h>
31 const std::map<type::pointcloud::VoxelType, std::tuple<std::string, int, std::string>>
34 {type::pointcloud::VoxelType::POINT_XYZ,
35 {
"pcl::PointXYZ", 16,
"::armarx::aron::type::pointcloud::VoxelType::POINT_XYZ"}},
36 {type::pointcloud::VoxelType::POINT_XYZI,
37 {
"pcl::PointXYZI", 32,
"::armarx::aron::type::pointcloud::VoxelType::POINT_XYZI"}},
38 {type::pointcloud::VoxelType::POINT_XYZL,
39 {
"pcl::PointXYZL", 32,
"::armarx::aron::type::pointcloud::VoxelType::POINT_XYZL"}},
40 {type::pointcloud::VoxelType::POINT_XYZRGB,
41 {
"pcl::PointXYZRGB", 32,
"::armarx::aron::type::pointcloud::VoxelType::POINT_XYZRGB"}},
42 {type::pointcloud::VoxelType::POINT_XYZRGBL,
45 "::armarx::aron::type::pointcloud::VoxelType::POINT_XYZRGBL"}},
46 {type::pointcloud::VoxelType::POINT_XYZRGBA,
49 "::armarx::aron::type::pointcloud::VoxelType::POINT_XYZRGBA"}},
50 {type::pointcloud::VoxelType::POINT_XYZHSV,
53 "::armarx::aron::type::pointcloud::VoxelType::POINT_XYZHSV"}}};
66 std::vector<std::string>
69 return {
"<pcl/point_cloud.h>",
"<pcl/point_types.h>"};
72 std::pair<std::vector<std::pair<std::string, std::string>>,
bool>
82 CppBlockPtr block_if_data = std::make_shared<CppBlock>();
84 "(" + cppAccessor +
nextEl() +
"width, " + cppAccessor +
nextEl() +
91 const std::string& cppAccessor,
93 std::string& variantAccessor)
const
104 "})); // of " + cppAccessor);
111 std::string& variantAccessor)
const
113 CppBlockPtr block_if_data = std::make_shared<CppBlock>();
117 block_if_data->addLine(
118 variantAccessor +
" = " +
ARON_WRITER_ACCESSOR +
".writeNDArray({ static_cast<int>(" + cppAccessor +
119 nextEl() +
"width), static_cast<int>(" + cppAccessor +
nextEl() +
"height), " +
122 "reinterpret_cast<const unsigned char*>(" + cppAccessor +
nextEl() +
124 simox::alg::join(p.
getPath(),
", ") +
"})); // of " + cppAccessor);
131 const std::string& variantAccessor)
const
133 CppBlockPtr block_if_data = std::make_shared<CppBlock>();
139 block_if_data->addLine(
"std::string " +
type +
";");
140 block_if_data->addLine(
"std::vector<int> " + dims +
";");
141 block_if_data->addLine(
"std::vector<unsigned char> " +
data +
";");
143 ", " + dims +
", " +
type +
", " +
data +
"); // of " + cppAccessor);
145 block_if_data->addLine(
146 "ARMARX_CHECK_AND_THROW(" + dims +
147 ".size() == 3, ::armarx::aron::error::AronException(__PRETTY_FUNCTION__, \"Received "
148 "wrong dimensions for member '" +
149 cppAccessor +
"'.\"));");
150 block_if_data->addLine(
"ARMARX_CHECK_AND_THROW(" +
type +
" == \"" +
152 "\", ::armarx::aron::error::AronException(__PRETTY_FUNCTION__, "
153 "\"Received wrong type for member '" +
154 cppAccessor +
"'.\"));");
158 block_if_data->addLine(cppAccessor +
nextEl() +
"clear();");
161 block_if_data->addLine(cppAccessor +
nextEl() +
"resize(" + dims +
"[0] * " + dims +
163 block_if_data->addLine(cppAccessor +
nextEl() +
"width = " + dims +
"[0];");
164 block_if_data->addLine(cppAccessor +
nextEl() +
"height = " + dims +
"[1];");
166 block_if_data->addLine(
"std::memcpy(reinterpret_cast<unsigned char*>(" + cppAccessor +
174 const std::string& otherInstanceAccessor)
const
176 CppBlockPtr block_if_data = std::make_shared<CppBlock>();
177 block_if_data->addLine(
"if (" + accessor +
nextEl() +
"width != " + otherInstanceAccessor +
179 "height != " + otherInstanceAccessor +
nextEl() +
"height)");
180 block_if_data->addLineAsBlock(
"return false;");