Commit 12947cd1 authored by Brad King's avatar Brad King

ENH: Three sweeping changes.

1.) vtkTypeRevisionMacro is now used in all VTK classes in place of
    vtkTypeMacro.  It invokes the original vtkTypeMacro and then adds
    a protected CollectRevisions method for future use in serialization.
    A corresponding vtkCxxRevisionMacro has been added to every .cxx file
    to implement the CollectRevisions method for each class.  This will
    allow collection of every class revision at run time.  Any new VTK class
    should use vtkTypeRevisionMacro instead of vtkTypeMacro.  The .cxx
    implementation should then have the following line:
      vtkCxxRevisionMacro(vtkFoo, "$Revision: 1.1 $");
    CVS should insert the correct revision number when the class is commited.

2.) vtkTypeMacro now also adds a typedef called "Superclass" to refer to
    the superclass of any VTK class.  All PrintSelf methods have been
    updated to call their superclass's PrintSelf like this:
      this->Superclass::PrintSelf(os,indent);
    This should reduce the number of places that refer to a superclass
    by its actual name.

3.) The standard ::New() method implementation has been replaced with a
    macro.  Instead of an explicitly written implementation to try the
    object factory and then call the new operator, VTK classes should
    instead use the following macro unless they have a special New() method:
      vtkStandardNewMacro(vtkFoo);
    This will implement the New() method in the standard way.  The line
    should appear in the .cxx implementation file, not in the header.
    Using the macro will make it easier to change the standard
    implementation of the method.

Also removed tabs from many files.
parent 316b9b16

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.
......@@ -16,10 +16,13 @@ public:
{
}
vtkTypeMacro(vtkTestVertex,vtkVertex);
vtkTypeRevisionMacro(vtkTestVertex,vtkVertex);
static vtkTestVertex* New() { return new vtkTestVertex; }
vtkTestVertex() { }
};
vtkCxxRevisionMacro(vtkTestVertex, "1.13");
class vtkTestVertex2 : public vtkVertex
{
public:
......@@ -28,11 +31,13 @@ public:
}
// Methods from vtkObject
vtkTypeMacro(vtkTestVertex2,vtkVertex);
vtkTypeRevisionMacro(vtkTestVertex2,vtkVertex);
static vtkTestVertex2* New() { return new vtkTestVertex2; }
vtkTestVertex2() { }
};
vtkCxxRevisionMacro(vtkTestVertex2, "1.13");
VTK_CREATE_CREATE_FUNCTION(vtkTestVertex);
VTK_CREATE_CREATE_FUNCTION(vtkTestVertex2);
......
......@@ -44,6 +44,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "vtkObjectFactory.h"
#include "vtkPlanes.h"
vtkCxxRevisionMacro(vtkAbstractMapper, "1.22");
// Construct object.
vtkAbstractMapper::vtkAbstractMapper()
{
......@@ -205,7 +207,7 @@ void vtkAbstractMapper::ShallowCopy(vtkAbstractMapper *mapper)
void vtkAbstractMapper::PrintSelf(ostream& os, vtkIndent indent)
{
this->vtkProcessObject::PrintSelf(os,indent);
this->Superclass::PrintSelf(os,indent);
os << indent << "TimeToDraw: " << this->TimeToDraw << "\n";
......
......@@ -73,7 +73,7 @@ class vtkDataSet;
class VTK_COMMON_EXPORT vtkAbstractMapper : public vtkProcessObject
{
public:
vtkTypeMacro(vtkAbstractMapper,vtkProcessObject);
vtkTypeRevisionMacro(vtkAbstractMapper,vtkProcessObject);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
......
......@@ -46,6 +46,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "vtkDebugLeaks.h"
#include "vtkCriticalSection.h"
vtkCxxRevisionMacro(vtkAbstractTransform, "1.20");
//----------------------------------------------------------------------------
vtkAbstractTransform::vtkAbstractTransform()
{
......@@ -76,7 +78,7 @@ vtkAbstractTransform::~vtkAbstractTransform()
//----------------------------------------------------------------------------
void vtkAbstractTransform::PrintSelf(ostream& os, vtkIndent indent)
{
vtkObject::PrintSelf(os, indent);
this->Superclass::PrintSelf(os, indent);
os << indent << "Inverse: (" << this->MyInverse << ")\n";
}
......@@ -388,7 +390,7 @@ void vtkAbstractTransform::UnRegister(vtkObject *o)
class vtkSimpleTransform : public vtkHomogeneousTransform
{
public:
vtkTypeMacro(vtkSimpleTransform,vtkHomogeneousTransform);
vtkTypeRevisionMacro(vtkSimpleTransform,vtkHomogeneousTransform);
static vtkSimpleTransform *New() {
#ifdef VTK_DEBUG_LEAKS
vtkDebugLeaks::ConstructClass("vtkSimpleTransform");
......@@ -402,6 +404,8 @@ protected:
void operator=(const vtkSimpleTransform&);
};
vtkCxxRevisionMacro(vtkSimpleTransform, "1.20");
//----------------------------------------------------------------------------
vtkTransformConcatenation::vtkTransformConcatenation()
{
......
......@@ -75,7 +75,7 @@ class VTK_COMMON_EXPORT vtkAbstractTransform : public vtkObject
{
public:
vtkTypeMacro(vtkAbstractTransform,vtkObject);
vtkTypeRevisionMacro(vtkAbstractTransform,vtkObject);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
......
......@@ -45,19 +45,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "vtkPropCollection.h"
#include "vtkObjectFactory.h"
//-------------------------------------------------------------------------
vtkActor2D* vtkActor2D::New()
{
// First try to create the object from the vtkObjectFactory
vtkObject* ret = vtkObjectFactory::CreateInstance("vtkActor2D");
if(ret)
{
return (vtkActor2D*)ret;
}
// If the factory was unable to create the object, then create it here.
return new vtkActor2D;
}
vtkCxxRevisionMacro(vtkActor2D, "1.31");
vtkStandardNewMacro(vtkActor2D);
// Creates an actor2D with the following defaults:
// position -1, -1 (view coordinates)
......@@ -294,7 +283,7 @@ void vtkActor2D::ShallowCopy(vtkProp *prop)
void vtkActor2D::PrintSelf(ostream& os, vtkIndent indent)
{
this->vtkProp::PrintSelf(os,indent);
this->Superclass::PrintSelf(os,indent);
os << indent << "Layer Number: " << this->LayerNumber << "\n";
os << indent << "PositionCoordinate: " << this->PositionCoordinate << "\n";
......
......@@ -62,7 +62,7 @@ class VTK_COMMON_EXPORT vtkActor2D : public vtkProp
{
public:
void PrintSelf(ostream& os, vtkIndent indent);
vtkTypeMacro(vtkActor2D,vtkProp);
vtkTypeRevisionMacro(vtkActor2D,vtkProp);
// Description:
// Creates an actor2D with the following defaults:
......
......@@ -40,27 +40,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=========================================================================*/
#include "vtkCollection.h"
#include "vtkActor2DCollection.h"
#include "vtkObjectFactory.h"
//------------------------------------------------------------------------------
vtkActor2DCollection* vtkActor2DCollection::New()
{
// First try to create the object from the vtkObjectFactory
vtkObject* ret = vtkObjectFactory::CreateInstance("vtkActor2DCollection");
if(ret)
{
return (vtkActor2DCollection*)ret;
}
// If the factory was unable to create the object, then create it here.
return new vtkActor2DCollection;
}
vtkCxxRevisionMacro(vtkActor2DCollection, "1.20");
vtkStandardNewMacro(vtkActor2DCollection);
// protected function to delete an element. Internal use only.
void vtkActor2DCollection::DeleteElement(vtkCollectionElement *e)
......
......@@ -64,7 +64,7 @@ class VTK_COMMON_EXPORT vtkActor2DCollection : public vtkPropCollection
// objects from the collection.
static vtkActor2DCollection *New();
vtkTypeMacro(vtkActor2DCollection,vtkPropCollection);
vtkTypeRevisionMacro(vtkActor2DCollection,vtkPropCollection);
// Description:
// Sorts the vtkActor2DCollection by layer number. Smaller layer
......
......@@ -44,18 +44,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "vtkMatrix4x4.h"
#include "vtkObjectFactory.h"
//-------------------------------------------------------------------------
vtkAssemblyNode* vtkAssemblyNode::New()
{
// First try to create the object from the vtkObjectFactory
vtkObject* ret = vtkObjectFactory::CreateInstance("vtkAssemblyNode");
if(ret)
{
return (vtkAssemblyNode*)ret;
}
// If the factory was unable to create the object, then create it here.
return new vtkAssemblyNode;
}
vtkCxxRevisionMacro(vtkAssemblyNode, "1.4");
vtkStandardNewMacro(vtkAssemblyNode);
vtkAssemblyNode::vtkAssemblyNode()
{
......@@ -121,7 +111,7 @@ unsigned long vtkAssemblyNode::GetMTime()
void vtkAssemblyNode::PrintSelf(ostream& os, vtkIndent indent)
{
vtkObject::PrintSelf(os,indent);
this->Superclass::PrintSelf(os,indent);
if ( this->Prop )
{
......
......@@ -80,7 +80,7 @@ public:
// Create an assembly node.
static vtkAssemblyNode *New();
vtkTypeMacro(vtkAssemblyNode,vtkObject);
vtkTypeRevisionMacro(vtkAssemblyNode,vtkObject);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
......
......@@ -44,18 +44,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "vtkTransform.h"
#include "vtkObjectFactory.h"
//-----------------------------------------------------------------------------
vtkAssemblyPath* vtkAssemblyPath::New()
{
// First try to create the object from the vtkObjectFactory
vtkObject* ret = vtkObjectFactory::CreateInstance("vtkAssemblyPath");
if(ret)
{
return (vtkAssemblyPath*)ret;
}
// If the factory was unable to create the object, then create it here.
return new vtkAssemblyPath;
}
vtkCxxRevisionMacro(vtkAssemblyPath, "1.4");
vtkStandardNewMacro(vtkAssemblyPath);
vtkAssemblyPath::vtkAssemblyPath()
{
......@@ -164,7 +154,7 @@ unsigned long vtkAssemblyPath::GetMTime()
void vtkAssemblyPath::PrintSelf(ostream& os, vtkIndent indent)
{
vtkCollection::PrintSelf(os,indent);
this->Superclass::PrintSelf(os,indent);
}
......@@ -64,7 +64,7 @@ class vtkProp;
class VTK_COMMON_EXPORT vtkAssemblyPath : public vtkCollection
{
public:
vtkTypeMacro(vtkAssemblyPath,vtkCollection);
vtkTypeRevisionMacro(vtkAssemblyPath,vtkCollection);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
......
......@@ -42,18 +42,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "vtkAssemblyPaths.h"
#include "vtkObjectFactory.h"
//----------------------------------------------------------------------------
vtkAssemblyPaths* vtkAssemblyPaths::New()
{
// First try to create the object from the vtkObjectFactory
vtkObject* ret = vtkObjectFactory::CreateInstance("vtkAssemblyPaths");
if(ret)
{
return (vtkAssemblyPaths*)ret;
}
// If the factory was unable to create the object, then create it here.
return new vtkAssemblyPaths;
}
vtkCxxRevisionMacro(vtkAssemblyPaths, "1.4");
vtkStandardNewMacro(vtkAssemblyPaths);
unsigned long vtkAssemblyPaths::GetMTime()
{
......
......@@ -60,7 +60,7 @@ class VTK_COMMON_EXPORT vtkAssemblyPaths : public vtkCollection
{
public:
static vtkAssemblyPaths *New();
vtkTypeMacro(vtkAssemblyPaths,vtkCollection);
vtkTypeRevisionMacro(vtkAssemblyPaths,vtkCollection);
// Description:
// Add a path to the list.
......
......@@ -53,6 +53,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "vtkDoubleArray.h"
#include "vtkIdTypeArray.h"
vtkCxxRevisionMacro(vtkAttributeData, "1.21");
// Construct object with an initial data array of type dataType (by default
// dataType is VTK_FLOAT.
vtkAttributeData::vtkAttributeData(int dataType)
......@@ -221,7 +223,7 @@ unsigned long vtkAttributeData::GetActualMemorySize()
void vtkAttributeData::PrintSelf(ostream& os, vtkIndent indent)
{
vtkObject::PrintSelf(os,indent);
this->Superclass::PrintSelf(os,indent);
os << indent << "Data: " << this->Data << "\n";
if ( this->Data )
......
......@@ -58,7 +58,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
class VTK_COMMON_EXPORT vtkAttributeData : public vtkObject
{
public:
vtkTypeMacro(vtkAttributeData,vtkObject);
vtkTypeRevisionMacro(vtkAttributeData,vtkObject);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
......
......@@ -42,20 +42,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "vtkBitArray.h"
#include "vtkObjectFactory.h"
//----------------------------------------------------------------------------
vtkBitArray* vtkBitArray::New()
{
// First try to create the object from the vtkObjectFactory
vtkObject* ret = vtkObjectFactory::CreateInstance("vtkBitArray");
if(ret)
{
return (vtkBitArray*)ret;
}
// If the factory was unable to create the object, then create it here.
return new vtkBitArray;
}
vtkCxxRevisionMacro(vtkBitArray, "1.50");
vtkStandardNewMacro(vtkBitArray);
vtkDataArray *vtkBitArray::MakeObject()
{
......@@ -190,7 +178,7 @@ void vtkBitArray::DeepCopy(vtkDataArray *ia)
void vtkBitArray::PrintSelf(ostream& os, vtkIndent indent)
{
vtkDataArray::PrintSelf(os,indent);
this->Superclass::PrintSelf(os,indent);
if (this->Array)
{
......
......@@ -55,7 +55,7 @@ class VTK_COMMON_EXPORT vtkBitArray : public vtkDataArray
{
public:
static vtkBitArray *New();
vtkTypeMacro(vtkBitArray,vtkDataArray);
vtkTypeRevisionMacro(vtkBitArray,vtkDataArray);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
......
......@@ -43,17 +43,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <memory.h>
#include "vtkObjectFactory.h"
vtkByteSwap* vtkByteSwap::New()
{
// First try to create the object from the vtkObjectFactory
vtkObject* ret = vtkObjectFactory::CreateInstance("vtkByteSwap");
if(ret)
{
return (vtkByteSwap*)ret;
}
// If the factory was unable to create the object, then create it here.
return new vtkByteSwap;
}
vtkCxxRevisionMacro(vtkByteSwap, "1.43");
vtkStandardNewMacro(vtkByteSwap);
// Swap 2 byte word.
#ifdef VTK_WORDS_BIGENDIAN
......
......@@ -54,7 +54,7 @@ class VTK_COMMON_EXPORT vtkByteSwap : public vtkObject
{
public:
static vtkByteSwap *New();
vtkTypeMacro(vtkByteSwap,vtkObject);
vtkTypeRevisionMacro(vtkByteSwap,vtkObject);
// Description:
// Swap 2 byte word to be LE.
......
......@@ -42,6 +42,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "vtkCell.h"
#include "vtkMarchingSquaresCases.h"
vtkCxxRevisionMacro(vtkCell, "1.51");
// Construct cell.
vtkCell::vtkCell()
{
......@@ -268,9 +270,9 @@ int vtkCell::GetParametricCenter(float pcoords[3])
void vtkCell::PrintSelf(ostream& os, vtkIndent indent)
{
int numIds=this->PointIds->GetNumberOfIds();
this->Superclass::PrintSelf(os,indent);
vtkObject::PrintSelf(os,indent);
int numIds=this->PointIds->GetNumberOfIds();
os << indent << "Number Of Points: " << numIds << "\n";
......
......@@ -79,7 +79,7 @@ class vtkCellData;
class VTK_COMMON_EXPORT vtkCell : public vtkObject
{
public:
vtkTypeMacro(vtkCell,vtkObject);
vtkTypeRevisionMacro(vtkCell,vtkObject);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
......
......@@ -44,6 +44,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "vtkPointLocator.h"
#include "vtkMarchingCubesCases.h"
vtkCxxRevisionMacro(vtkCell3D, "1.19");
vtkCell3D::~vtkCell3D()
{
if ( this->Triangulator )
......@@ -163,7 +165,7 @@ void vtkCell3D::Clip(float value, vtkDataArray *cellScalars,
void vtkCell3D::PrintSelf(ostream& os, vtkIndent indent)
{
vtkCell::PrintSelf(os,indent);
this->Superclass::PrintSelf(os,indent);
}
// Note: the following code is placed here to deal with cross-library
......
......@@ -58,7 +58,7 @@ class vtkOrderedTriangulator;
class VTK_COMMON_EXPORT vtkCell3D : public vtkCell
{
public:
vtkTypeMacro(vtkCell3D,vtkCell);
vtkTypeRevisionMacro(vtkCell3D,vtkCell);
void PrintSelf(ostream& os, vtkIndent indent);
// Description:
......
......@@ -42,23 +42,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "vtkCellArray.h"
#include "vtkObjectFactory.h"
//----------------------------------------------------------------------------
vtkCellArray* vtkCellArray::New()
{
// First try to create the object from the vtkObjectFactory
vtkObject* ret = vtkObjectFactory::CreateInstance("vtkCellArray");
if(ret)
{
return (vtkCellArray*)ret;
}
// If the factory was unable to create the object, then create it here.
return new vtkCellArray;
}
vtkCxxRevisionMacro(vtkCellArray, "1.38");
vtkStandardNewMacro(vtkCellArray);
vtkCellArray::vtkCellArray()
{
......
......@@ -65,7 +65,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
class VTK_COMMON_EXPORT vtkCellArray : public vtkObject
{
public:
vtkTypeMacro(vtkCellArray,vtkObject);
vtkTypeRevisionMacro(vtkCellArray,vtkObject);
// Description:
// Instantiate cell array (connectivity list).
......
......@@ -42,22 +42,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "vtkCellData.h"
#include "vtkObjectFactory.h"
//------------------------------------------------------------------------------
vtkCellData* vtkCellData::New()
{
// First try to create the object from the vtkObjectFactory
vtkObject* ret = vtkObjectFactory::CreateInstance("vtkCellData");
if(ret)
{
return (vtkCellData*)ret;
}
// If the factory was unable to create the object, then create it here.
return new vtkCellData;
}
vtkCxxRevisionMacro(vtkCellData, "1.11");
vtkStandardNewMacro(vtkCellData);
void vtkCellData::PrintSelf(ostream& os, vtkIndent indent)
{
vtkDataSetAttributes::PrintSelf(os,indent);
this->Superclass::PrintSelf(os,indent);
}
......@@ -57,7 +57,7 @@ class VTK_COMMON_EXPORT vtkCellData : public vtkDataSetAttributes
public:
static vtkCellData *New();
vtkTypeMacro(vtkCellData,vtkDataSetAttributes);
vtkTypeRevisionMacro(vtkCellData,vtkDataSetAttributes);
void PrintSelf(ostream& os, vtkIndent indent);
protected:
......
......@@ -45,18 +45,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "vtkPolyData.h"
#include "vtkObjectFactory.h"
//-----------------------------------------------------------------------------
vtkCellLinks* vtkCellLinks::New()
{
// First try to create the object from the vtkObjectFactory
vtkObject* ret = vtkObjectFactory::CreateInstance("vtkCellLinks");
if(ret)
{
return (vtkCellLinks*)ret;
}
// If the factory was unable to create the object, then create it here.
return new vtkCellLinks;
}
vtkCxxRevisionMacro(vtkCellLinks, "1.22");
vtkStandardNewMacro(vtkCellLinks);
void vtkCellLinks::Allocate(vtkIdType sz, vtkIdType ext)
{
......
......@@ -65,7 +65,7 @@ class VTK_COMMON_EXPORT vtkCellLinks : public vtkObject
{
public:
static vtkCellLinks *New();
vtkTypeMacro(vtkCellLinks,vtkObject);
vtkTypeRevisionMacro(vtkCellLinks,vtkObject);
// Description:
// Allocate the specified number of links (i.e., number of points) that
......
......@@ -42,19 +42,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "vtkCellTypes.h"
#include "vtkObjectFactory.h"
//------------------------------------------------------------------------------
vtkCellTypes* vtkCellTypes::New()
{
// First try to create the object from the vtkObjectFactory
vtkObject* ret = vtkObjectFactory::CreateInstance("vtkCellTypes");
if(ret)
{
return (vtkCellTypes*)ret;
}
// If the factory was unable to create the object, then create it here.
return new vtkCellTypes;
}
vtkCxxRevisionMacro(vtkCellTypes, "1.18");
vtkStandardNewMacro(vtkCellTypes);
vtkCellTypes::vtkCellTypes ()
{
......
......@@ -69,7 +69,7 @@ class VTK_COMMON_EXPORT vtkCellTypes : public vtkObject
{
public: