Skip to content

Commit 92ed90e

Browse files
author
Janosch Machowinski
committed
implemented configuration of container types.
1 parent 20c4abe commit 92ed90e

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

src/ConfigurationHelper.cpp

+23-1
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,29 @@ bool applyConfOnTyplibValue(Typelib::Value &value, const ConfigValue& conf)
606606
}
607607
else
608608
{
609-
std::cout << "Warning, container is not supported " << value.getType().getName() << std::endl;
609+
if(conf.type != ConfigValue::ARRAY)
610+
{
611+
std::cout << "Error, YAML representation << " << conf.name << " of type " << value.getType().getName() << " is not an array " << std::endl;
612+
std::cout << "Error, got container in property, but config value is not an array " << std::endl;
613+
return false;
614+
}
615+
const ArrayConfigValue &array = dynamic_cast<const ArrayConfigValue &>(conf);
616+
617+
const Typelib::Type &indirect = cont.getIndirection();
618+
cont.init(value.getData());
619+
620+
std::vector<ConfigValue *>::const_iterator it = array.values.begin();
621+
622+
for(; it != array.values.end(); it++)
623+
{
624+
625+
//TODO check, this may be a memory leak
626+
Typelib::Value v(new uint8_t[indirect.getSize()], indirect);
627+
628+
applyConfOnTyplibValue(v, *(*it));
629+
630+
cont.push(value.getData(), v);
631+
}
610632
}
611633
}
612634
break;

0 commit comments

Comments
 (0)