21 TClass* clptr =
nullptr;
22 EDataType datatype = kNoType_t;
23 b->GetExpectedType( clptr, datatype );
33 std::ostringstream code;
34 code <<
"static_cast<DataObject*(*)(void*)>([] (void* store) -> DataObject* {";
37 code <<
"auto ptr = reinterpret_cast<" << clptr->GetName() <<
"*>(store);";
38 if ( clptr->InheritsFrom( TClass::GetClass<DataObject>() ) ) {
40 code <<
"return ptr;";
43 code <<
"return new AnyDataWrapper(std::move(*ptr));";
50 code << TDataType::GetTypeName( datatype ) <<
" value;";
51 code <<
"std::memcpy(&value, &store, sizeof(value));";
52 code <<
"return new AnyDataWrapper(std::move(value));";
55 gInterpreter->Declare(
"#include <cstring>\n#include <functional>\n#include <GaudiKernel/AnyDataWrapper.h>\n" );
56 auto val = gInterpreter->MakeInterpreterValue();
57 if ( gInterpreter->Evaluate( code.str().c_str(), *val ) == 0 ) {
58 throw std::runtime_error(
"Failed to compile code" );