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

instead of return statements in cases, setting local variable to avoid...

instead of return statements in cases, setting local variable to avoid compiler errors when default case is missing (although default will never be reached!)
parent af616bbc
No related branches found
No related tags found
No related merge requests found
......@@ -30,17 +30,22 @@ namespace armarx::objpose
{
using AronObjectType = aron::ObjectTypes::__ImplEnum;
ObjectTypeEnum e{};
switch (objectType.value)
{
case AronObjectType::ANY_OBJECT:
return ObjectTypeEnum::AnyObject;
e = ObjectTypeEnum::AnyObject;
break;
case AronObjectType::KNOWN_OBJECT:
return ObjectTypeEnum::KnownObject;
e = ObjectTypeEnum::KnownObject;
break;
case AronObjectType::UNKNOWN_OBJECT:
return ObjectTypeEnum::UnknownObject;
default:
throw std::invalid_argument("Invalid aron::ObjectTypes value: " + std::to_string(objectType));
e = ObjectTypeEnum::UnknownObject;
break;
}
return e;
}
simox::OrientedBoxf fromAron(const aron::OrientedBoundingBox& obb)
......@@ -97,18 +102,22 @@ namespace armarx::objpose
aron::ObjectTypes toAron(const ObjectTypeEnum& objectType)
{
aron::ObjectTypes ot{};
switch (objectType)
{
case ObjectTypeEnum::AnyObject:
return aron::ObjectTypes::ANY_OBJECT;
ot = aron::ObjectTypes::ANY_OBJECT;
break;
case ObjectTypeEnum::KnownObject:
return aron::ObjectTypes::KNOWN_OBJECT;
ot = aron::ObjectTypes::KNOWN_OBJECT;
break;
case ObjectTypeEnum::UnknownObject:
return aron::ObjectTypes::UNKNOWN_OBJECT;
default:
// TODO(fabian.reister): do it the ARMARX way ...
throw std::invalid_argument("Invalid ObjectTypeEnum value: " + std::to_string(objectType));
ot = aron::ObjectTypes::UNKNOWN_OBJECT;
break;
}
return ot;
}
aron::ObjectAttachmentInfo toAron(const ObjectAttachmentInfo& info)
......
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