Commit 85110ca8 authored by Will Schroeder's avatar Will Schroeder

ENH:Protected operator=, copy constructor

parent bdfcc9cb
......@@ -122,6 +122,8 @@ public:
protected:
vtkActor2D();
~vtkActor2D();
vtkActor2D(const vtkActor2D&) {};
void operator=(const vtkActor2D&) {};
vtkMapper2D *Mapper;
int LayerNumber;
......
......@@ -94,7 +94,11 @@ class VTK_EXPORT vtkActor2DCollection : public vtkPropCollection
protected:
vtkActor2DCollection() {};
~vtkActor2DCollection();
vtkActor2DCollection(const vtkActor2DCollection&) {};
void operator=(const vtkActor2DCollection&) {};
virtual void DeleteElement(vtkCollectionElement *);
};
......
......@@ -132,6 +132,8 @@ protected:
// dataType is VTK_FLOAT.
vtkAttributeData(int dataType=VTK_FLOAT);
~vtkAttributeData();
vtkAttributeData(const vtkAttributeData&) {};
void operator=(const vtkAttributeData&) {};
vtkDataArray *Data; // Array which represents data
......
......@@ -257,6 +257,16 @@ void vtkBitArray::GetTuple(const int i, float * tuple)
}
}
void vtkBitArray::GetTuple(const int i, double * tuple)
{
int loc = this->NumberOfComponents*i;
for (int j=0; j<this->NumberOfComponents; j++)
{
tuple[j] = (double)this->GetValue(loc+j);
}
}
// Set the tuple value at the ith location in the array.
void vtkBitArray::SetTuple(const int i, const float * tuple)
{
......@@ -268,6 +278,16 @@ void vtkBitArray::SetTuple(const int i, const float * tuple)
}
}
void vtkBitArray::SetTuple(const int i, const double * tuple)
{
int loc = i * this->NumberOfComponents;
for (int j=0; j<this->NumberOfComponents; j++)
{
this->SetValue(loc+j,(int)tuple[j]);
}
}
// Insert (memory allocation performed) the tuple into the ith location
// in the array.
void vtkBitArray::InsertTuple(const int i, const float * tuple)
......@@ -280,6 +300,16 @@ void vtkBitArray::InsertTuple(const int i, const float * tuple)
}
}
void vtkBitArray::InsertTuple(const int i, const double * tuple)
{
int loc = this->NumberOfComponents*i;
for (int j=0; j<this->NumberOfComponents; j++)
{
this->InsertValue(loc+j,(int)tuple[j]);
}
}
// Insert (memory allocation performed) the tuple onto the end of the array.
int vtkBitArray::InsertNextTuple(const float * tuple)
{
......@@ -290,3 +320,14 @@ int vtkBitArray::InsertNextTuple(const float * tuple)
return this->MaxId / this->NumberOfComponents;
}
int vtkBitArray::InsertNextTuple(const double * tuple)
{
for (int i=0; i<this->NumberOfComponents; i++)
{
this->InsertNextValue((int)tuple[i]);
}
return this->MaxId / this->NumberOfComponents;
}
......@@ -81,19 +81,23 @@ public:
// Description:
// Copy the tuple value into a user-provided array.
void GetTuple(const int i, float * tuple);
void GetTuple(const int i, double * tuple);
// Description:
// Set the tuple value at the ith location in the array.
void SetTuple(const int i, const float * tuple);
void SetTuple(const int i, const double * tuple);
// Description:
// Insert (memory allocation performed) the tuple into the ith location
// in the array.
void InsertTuple(const int i, const float * tuple);
void InsertTuple(const int i, const double * tuple);
// Description:
// Insert (memory allocation performed) the tuple onto the end of the array.
int InsertNextTuple(const float * tuple);
int InsertNextTuple(const double * tuple);
// Description:
// Free any uunrequired memory.
......@@ -151,9 +155,11 @@ public:
// For legacy compatibility. Do not use.
void DeepCopy(vtkBitArray &da) {this->DeepCopy(&da);}
private:
protected:
vtkBitArray(int numComp=1);
~vtkBitArray();
vtkBitArray(const vtkBitArray&) {};
void operator=(const vtkBitArray&) {};
unsigned char *Array; // pointer to data
unsigned char *Resize(const int sz); // function to resize data
......
......@@ -161,6 +161,8 @@ public:
protected:
vtkByteSwap() {};
~vtkByteSwap() {};
vtkByteSwap(const vtkByteSwap&) {};
void operator=(const vtkByteSwap&) {};
};
......
......@@ -296,6 +296,8 @@ public:
protected:
vtkCell();
~vtkCell();
vtkCell(const vtkCell&) {};
void operator=(const vtkCell&) {};
float Bounds[6];
......
......@@ -218,6 +218,8 @@ protected:
vtkCellArray();
vtkCellArray (const int sz, const int ext=1000);
~vtkCellArray();
vtkCellArray(const vtkCellArray&) {};
void operator=(const vtkCellArray&) {};
int NumberOfCells;
int InsertLocation; //keep track of current insertion point
......
......@@ -66,6 +66,8 @@ public:
protected:
vtkCellData() {}; //make sure constructor and desctructor are protected
~vtkCellData() {};
vtkCellData(const vtkCellData&) {};
void operator=(const vtkCellData&) {};
};
......
......@@ -126,9 +126,11 @@ public:
// Reset to a state of no entries without freeing the memory.
void Reset();
private:
protected:
vtkCellLinks():Array(NULL),Size(0),MaxId(-1),Extend(1000) {};
~vtkCellLinks();
vtkCellLinks(const vtkCellLinks&) {};
void operator=(const vtkCellLinks&) {};
// Description:
// Increment the count of the number of cells using the point.
......
......@@ -121,9 +121,11 @@ public:
// Initialize object without releasing memory.
void Reset();
private:
protected:
vtkCellTypes() : Array(NULL),Size(0),MaxId(-1),Extend(1000) {};
~vtkCellTypes();
vtkCellTypes(const vtkCellTypes&) {};
void operator=(const vtkCellTypes&) {};
_vtkCell_s *Array; // pointer to data
int Size; // allocated size of data
......
......@@ -237,6 +237,15 @@ void vtkCharArray::GetTuple(const int i, float * tuple)
}
}
void vtkCharArray::GetTuple(const int i, double * tuple)
{
char *t = this->Array + this->NumberOfComponents*i;
for (int j=0; j<this->NumberOfComponents; j++)
{
tuple[j] = (double)t[j];
}
}
// Set the tuple value at the ith location in the array.
void vtkCharArray::SetTuple(const int i, const float * tuple)
{
......@@ -247,6 +256,15 @@ void vtkCharArray::SetTuple(const int i, const float * tuple)
}
}
void vtkCharArray::SetTuple(const int i, const double * tuple)
{
int loc = i * this->NumberOfComponents;
for (int j=0; j<this->NumberOfComponents; j++)
{
this->Array[loc+j] = (char)tuple[j];
}
}
// Insert (memory allocation performed) the tuple into the ith location
// in the array.
void vtkCharArray::InsertTuple(const int i, const float * tuple)
......@@ -259,6 +277,16 @@ void vtkCharArray::InsertTuple(const int i, const float * tuple)
}
}
void vtkCharArray::InsertTuple(const int i, const double * tuple)
{
char *t = this->WritePointer(i*this->NumberOfComponents,this->NumberOfComponents);
for (int j=0; j<this->NumberOfComponents; j++)
{
*t++ = (char)*tuple++;
}
}
// Insert (memory allocation performed) the tuple onto the end of the array.
int vtkCharArray::InsertNextTuple(const float * tuple)
{
......@@ -273,6 +301,19 @@ int vtkCharArray::InsertNextTuple(const float * tuple)
return this->MaxId / this->NumberOfComponents;
}
int vtkCharArray::InsertNextTuple(const double * tuple)
{
int i = this->MaxId + 1;
char *t = this->WritePointer(i,this->NumberOfComponents);
for (i=0; i<this->NumberOfComponents; i++)
{
*t++ = (char)*tuple++;
}
return this->MaxId / this->NumberOfComponents;
}
// Return the data component at the ith tuple and jth component location.
// Note that i<NumberOfTuples and j<NumberOfComponents.
float vtkCharArray::GetComponent(const int i, const int j)
......
......@@ -86,19 +86,23 @@ public:
// Description:
// Copy the tuple value into a user-provided array.
void GetTuple(const int i, float * tuple);
void GetTuple(const int i, double * tuple);
// Description:
// Set the tuple value at the ith location in the array.
void SetTuple(const int i, const float * tuple);
void SetTuple(const int i, const double * tuple);
// Description:
// Insert (memory allocation performed) the tuple into the ith location
// in the array.
void InsertTuple(const int i, const float * tuple);
void InsertTuple(const int i, const double * tuple);
// Description:
// Insert (memory allocation performed) the tuple onto the end of the array.
int InsertNextTuple(const float * tuple);
int InsertNextTuple(const double * tuple);
// Description:
// Resize object to just fit data requirement. Reclaims extra memory.
......@@ -176,9 +180,11 @@ public:
// For legacy compatibility. Do not use.
void DeepCopy(vtkDataArray &ia) {this->DeepCopy(&ia);}
private:
protected:
vtkCharArray(int numComp=1);
~vtkCharArray();
vtkCharArray(const vtkCharArray&) {};
void operator=(const vtkCharArray&) {};
char *Array; // pointer to data
char *Resize(const int sz); // function to resize data
......
......@@ -128,7 +128,9 @@ public:
protected:
vtkCollection();
virtual ~vtkCollection();
~vtkCollection();
vtkCollection(const vtkCollection&) {};
void operator=(const vtkCollection&) {};
virtual void DeleteElement(vtkCollectionElement *);
int NumberOfItems;
......
......@@ -108,6 +108,8 @@ public:
protected:
vtkContourValues();
~vtkContourValues();
vtkContourValues(const vtkContourValues&) {};
void operator=(const vtkContourValues&) {};
vtkFloatArray *Contours;
......
......@@ -146,6 +146,8 @@ public:
protected:
vtkCoordinate();
~vtkCoordinate();
vtkCoordinate(const vtkCoordinate&) {};
void operator=(const vtkCoordinate&) {};
float Value[3];
int CoordinateSystem;
......
......@@ -211,6 +211,8 @@ protected:
// Construct object with default tuple dimension (number of components) of 1.
vtkDataArray(int numComp=1);
~vtkDataArray() {};
vtkDataArray(const vtkDataArray&) {};
void operator=(const vtkDataArray&) {};
int Size; // allocated size of data
int MaxId; // maximum index inserted thus far
......
......@@ -242,6 +242,8 @@ protected:
vtkDataObject();
~vtkDataObject();
vtkDataObject(const vtkDataObject&) {};
void operator=(const vtkDataObject&) {};
// Description:
// Method implemented in the subclasses to make sure the update extent
......
......@@ -314,6 +314,7 @@ protected:
vtkDataSet();
~vtkDataSet();
vtkDataSet(const vtkDataSet& ds);
void operator=(const vtkDataSet&) {};
vtkCellData *CellData; // Scalars, vectors, etc. associated w/ each cell
vtkPointData *PointData; // Scalars, vectors, etc. associated w/ each point
......
......@@ -242,6 +242,8 @@ public:
protected:
vtkDataSetAttributes();
~vtkDataSetAttributes();
vtkDataSetAttributes(const vtkDataSetAttributes&) {};
void operator=(const vtkDataSetAttributes&) {};
// special methods to support managing data
void InterpolateTuple(vtkDataArray *fromData, vtkDataArray *toData, int toId,
......
......@@ -84,6 +84,8 @@ public:
protected:
vtkDataSetCollection() {};
~vtkDataSetCollection() {};
vtkDataSetCollection(const vtkDataSetCollection&) {};
void operator=(const vtkDataSetCollection&) {};
};
......
......@@ -86,23 +86,23 @@ public:
// Description:
// Copy the tuple value into a user-provided array.