From 1f1737280980dd67e2bc754688aedbb9ab9fc7c3 Mon Sep 17 00:00:00 2001 From: Fabian Peller-Konrad <fabian.peller-konrad@kit.edu> Date: Thu, 21 Dec 2023 10:42:45 +0100 Subject: [PATCH] fix missing type --- .../codewriter/cpp/generator/ndarray/Matrix.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source/RobotAPI/libraries/aron/codegeneration/codegenerator/codewriter/cpp/generator/ndarray/Matrix.cpp b/source/RobotAPI/libraries/aron/codegeneration/codegenerator/codewriter/cpp/generator/ndarray/Matrix.cpp index 0cacba084..d8f53d388 100644 --- a/source/RobotAPI/libraries/aron/codegeneration/codegenerator/codewriter/cpp/generator/ndarray/Matrix.cpp +++ b/source/RobotAPI/libraries/aron/codegeneration/codegenerator/codewriter/cpp/generator/ndarray/Matrix.cpp @@ -73,11 +73,11 @@ namespace armarx::aron::codegenerator::cpp::generator { return {{{name, getInstantiatedCppTypename() + "::Identity()"}}, true}; } - if (type.getDefaultValue() == aron::type::matrix::default_value::DEFAULT || type.getDefaultValue() == aron::type::matrix::default_value::ZEROS) + else if (type.getDefaultValue() == aron::type::matrix::default_value::DEFAULT || type.getDefaultValue() == aron::type::matrix::default_value::ZEROS) { return {{{name, getInstantiatedCppTypename() + "::Zero()"}}, true}; } - if (type.getDefaultValue() == aron::type::matrix::default_value::ONES) + else if (type.getDefaultValue() == aron::type::matrix::default_value::ONES) { return {{{name, getInstantiatedCppTypename() + "::One()"}}, true}; } @@ -98,18 +98,18 @@ namespace armarx::aron::codegenerator::cpp::generator { block_if_data->addLine(cppAccessor + " = " + getInstantiatedCppTypename() + "::Identity();"); } - if (type.getDefaultValue() == aron::type::matrix::default_value::DEFAULT || type.getDefaultValue() == aron::type::matrix::default_value::ZEROS) + else if (type.getDefaultValue().empty() || type.getDefaultValue() == aron::type::matrix::default_value::DEFAULT || type.getDefaultValue() == aron::type::matrix::default_value::ZEROS) { block_if_data->addLine(cppAccessor + " = " + getInstantiatedCppTypename() + "::Zero();"); } - if (type.getDefaultValue() == aron::type::matrix::default_value::ONES) + else if (type.getDefaultValue() == aron::type::matrix::default_value::ONES) { block_if_data->addLine(cppAccessor + " = " + getInstantiatedCppTypename() + "::One();"); } - else + else if (not type.getDefaultValue().empty()) { // try to parse num. We ensure from typereader that defaultValue is valid number - block_if_data->addLine(cppAccessor + " = " + "::One() * " + type.getDefaultValue() + ";"); + block_if_data->addLine(cppAccessor + " = " + getInstantiatedCppTypename() + "::One() * " + type.getDefaultValue() + ";"); } return resolveMaybeResetHardBlock(block_if_data, cppAccessor); } -- GitLab