Esempio n. 1
0
/* This sets the NewInstance hint for generator methods. */
void vtkWrap_FindNewInstanceMethods(
  ClassInfo *data, HierarchyInfo *hinfo)
{
  int i;
  FunctionInfo *theFunc;

  for (i = 0; i < data->NumberOfFunctions; i++)
    {
    theFunc = data->Functions[i];
    if (theFunc->Name && theFunc->ReturnValue &&
        vtkWrap_IsVTKObject(theFunc->ReturnValue) &&
        vtkWrap_IsVTKObjectBaseType(hinfo, theFunc->ReturnValue->Class))
      {
      if (strcmp(theFunc->Name, "NewInstance") == 0 ||
          strcmp(theFunc->Name, "CreateInstance") == 0 ||
          (strcmp(theFunc->Name, "CreateImageReader2") == 0 &&
           strcmp(data->Name, "vtkImageReader2Factory") == 0) ||
          (strcmp(theFunc->Name, "CreateDataArray") == 0 &&
           strcmp(data->Name, "vtkDataArray") == 0) ||
          (strcmp(theFunc->Name, "CreateArray") == 0 &&
           strcmp(data->Name, "vtkAbstractArray") == 0) ||
          (strcmp(theFunc->Name, "CreateArray") == 0 &&
           strcmp(data->Name, "vtkArray") == 0) ||
          (strcmp(theFunc->Name, "GetQueryInstance") == 0 &&
           strcmp(data->Name, "vtkSQLDatabase") == 0) ||
          (strcmp(theFunc->Name, "CreateFromURL") == 0 &&
           strcmp(data->Name, "vtkSQLDatabase") == 0) ||
          (strcmp(theFunc->Name, "MakeTransform") == 0 &&
           vtkWrap_IsTypeOf(hinfo, data->Name, "vtkAbstractTransform")))
        {
        theFunc->ReturnValue->Type |= VTK_PARSE_NEWINSTANCE;
        }
      }
    }
}
Esempio n. 2
0
/* get the true superclass */
const char *vtkWrapPython_GetSuperClass(
    ClassInfo *data, HierarchyInfo *hinfo)
{
    int i;
    const char *supername = NULL;
    const char *name;
    const char **args;
    const char *defaults[2] = { NULL, NULL };
    char *cp;

    for (i = 0; i < data->NumberOfSuperClasses; i++)
    {
        supername = data->SuperClasses[i];

        if (strncmp(supername, "vtkTypeTemplate<", 16) == 0)
        {
            vtkParse_DecomposeTemplatedType(supername, &name, 2, &args, defaults);
            cp = (char *)malloc(strlen(args[1])+1);
            strcpy(cp, args[1]);
            vtkParse_FreeTemplateDecomposition(name, 2, args);
            supername = cp;
        }

        /* Add QVTKInteractor as the sole exception: It is derived
         * from vtkObject but does not start with "vtk".  Given its
         * name, it would be expected to be derived from QObject. */
        if (vtkWrap_IsVTKObjectBaseType(hinfo, data->Name) ||
                strcmp(data->Name, "QVTKInteractor") == 0)
        {
            if (vtkWrap_IsClassWrapped(hinfo, supername) &&
                    vtkWrap_IsVTKObjectBaseType(hinfo, supername))
            {
                return supername;
            }
        }
        else if (vtkWrapPython_HasWrappedSuperClass(hinfo, data->Name, NULL))
        {
            return supername;
        }
    }

    return NULL;
}