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>
88 if (
type.getDefaultValue() == aron::type::pointcloud::default_value::DEFAULT ||
89 type.getDefaultValue() == aron::type::pointcloud::default_value::ZEROS)
91 std::cerr <<
"Currently ARON does not support default values for pointclouds. Ignoring "
94 else if (
type.getDefaultValue() == aron::type::pointcloud::default_value::ONES)
96 std::cerr <<
"Currently ARON does not support default values for pointclouds. Ignoring "
100 if (
type.getMaybe() == type::Maybe::OPTIONAL)
102 return {{{name,
"std::nullopt"}},
true};
110 CppBlockPtr block_if_data = std::make_shared<CppBlock>();
112 "(" + cppAccessor +
nextEl() +
"width, " + cppAccessor +
nextEl() +
119 const std::string& cppAccessor,
121 std::string& variantAccessor)
const
129 type.getDefaultValue() +
"\", " +
132 "})); // of " + cppAccessor);
139 std::string& variantAccessor)
const
141 CppBlockPtr block_if_data = std::make_shared<CppBlock>();
145 block_if_data->addLine(
147 cppAccessor +
nextEl() +
"width), static_cast<int>(" + cppAccessor +
nextEl() +
148 "height), " + std::to_string(std::get<1>(
VoxelType2Cpp.at(
type.getVoxelType()))) +
150 "reinterpret_cast<const unsigned char*>(" + cppAccessor +
nextEl() +
152 simox::alg::join(p.
getPath(),
", ") +
"})); // of " + cppAccessor);
159 const std::string& variantAccessor)
const
161 CppBlockPtr block_if_data = std::make_shared<CppBlock>();
167 block_if_data->addLine(
"std::string " +
type +
";");
168 block_if_data->addLine(
"std::vector<int> " + dims +
";");
169 block_if_data->addLine(
"std::vector<unsigned char> " +
data +
";");
171 ", " + dims +
", " +
type +
", " +
data +
"); // of " + cppAccessor);
173 block_if_data->addLine(
174 "ARMARX_CHECK_AND_THROW(" + dims +
175 ".size() == 3, ::armarx::aron::error::AronException(__PRETTY_FUNCTION__, \"Received "
176 "wrong dimensions for member '" +
177 cppAccessor +
"'.\"));");
178 block_if_data->addLine(
"ARMARX_CHECK_AND_THROW(" +
type +
" == \"" +
180 "\", ::armarx::aron::error::AronException(__PRETTY_FUNCTION__, "
181 "\"Received wrong type for member '" +
182 cppAccessor +
"'.\"));");
186 block_if_data->addLine(cppAccessor +
nextEl() +
"clear();");
189 block_if_data->addLine(cppAccessor +
nextEl() +
"resize(" + dims +
"[0] * " + dims +
191 block_if_data->addLine(cppAccessor +
nextEl() +
"width = " + dims +
"[0];");
192 block_if_data->addLine(cppAccessor +
nextEl() +
"height = " + dims +
"[1];");
194 block_if_data->addLine(
"std::memcpy(reinterpret_cast<unsigned char*>(" + cppAccessor +
202 const std::string& otherInstanceAccessor)
const
204 CppBlockPtr block_if_data = std::make_shared<CppBlock>();
205 block_if_data->addLine(
"if (" + accessor +
nextEl() +
"width != " + otherInstanceAccessor +
207 "height != " + otherInstanceAccessor +
nextEl() +
"height)");
208 block_if_data->addLineAsBlock(
"return false;");
std::vector< std::string > getPath() const
CppBlockPtr resolveMaybeEqualsBlock(const CppBlockPtr &, const std::string &, const std::string &) const
CppBlockPtr resolveMaybeReadBlock(const CppBlockPtr &, const std::string &, const std::string &) const
static std::string EscapeAccessor(const std::string &)
std::string getFullInstantiatedCppTypenameGenerator() const
CppBlockPtr resolveMaybeResetSoftBlock(const CppBlockPtr &, const std::string &) const
std::string nextEl() const
static const std::string ARON_READER_ACCESSOR
static const std::string ARON_PATH_ACCESSOR
static const std::string ARON_WRITER_ACCESSOR
static const std::string ARON_VARIANT_RETURN_ACCESSOR
CppBlockPtr resolveMaybeWriteBlock(const CppBlockPtr &, const std::string &) const
PointCloud(const type::PointCloud &)
CppBlockPtr getReadBlock(const std::string &cppAccessor, const std::string &variantAccessor) const final
std::vector< std::string > getRequiredIncludes() const final
CppBlockPtr getEqualsBlock(const std::string &cppAccessor, const std::string &) const final
CppBlockPtr getWriteTypeBlock(const std::string &typeAccessor, const std::string &cppAccessor, const Path &, std::string &variantAccessor) const final
std::pair< std::vector< std::pair< std::string, std::string > >, bool > getCtorInitializers(const std::string &) const final
CppBlockPtr getWriteBlock(const std::string &cppAccessor, const Path &, std::string &variantAccessor) const final
CppBlockPtr getResetSoftBlock(const std::string &cppAccessor) const final
const std::map< type::Maybe, std::string > Maybe2CppString
const std::map< type::pointcloud::VoxelType, std::tuple< std::string, int, std::string > > VoxelType2Cpp
A convenience header to include all aron files (full include, not forward declared)
std::shared_ptr< CppBlock > CppBlockPtr