00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkObjectBase.h,v $ 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00042 #ifndef __vtkObjectBase_h 00043 #define __vtkObjectBase_h 00044 00045 #include "vtkIndent.h" 00046 #include "vtkSystemIncludes.h" 00047 00048 class VTK_COMMON_EXPORT vtkObjectBase 00049 { 00050 public: 00054 virtual const char *GetClassName() const {return "vtkObjectBase";}; 00055 00059 static int IsTypeOf(const char *name); 00060 00064 virtual int IsA(const char *name); 00065 00069 virtual void Delete(); 00070 00072 00074 static vtkObjectBase *New() 00075 {return new vtkObjectBase;} 00077 00078 #ifdef _WIN32 00079 // avoid dll boundary problems 00080 void* operator new( size_t tSize ); 00081 void operator delete( void* p ); 00082 #endif 00083 00086 void Print(ostream& os); 00087 00089 00093 virtual void PrintSelf(ostream& os, vtkIndent indent); 00094 virtual void PrintHeader(ostream& os, vtkIndent indent); 00095 virtual void PrintTrailer(ostream& os, vtkIndent indent); 00097 00099 void Register(vtkObjectBase* o); 00100 00104 virtual void UnRegister(vtkObjectBase* o); 00105 00107 00108 int GetReferenceCount() 00109 {return this->ReferenceCount;} 00111 00113 void SetReferenceCount(int); 00114 00121 void PrintRevisions(ostream& os); 00122 00123 protected: 00124 vtkObjectBase(); 00125 virtual ~vtkObjectBase(); 00126 00127 virtual void CollectRevisions(ostream& os); 00128 00129 int ReferenceCount; // Number of uses of this object by other objects 00130 00131 private: 00132 //BTX 00133 friend VTK_COMMON_EXPORT ostream& operator<<(ostream& os, vtkObjectBase& o); 00134 //ETX 00135 00136 protected: 00137 //BTX 00138 vtkObjectBase(const vtkObjectBase&) {} 00139 void operator=(const vtkObjectBase&) {} 00140 //ETX 00141 }; 00142 00143 #endif 00144