Commit 348265e0 authored by David Gobbi's avatar David Gobbi Committed by Kitware Robot

Merge topic 'wrapper-using-declarations'

df0ebf0b Apply using declarations that hadn't been "used".
88693d29 Allow wrappers to properly support "using" methods.
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !65
parents 9a5b182e df0ebf0b
......@@ -58,47 +58,11 @@ public:
int GetNumberOfCellsPerBucket()
{ return this->NumberOfCellsPerNode; }
//BTX
/*
if the borland compiler is ever removed, we can use these declarations
instead of reimplementaing the calls in this subclass
// Re-use any superclass signatures that we don't override.
using vtkAbstractCellLocator::IntersectWithLine;
using vtkAbstractCellLocator::FindCell;
using vtkAbstractCellLocator::FindClosestPoint;
using vtkAbstractCellLocator::FindClosestPointWithinRadius;
*/
//ETX
// Description:
// reimplemented from vtkAbstractCellLocator to support bad compilers
virtual int IntersectWithLine(
double a0[3], double a1[3], double tol,
double& t, double x[3], double pcoords[3],
int &subId)
{
return Superclass::
IntersectWithLine(a0, a1, tol,t, x, pcoords, subId);
}
// Description:
// reimplemented from vtkAbstractCellLocator to support bad compilers
virtual int IntersectWithLine(
double a0[3], double a1[3], double tol,
double& t, double x[3], double pcoords[3],
int &subId, vtkIdType &cellId)
{
return Superclass::
IntersectWithLine(a0, a1, tol,t, x, pcoords, subId, cellId);
}
// Description:
// reimplemented from vtkAbstractCellLocator to support bad compilers
virtual int IntersectWithLine(
const double a0[3], const double a1[3],
vtkPoints *points, vtkIdList *cellIds)
{
return Superclass::
IntersectWithLine(a0, a1, points, cellIds);
}
// Description:
// Return intersection point (if any) AND the cell which was intersected by
......@@ -109,16 +73,6 @@ public:
int &subId, vtkIdType &cellId,
vtkGenericCell *cell);
// Description:
// reimplemented from vtkAbstractCellLocator to support bad compilers
virtual void FindClosestPoint(
double x[3], double closestPoint[3],
vtkIdType &cellId, int &subId, double& dist2)
{
Superclass::
FindClosestPoint(x, closestPoint, cellId, subId, dist2);
}
// Description:
// Return the closest point and the cell which is closest to the point x.
// The closest point is somewhere on a cell, it need not be one of the
......@@ -134,29 +88,6 @@ public:
vtkGenericCell *cell, vtkIdType &cellId,
int &subId, double& dist2);
// Description:
// reimplemented from vtkAbstractCellLocator to support bad compilers
virtual vtkIdType FindClosestPointWithinRadius(
double x[3], double radius,
double closestPoint[3], vtkIdType &cellId,
int &subId, double& dist2)
{
return Superclass::FindClosestPointWithinRadius
(x, radius, closestPoint, cellId, subId, dist2);
}
// Description:
// reimplemented from vtkAbstractCellLocator to support bad compilers
virtual vtkIdType FindClosestPointWithinRadius(
double x[3], double radius,
double closestPoint[3],
vtkGenericCell *cell, vtkIdType &cellId,
int &subId, double& dist2)
{
return Superclass::FindClosestPointWithinRadius
(x, radius, closestPoint, cell, cellId, subId, dist2);
}
// Description:
// Return the closest point within a specified radius and the cell which is
// closest to the point x. The closest point is somewhere on a cell, it
......@@ -187,12 +118,6 @@ public:
// built before attempting to access buckets (octants).
virtual int GetNumberOfBuckets(void);
// Description:
// Returns the Id of the cell containing the point,
// returns -1 if no cell found. This interface uses a tolerance of zero
virtual vtkIdType FindCell(double x[3])
{ return this->Superclass::FindCell(x); }
// Description:
// Find the cell containing a given point. returns -1 if no cell found
// the cell parameters are copied into the supplied variables, a cell must
......
......@@ -163,11 +163,9 @@ class VTKFILTERSFLOWPATHS_EXPORT vtkModifiedBSPTree : public vtkAbstractCellLoca
// Construct with maximum 32 cells per node. (average 16->31)
static vtkModifiedBSPTree *New();
//BTX
// Re-use any superclass signatures that we don't override.
using vtkAbstractCellLocator::IntersectWithLine;
using vtkAbstractCellLocator::FindClosestPoint;
using vtkAbstractCellLocator::FindClosestPointWithinRadius;
//ETX
using vtkAbstractCellLocator::FindCell;
// Description:
// Free tree memory
......@@ -186,14 +184,6 @@ class VTKFILTERSFLOWPATHS_EXPORT vtkModifiedBSPTree : public vtkAbstractCellLoca
// Generate BBox representation of all leaf nodes
virtual void GenerateRepresentationLeafs(vtkPolyData *pd);
// Description:
// Return intersection point (if any) of finite line with cells contained
// in cell locator.
virtual int IntersectWithLine(
double p1[3], double p2[3], double tol, double& t, double x[3],
double pcoords[3], int &subId)
{ return this->Superclass::IntersectWithLine(p1, p2, tol, t, x, pcoords, subId); }
// Description:
// Return intersection point (if any) AND the cell which was intersected by
// the finite line. Uses fast tree-search BBox rejection tests.
......@@ -208,22 +198,6 @@ class VTKFILTERSFLOWPATHS_EXPORT vtkModifiedBSPTree : public vtkAbstractCellLoca
double p1[3], double p2[3], double tol, double &t, double x[3],
double pcoords[3], int &subId, vtkIdType &cellId, vtkGenericCell *cell);
// Description:
// Take the passed line segment and intersect it with the data set.
// This method assumes that the data set is a vtkPolyData that describes
// a closed surface, and the intersection points that are returned in
// 'points' alternate between entrance points and exit points.
// The return value of the function is 0 if no intersections were found,
// -1 if point 'a0' lies inside the closed surface, or +1 if point 'a0'
// lies outside the closed surface.
// Either 'points' or 'cellIds' can be set to NULL if you don't want
// to receive that information. This method is currently only implemented
// in vtkOBBTree
virtual int IntersectWithLine(
const double p1[3], const double p2[3],
vtkPoints *points, vtkIdList *cellIds)
{ return this->Superclass::IntersectWithLine(p1, p2, points, cellIds); }
// Description:
// Take the passed line segment and intersect it with the data set.
// The return value of the function is 0 if no intersections were found.
......@@ -235,12 +209,6 @@ class VTKFILTERSFLOWPATHS_EXPORT vtkModifiedBSPTree : public vtkAbstractCellLoca
const double p1[3], const double p2[3], const double tol,
vtkPoints *points, vtkIdList *cellIds);
// Description:
// Returns the Id of the cell containing the point,
// returns -1 if no cell found. This interface uses a tolerance of zero
virtual vtkIdType FindCell(double x[3])
{ return this->Superclass::FindCell(x); }
// Description:
// Test a point to find if it is inside a cell. Returns the cellId if inside
// or -1 if not.
......
......@@ -89,37 +89,8 @@ public:
// 25 cells per octant.
static vtkOBBTree *New();
//BTX
/*
if the borland compiler is ever removed, we can use these declarations
instead of reimplementaing the calls in this subclass
// Re-use any superclass signatures that we don't override.
using vtkAbstractCellLocator::IntersectWithLine;
using vtkAbstractCellLocator::FindClosestPoint;
using vtkAbstractCellLocator::FindClosestPointWithinRadius;
*/
//ETX
// Description:
// reimplemented from vtkAbstractCellLocator to support bad compilers
virtual int IntersectWithLine(
double a0[3], double a1[3], double tol,
double& t, double x[3], double pcoords[3],
int &subId)
{
return Superclass::
IntersectWithLine(a0, a1, tol,t, x, pcoords, subId);
}
// Description:
// reimplemented from vtkAbstractCellLocator to support bad compilers
virtual int IntersectWithLine(
double a0[3], double a1[3], double tol,
double& t, double x[3], double pcoords[3],
int &subId, vtkIdType &cellId)
{
return Superclass::
IntersectWithLine(a0, a1, tol,t, x, pcoords, subId, cellId);
}
// Description:
// Take the passed line segment and intersect it with the data set.
......@@ -142,69 +113,6 @@ public:
double& t, double x[3], double pcoords[3],
int &subId, vtkIdType &cellId, vtkGenericCell *cell);
// Description:
// Return the closest point and the cell which is closest to the point x.
// The closest point is somewhere on a cell, it need not be one of the
// vertices of the cell. This version takes in a vtkGenericCell
// to avoid allocating and deallocating the cell. This is much faster than
// the version which does not take a *cell, especially when this function is
// called many times in a row such as by a for loop, where the allocation and
// deallocation can be done only once outside the for loop. If a cell is
// found, "cell" contains the points and ptIds for the cell "cellId" upon
// exit.
virtual void FindClosestPoint(
double x[3], double closestPoint[3],
vtkIdType &cellId, int &subId, double& dist2)
{
Superclass::
FindClosestPoint(x, closestPoint, cellId, subId, dist2);
}
// Description:
// reimplemented from vtkAbstractCellLocator to support bad compilers
virtual void FindClosestPoint(
double x[3], double closestPoint[3],
vtkGenericCell *cell, vtkIdType &cellId,
int &subId, double& dist2)
{
Superclass::
FindClosestPoint(x, closestPoint, cell, cellId, subId, dist2);
}
// Description:
// reimplemented from vtkAbstractCellLocator to support bad compilers
virtual vtkIdType FindClosestPointWithinRadius(
double x[3], double radius,
double closestPoint[3], vtkIdType &cellId,
int &subId, double& dist2)
{
return Superclass::FindClosestPointWithinRadius
(x, radius, closestPoint, cellId, subId, dist2);
}
// Description:
// reimplemented from vtkAbstractCellLocator to support bad compilers
virtual vtkIdType FindClosestPointWithinRadius(
double x[3], double radius,
double closestPoint[3],
vtkGenericCell *cell, vtkIdType &cellId,
int &subId, double& dist2)
{
return Superclass::FindClosestPointWithinRadius
(x, radius, closestPoint, cell, cellId, subId, dist2);
}
// Description:
// reimplemented from vtkAbstractCellLocator to support bad compilers
virtual vtkIdType FindClosestPointWithinRadius(
double x[3], double radius, double closestPoint[3],
vtkGenericCell *cell, vtkIdType &cellId,
int &subId, double& dist2, int &inside)
{
return Superclass::FindClosestPointWithinRadius
(x, radius, closestPoint, cell, cellId, subId, dist2, inside);
}
// Description:
// Compute an OBB from the list of points given. Return the corner point
// and the three axes defining the orientation of the OBB. Also return
......
......@@ -17,6 +17,7 @@ set(VTK_PARSE_SOURCES
vtkParseMain.c
vtkParseExtras.c
vtkParseMangle.c
vtkParseMerge.c
vtkParseString.c
vtkParseHierarchy.c
vtkParsePreprocess.c
......
......@@ -863,54 +863,89 @@ size_t vtkParse_ValueInfoFromString(
}
/* Generate a C++ declaration string from a ValueInfo struct */
const char *vtkParse_ValueInfoToString(
ValueInfo *data, int *needs_free)
size_t vtkParse_ValueInfoToString(
ValueInfo *data, char *text, unsigned int flags)
{
unsigned int pointer_bits = (data->Type & VTK_PARSE_POINTER_MASK);
unsigned int ref_bits = (data->Type & VTK_PARSE_REF);
unsigned int ref_bits = (data->Type & (VTK_PARSE_REF | VTK_PARSE_RVALUE));
unsigned int qualifier_bits = (data->Type & VTK_PARSE_CONST);
unsigned int reverse_bits = 0;
unsigned int pointer_type = 0;
const char *classname = data->Class;
const char *name = data->Name;
char *text = NULL;
const char *tpname = data->Class;
int dimensions = data->NumberOfDimensions;
int pointer_dimensions = 0;
size_t i = 0;
size_t l;
int j = 0;
if (pointer_bits == 0 && ref_bits == 0 && qualifier_bits == 0 &&
name == NULL)
/* check if this is a type parameter for a template */
if (!tpname)
{
if (needs_free)
{
*needs_free = 0;
}
return classname;
tpname = "class";
}
/* compute the length of string to allocate */
l = 6; /* for const */
l += 4*7; /* for pointers */
l += 1; /* for ref */
l += strlen(classname) + 1; /* for type */
for (j = 0; j < data->NumberOfDimensions; j++)
/* don't shown anything that isn't in the flags */
ref_bits &= flags;
qualifier_bits &= flags;
/* if this is to be a return value, [] becomes * */
if ((flags & VTK_PARSE_ARRAY) == 0 &&
pointer_bits == VTK_PARSE_POINTER)
{
l += 2 + strlen(data->Dimensions[j]);
if (dimensions == 1)
{
dimensions = 0;
}
}
l++; /* for NULL */
l += 4; /* for safety */
text = (char *)malloc(l);
if ((qualifier_bits & VTK_PARSE_CONST) != 0)
if (!data->Function && (qualifier_bits & VTK_PARSE_CONST) != 0)
{
strcpy(&text[i], "const ");
if (text)
{
strcpy(&text[i], "const ");
}
i += 6;
}
strcpy(&text[i], classname);
i += strlen(classname);
text[i++] = ' ';
if (data->Function)
{
if (text)
{
i += vtkParse_FunctionInfoToString(
data->Function, &text[i], VTK_PARSE_RETURN_VALUE);
text[i++] = '(';
if (data->Function->Class)
{
strcpy(&text[i], data->Function->Class);
i += strlen(data->Function->Class);
text[i++] = ':';
text[i++] = ':';
}
}
else
{
i += vtkParse_FunctionInfoToString(
data->Function, NULL, VTK_PARSE_RETURN_VALUE);
i += 1;
if (data->Function->Class)
{
i += strlen(data->Function->Class);
i += 2;
}
}
}
else
{
if (text)
{
strcpy(&text[i], tpname);
}
i += strlen(tpname);
if (text)
{
text[i] = ' ';
}
i++;
}
while (pointer_bits != 0)
{
......@@ -923,57 +958,444 @@ const char *vtkParse_ValueInfoToString(
{
pointer_type = (reverse_bits & VTK_PARSE_POINTER_LOWMASK);
if (pointer_type == VTK_PARSE_ARRAY ||
(reverse_bits == VTK_PARSE_POINTER &&
data->NumberOfDimensions > 0))
(reverse_bits == VTK_PARSE_POINTER && dimensions > 0))
{
if ((flags & VTK_PARSE_ARRAY) == 0)
{
pointer_dimensions = 1;
if (text)
{
text[i] = '(';
text[i+1] = '*';
}
i += 2;
}
break;
}
else if (pointer_type == VTK_PARSE_POINTER)
{
text[i++] = '*';
if (text)
{
text[i] = '*';
}
i++;
}
else if (pointer_type == VTK_PARSE_CONST_POINTER)
{
strcpy(&text[i], "*const ");
if (text)
{
strcpy(&text[i], "*const ");
}
i += 7;
}
reverse_bits = ((reverse_bits >> 2) & VTK_PARSE_POINTER_MASK);
}
if (ref_bits)
if ((ref_bits & VTK_PARSE_REF) != 0)
{
text[i++] = '&';
if ((ref_bits & VTK_PARSE_RVALUE) != 0)
{
if (text)
{
text[i] = '&';
}
i++;
}
if (text)
{
text[i] = '&';
}
i++;
}
if (name)
if (data->Name && (flags & VTK_PARSE_NAMES) != 0)
{
strcpy(&text[i], name);
i += strlen(name);
if (text)
{
strcpy(&text[i], data->Name);
}
i += strlen(data->Name);
if (data->Value && (flags & VTK_PARSE_VALUES) != 0)
{
if (text)
{
text[i] = '=';
}
i++;
if (text)
{
strcpy(&text[i], data->Value);
}
i += strlen(data->Value);
}
}
for (j = 0; j < pointer_dimensions; j++)
{
if (text)
{
text[i] = ')';
}
i++;
}
for (j = 0; j < data->NumberOfDimensions; j++)
for (j = pointer_dimensions; j < dimensions; j++)
{
text[i++] = '[';
if (text)
{
text[i] = '[';
}
i++;
if (data->Dimensions[j])
{
strcpy(&text[i], data->Dimensions[j]);
if (text)
{
strcpy(&text[i], data->Dimensions[j]);
}
i += strlen(data->Dimensions[j]);
}
text[i++] = ']';
if (text)
{
text[i] = ']';
}
i++;
}
if (data->Function)
{
if (text)
{
text[i++] = ')';
i += vtkParse_FunctionInfoToString(
data->Function, &text[i],
VTK_PARSE_CONST | VTK_PARSE_PARAMETER_LIST);
}
else
{
i++;
i += vtkParse_FunctionInfoToString(
data->Function, NULL,
VTK_PARSE_CONST | VTK_PARSE_PARAMETER_LIST);
}
}
if (text)
{
text[i] = '\0';
}
return i;
}
/* Generate a template declaration string */
size_t vtkParse_TemplateInfoToString(
TemplateInfo *data, char *text, unsigned int flags)
{
int i;
size_t k = 0;
if (text)
{
strcpy(&text[k], "template<");
}
k += 9;
for (i = 0; i < data->NumberOfParameters; i++)
{
if (i != 0)
{
if (text)
{
text[k] = ',';
text[k+1] = ' ';
}
k += 2;
}
if (text)
{
k += vtkParse_ValueInfoToString(data->Parameters[i], &text[k], flags);
while (k > 0 && text[k-1] == ' ')
{
k--;
}
}
else
{
k += vtkParse_ValueInfoToString(data->Parameters[i], NULL, flags);
}
}
if (text)
{
text[k] = '>';
text[k+1] = '\0';
}
k++;
return k;
}
/* generate a function signature for a FunctionInfo struct */
size_t vtkParse_FunctionInfoToString(
FunctionInfo *func, char *text, unsigned int flags)
{