Skip to content
Snippets Groups Projects
Commit c1dcc213 authored by Christoph Pohl's avatar Christoph Pohl
Browse files

Add enum value numbers to aron type in code generation

parent 8c3551c2
No related branches found
No related tags found
No related merge requests found
......@@ -103,8 +103,12 @@ namespace armarx::aron::codegenerator::cpp::generator
CppBlockPtr b = std::make_shared<CppBlock>();
b->addLine("//TODO: ");
b->addLine("std::map<std::string, int> " + INT_ENUM_VALUE_MAP + ";");
std::vector<std::string> map_initializer;
for (const auto& [key, value] : type.getAcceptedValueMap())
{
map_initializer.push_back("{\"" + key + "\", " + std::to_string(value) + "}");
}
b->addLine("std::map<std::string, int> " + INT_ENUM_VALUE_MAP + " = {" + simox::alg::to_string(map_initializer, ", ") + "};");
b->addLine("return " + ARON_WRITER_ACCESSOR + ".writeIntEnum(\"" + type.getEnumName() + "\", " +
INT_ENUM_VALUE_MAP + ", " +
ARON_MAYBE_TYPE_ACCESSOR + ", " +
......
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