Skip to content
Snippets Groups Projects
Commit 31b05951 authored by Fabian Reister's avatar Fabian Reister
Browse files

using ARMARX_CHECK

parent aa745c42
No related branches found
No related tags found
1 merge request!315Fix/read variable size matrices and optionals
......@@ -119,7 +119,7 @@ namespace armarx::aron::codegenerator::cpp::generator
block_if_data->addLine(cppAccessor + nextEl() + "resize(" + dims + ".at(0), " + dims + ".at(1));");
}
block_if_data->addLine("assert(" + cppAccessor + nextEl() + "rows() == " + dims + ".at(0) && " + cppAccessor + nextEl() + "cols() == " + dims + ".at(1) && \"Dimensions of member '"+cppAccessor+"' do not match (simox::alg::to_string(dims, ',')). Got (" + cppAccessor + nextEl() + "rows(), " + cppAccessor + nextEl() + "cols()) instead.\");");
block_if_data->addLine("ARMARX_CHECK(" + cppAccessor + nextEl() + "rows() == " + dims + ".at(0) and " + cppAccessor + nextEl() + "cols() == " + dims + ".at(1)) << \"Dimensions of member '"+cppAccessor+"' do not match (simox::alg::to_string(dims, ',')). Got (" + cppAccessor + nextEl() + "rows(), " + cppAccessor + nextEl() + "cols()) instead.\";");
block_if_data->addLine("std::memcpy(reinterpret_cast<unsigned char*>(" + cppAccessor + nextEl() + "data()), "+data+".data(), "+data+".size());");
return resolveMaybeReadBlock(block_if_data, cppAccessor, variantAccessor);
}
......
......@@ -215,7 +215,7 @@ namespace armarx::aron::codegenerator::cpp::generator
const auto child_s = FromAronType(*child);
std::string child_accessor = OBJECT_MEMBERS_ACCESSOR + "_" + key + "_iterator";
block_if_data->addLine("auto " + child_accessor + " = " + OBJECT_MEMBERS_ACCESSOR + ".find(\"" + key + "\");");
block_if_data->addLine("assert(" + child_accessor + " != " + OBJECT_MEMBERS_ACCESSOR + ".end() && \"Missing member '" + key + "' in aron object '" + getFullClassCppTypename() + "'.\");");
block_if_data->addLine("ARMARX_CHECK(" + child_accessor + " != " + OBJECT_MEMBERS_ACCESSOR + ".end()) << \"Missing member '" + key + "' in aron object '" + getFullClassCppTypename() + "'.\";");
block_if_data->appendBlock(child_s->getReadBlock(key, child_accessor + "->second"));
}
return block_if_data;
......@@ -239,4 +239,3 @@ namespace armarx::aron::codegenerator::cpp::generator
return block_if_data;
}
}
......@@ -28,9 +28,10 @@
#include <string>
#include <vector>
#include <map>
#include <cassert>
// ArmarX
#include <ArmarXCore/core/exceptions/local/ExpressionException.h>
#include <RobotAPI/libraries/aron/core/Exception.h>
#include <RobotAPI/libraries/aron/core/data/variant/All.h>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment