Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • sw/armarx/robot-api
  • uwkce_singer/robot-api
  • untcg_hofmann/robot-api
  • ulqba_korosakov/RobotAPI
4 results
Show changes
Commits on Source (3)
......@@ -31,6 +31,7 @@ namespace armarx::aron::codegenerator::cpp::generator
{
const std::map<type::matrix::ElementType, std::tuple<std::string, int, std::string>> ElementType2Cpp =
{
// TODO: rename to float32 etc. but keep backward compability
{type::matrix::INT16, {"short", 2, "::armarx::aron::type::matrix::INT16"}},
{type::matrix::INT32, {"int", 4, "::armarx::aron::type::matrix::INT32"}},
{type::matrix::INT64, {"long", 8, "::armarx::aron::type::matrix::INT64"}},
......
......@@ -102,7 +102,19 @@ namespace armarx::aron::codegenerator::cpp::generator
block_if_data->addLine("std::vector<int> " + dims + ";");
block_if_data->addLine("std::vector<unsigned char> " + data + ";");
block_if_data->addLine("" + ARON_READER_ACCESSOR + ".readNDArray("+variantAccessor+", "+dims+", "+type+", "+data+"); // of " + cppAccessor);
block_if_data->addLine(cppAccessor + " = " + getInstantiatedCppTypename() + "(" + dims + "[0], " + dims + "[1]);");
block_if_data->addLine("ARMARX_CHECK_AND_THROW(" + dims + ".size() == 3, ::armarx::aron::error::AronException(__PRETTY_FUNCTION__, \"Received wrong dimensions for member '"+cppAccessor+"'.\"));");
block_if_data->addLine("ARMARX_CHECK_AND_THROW(" + type + " == \"" + std::get<0>(VoxelType2Cpp.at(this->type.getVoxelType())) + "\", ::armarx::aron::error::AronException(__PRETTY_FUNCTION__, \"Received wrong type for member '"+cppAccessor+"'.\"));");
// assign is not availablePCL for PCL 1.8
// block_if_data->addLine(cppAccessor + nextEl() + "assign(" + dims + "[0], " + dims + "[1], " + std::get<0>(VoxelType2Cpp.at(this->type.getVoxelType())) + "());");
block_if_data->addLine(cppAccessor + nextEl() + "clear();");
// resize(width, height , value) is not available either
// block_if_data->addLine(cppAccessor + nextEl() + "resize(" + dims + "[0], " + dims + "[1], " + std::get<0>(VoxelType2Cpp.at(this->type.getVoxelType())) + "()));");
block_if_data->addLine(cppAccessor + nextEl() + "resize(" + dims + "[0] * " + dims + "[1]);");
block_if_data->addLine(cppAccessor + nextEl() + "width = " + dims + "[0];");
block_if_data->addLine(cppAccessor + nextEl() + "height = " + dims + "[1];");
block_if_data->addLine("std::memcpy(reinterpret_cast<unsigned char*>(" + cppAccessor + nextEl() + "points.data()), "+data+".data(), "+data+".size());");
return resolveMaybeReadBlock(block_if_data, cppAccessor, variantAccessor);
}
......