VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkObjectBase.h 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 =========================================================================*/ 00045 #ifndef __vtkObjectBase_h 00046 #define __vtkObjectBase_h 00047 00048 #include "vtkCommonCoreModule.h" // For export macro 00049 #include "vtkIndent.h" 00050 #include "vtkSystemIncludes.h" 00051 00052 class vtkGarbageCollector; 00053 class vtkGarbageCollectorToObjectBaseFriendship; 00054 class vtkWeakPointerBase; 00055 class vtkWeakPointerBaseToObjectBaseFriendship; 00056 00057 class VTKCOMMONCORE_EXPORT vtkObjectBase 00058 { 00060 00063 virtual const char* GetClassNameInternal() const { return "vtkObjectBase"; } 00064 public: 00066 00067 #ifdef VTK_WORKAROUND_WINDOWS_MANGLE 00068 // Avoid windows name mangling. 00069 # define GetClassNameA GetClassName 00070 # define GetClassNameW GetClassName 00071 #endif 00072 00074 const char* GetClassName() const; 00075 00076 #ifdef VTK_WORKAROUND_WINDOWS_MANGLE 00077 # undef GetClassNameW 00078 # undef GetClassNameA 00079 //BTX 00080 // Define possible mangled names. 00081 const char* GetClassNameA() const; 00082 const char* GetClassNameW() const; 00083 //ETX 00084 #endif 00085 00089 static int IsTypeOf(const char *name); 00090 00094 virtual int IsA(const char *name); 00095 00099 virtual void Delete(); 00100 00106 virtual void FastDelete(); 00107 00109 00111 static vtkObjectBase *New() 00112 {return new vtkObjectBase;} 00114 00115 #ifdef _WIN32 00116 // avoid dll boundary problems 00117 void* operator new( size_t tSize ); 00118 void operator delete( void* p ); 00119 #endif 00120 00123 void Print(ostream& os); 00124 00126 00130 virtual void PrintSelf(ostream& os, vtkIndent indent); 00131 virtual void PrintHeader(ostream& os, vtkIndent indent); 00132 virtual void PrintTrailer(ostream& os, vtkIndent indent); 00134 00136 virtual void Register(vtkObjectBase* o); 00137 00141 virtual void UnRegister(vtkObjectBase* o); 00142 00144 00145 int GetReferenceCount() 00146 {return this->ReferenceCount;} 00148 00150 void SetReferenceCount(int); 00151 00153 void PrintRevisions(ostream&) {} 00154 00155 protected: 00156 vtkObjectBase(); 00157 virtual ~vtkObjectBase(); 00158 00159 virtual void CollectRevisions(ostream&) {} // Legacy; do not use! 00160 00161 int ReferenceCount; 00162 vtkWeakPointerBase **WeakPointers; 00163 00164 // Internal Register/UnRegister implementation that accounts for 00165 // possible garbage collection participation. The second argument 00166 // indicates whether to participate in garbage collection. 00167 virtual void RegisterInternal(vtkObjectBase*, int check); 00168 virtual void UnRegisterInternal(vtkObjectBase*, int check); 00169 00170 // See vtkGarbageCollector.h: 00171 virtual void ReportReferences(vtkGarbageCollector*); 00172 00173 private: 00174 //BTX 00175 friend VTKCOMMONCORE_EXPORT ostream& operator<<(ostream& os, vtkObjectBase& o); 00176 friend class vtkGarbageCollectorToObjectBaseFriendship; 00177 friend class vtkWeakPointerBaseToObjectBaseFriendship; 00178 //ETX 00179 protected: 00180 //BTX 00181 vtkObjectBase(const vtkObjectBase&) {} 00182 void operator=(const vtkObjectBase&) {} 00183 //ETX 00184 }; 00185 00186 #endif 00187 00188 // VTK-HeaderTest-Exclude: vtkObjectBase.h