Skip to content
Snippets Groups Projects
Commit 956d8935 authored by Jan Trávníček's avatar Jan Trávníček
Browse files

allow to unpack set of Objects by explicit cast

parent 9e8c8e56
No related branches found
No related tags found
1 merge request!60Dev
Pipeline #28825 passed
......@@ -17,6 +17,14 @@
namespace {
 
class PrimitiveRegistrator {
static const ext::set < object::Object > & denormalizeSetObject ( const object::Object & o ) {
const object::AnyObjectBase & data = o.getData ( );
const object::AnyObject < ext::set < object::Object > > * innerData = dynamic_cast < const object::AnyObject < ext::set < object::Object > > * > ( & data );
if ( innerData )
return innerData->getData ( );
throw std::invalid_argument ( "Casted object does not contain data of type " + ext::to_string < ext::set < object::Object > > ( ) + "." );
}
public:
PrimitiveRegistrator ( ) {
abstraction::CastRegistry::registerCast < double, int > ( );
......@@ -37,6 +45,8 @@ public:
 
abstraction::CastRegistry::registerCast < long, int > ( "long", ext::to_string < int > ( ) );
 
abstraction::CastRegistry::registerCastAlgorithm < const ext::set < object::Object > &, const object::Object & > ( "SetOfObjects", ext::to_string < object::Object > ( ), denormalizeSetObject, true );
abstraction::ContainerRegistry::registerSet < int > ( );
 
abstraction::ValuePrinterRegistry::registerValuePrinter < int > ( );
......
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