Skip to content

vtkWrapRemoting: Improve Setter selection

This commit allows the vtkRemotingWrapper to generate code that can distiguish between signatures of setters with the same name and number of arguments based on the type of the arguments. If none of the signatures matches a parent class will eventually return false along with a warning.

Fixes #17 (closed)

Example of generated code:

if (method == "SetInputArrayToProcess" && args.size() == 5)
{
  vtkRLogF("vtkAlgorithm(%p)::SetInputArrayToProcess", object);
  if ( vtk::variant_is_compatible<int32_t>(args[0])  && 
       vtk::variant_is_compatible<int32_t>(args[1])  &&       
       vtk::variant_is_compatible<int32_t>(args[2])  &&       
       vtk::variant_is_compatible<int32_t>(args[3])  &&       
       vtk::variant_is_compatible<int32_t>(args[4]) )
  {
    auto temp9 = vtk::variant_cast<int32_t>(args[0]);
    auto value0 = static_cast<int>(temp9);
    auto temp10 = vtk::variant_cast<int32_t>(args[1]);
    auto value1 = static_cast<int>(temp10);
    auto temp11 = vtk::variant_cast<int32_t>(args[2]);
    auto value2 = static_cast<int>(temp11);
    auto temp12 = vtk::variant_cast<int32_t>(args[3]);
    auto value3 = static_cast<int>(temp12);
    auto temp13 = vtk::variant_cast<int32_t>(args[4]);
    auto value4 = static_cast<int>(temp13);
    target->SetInputArrayToProcess(value0, value1, value2, value3, value4);
    return true;
  }
}
 
if (method == "SetInputArrayToProcess" && args.size() == 5)
{
  vtkRLogF("vtkAlgorithm(%p)::SetInputArrayToProcess", object);
  if ( vtk::variant_is_compatible<int32_t>(args[0])  &&
       vtk::variant_is_compatible<int32_t>(args[1])  &&
       vtk::variant_is_compatible<int32_t>(args[2])  &&
       vtk::variant_is_compatible<std::string>(args[3])  &&
       vtk::variant_is_compatible<std::string>(args[4]) )
  {
    auto temp15 = vtk::variant_cast<int32_t>(args[0]);
    auto value0 = static_cast<int>(temp15);
    auto temp16 = vtk::variant_cast<int32_t>(args[1]);
    auto value1 = static_cast<int>(temp16);
    auto temp17 = vtk::variant_cast<int32_t>(args[2]);
    auto value2 = static_cast<int>(temp17);
    std::string temp18 = vtk::variant_cast<std::string>(args[3]);
    const char* value3 = temp18.c_str();
    std::string temp19 = vtk::variant_cast<std::string>(args[4]);
    const char* value4 = temp19.c_str();
    target->SetInputArrayToProcess(value0, value1, value2, value3, value4);
    return true;
  }
}

Merge request reports

Loading