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

handle optional subtypes in fullfillsType

parent f1cf8d33
No related branches found
No related tags found
No related merge requests found
......@@ -25,10 +25,12 @@
#include "Dict.h"
// ArmarX
#include <RobotAPI/libraries/aron/core/data/variant/Factory.h>
#include <SimoxUtility/algorithm/string/string_conversion.h>
#include <ArmarXCore/util/CPPUtility/trace.h>
#include <RobotAPI/libraries/aron/core/data/variant/Factory.h>
namespace armarx::aron::data
{
......@@ -216,19 +218,35 @@ namespace armarx::aron::data
{
case type::Descriptor::OBJECT:
{
ARMARX_TRACE;
auto objectTypeNav = type::Object::DynamicCastAndCheck(type);
for (const auto& [key, nav] : childrenNavigators)
{
if (!objectTypeNav->hasMemberType(key))
{
ARMARX_TRACE;
return false;
}
if (!nav || !objectTypeNav->getMemberType(key))
if (!objectTypeNav->getMemberType(key))
{
ARMARX_TRACE;
return false;
}
if (!nav)
{
ARMARX_TRACE;
auto childTypeNav = objectTypeNav->getMemberType(key);
if (childTypeNav->getMaybe() == type::Maybe::NONE)
{
ARMARX_TRACE;
return false;
}
return true;
}
if (!nav->fullfillsType(objectTypeNav->getMemberType(key)))
{
ARMARX_TRACE;
return false;
}
}
......@@ -236,16 +254,19 @@ namespace armarx::aron::data
}
case type::Descriptor::DICT:
{
ARMARX_TRACE;
auto dictTypeNav = type::Dict::DynamicCastAndCheck(type);
for (const auto& [key, nav] : childrenNavigators)
{
(void) key;
if (!nav || !dictTypeNav->getAcceptedType())
{
ARMARX_TRACE;
return false;
}
if (!nav->fullfillsType(dictTypeNav->getAcceptedType()))
{
ARMARX_TRACE;
return false;
}
}
......
......@@ -26,10 +26,12 @@
// ArmarX
#include <ArmarXCore/core/exceptions/Exception.h>
#include <ArmarXCore/util/CPPUtility/trace.h>
#include <RobotAPI/libraries/aron/core/data/variant/Factory.h>
#include <RobotAPI/libraries/aron/core/type/variant/container/List.h>
#include <RobotAPI/libraries/aron/core/type/variant/container/Tuple.h>
#include <RobotAPI/libraries/aron/core/type/variant/container/Pair.h>
#include <RobotAPI/libraries/aron/core/type/variant/container/Tuple.h>
namespace armarx::aron::data
{
......@@ -218,15 +220,18 @@ namespace armarx::aron::data
{
case type::Descriptor::LIST:
{
ARMARX_TRACE;
auto listTypeNav = type::List::DynamicCastAndCheck(type);
for (const auto& nav : childrenNavigators)
{
if (!nav && !listTypeNav->getAcceptedType())
{
ARMARX_TRACE;
return false;
}
if (!nav->fullfillsType(listTypeNav->getAcceptedType()))
{
ARMARX_TRACE;
return false;
}
}
......
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