VTK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
vtkObjectBase.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkObjectBase.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
45 #ifndef __vtkObjectBase_h
46 #define __vtkObjectBase_h
47 
48 #include "vtkCommonCoreModule.h" // For export macro
49 #include "vtkIndent.h"
50 #include "vtkSystemIncludes.h"
51 
53 class vtkGarbageCollectorToObjectBaseFriendship;
54 class vtkWeakPointerBase;
55 class vtkWeakPointerBaseToObjectBaseFriendship;
56 
57 class VTKCOMMONCORE_EXPORT vtkObjectBase
58 {
60 
63  virtual const char* GetClassNameInternal() const { return "vtkObjectBase"; }
64 public:
66 
67 #ifdef VTK_WORKAROUND_WINDOWS_MANGLE
68  // Avoid windows name mangling.
69 # define GetClassNameA GetClassName
70 # define GetClassNameW GetClassName
71 #endif
72 
74  const char* GetClassName() const;
75 
76 #ifdef VTK_WORKAROUND_WINDOWS_MANGLE
77 # undef GetClassNameW
78 # undef GetClassNameA
79  //BTX
80  // Define possible mangled names.
81  const char* GetClassNameA() const;
82  const char* GetClassNameW() const;
83  //ETX
84 #endif
85 
89  static int IsTypeOf(const char *name);
90 
94  virtual int IsA(const char *name);
95 
99  virtual void Delete();
100 
106  virtual void FastDelete();
107 
109 
111  static vtkObjectBase *New()
112  {return new vtkObjectBase;}
114 
115 #ifdef _WIN32
116  // avoid dll boundary problems
117  void* operator new( size_t tSize );
118  void operator delete( void* p );
119 #endif
120 
123  void Print(ostream& os);
124 
126 
130  virtual void PrintSelf(ostream& os, vtkIndent indent);
131  virtual void PrintHeader(ostream& os, vtkIndent indent);
132  virtual void PrintTrailer(ostream& os, vtkIndent indent);
134 
136  virtual void Register(vtkObjectBase* o);
137 
141  virtual void UnRegister(vtkObjectBase* o);
142 
144 
146  {return this->ReferenceCount;}
148 
150  void SetReferenceCount(int);
151 
153  void PrintRevisions(ostream&) {}
154 
155 protected:
156  vtkObjectBase();
157  virtual ~vtkObjectBase();
158 
159  virtual void CollectRevisions(ostream&) {} // Legacy; do not use!
160 
163 
164  // Internal Register/UnRegister implementation that accounts for
165  // possible garbage collection participation. The second argument
166  // indicates whether to participate in garbage collection.
167  virtual void RegisterInternal(vtkObjectBase*, int check);
168  virtual void UnRegisterInternal(vtkObjectBase*, int check);
169 
170  // See vtkGarbageCollector.h:
171  virtual void ReportReferences(vtkGarbageCollector*);
172 
173 private:
174  //BTX
175  friend VTKCOMMONCORE_EXPORT ostream& operator<<(ostream& os, vtkObjectBase& o);
176  friend class vtkGarbageCollectorToObjectBaseFriendship;
177  friend class vtkWeakPointerBaseToObjectBaseFriendship;
178  //ETX
179 protected:
180 //BTX
182  void operator=(const vtkObjectBase&) {}
183 //ETX
184 };
185 
186 #endif
187 
188 // VTK-HeaderTest-Exclude: vtkObjectBase.h
static vtkObjectBase * New()
vtkObjectBase(const vtkObjectBase &)
void PrintRevisions(ostream &)
int GetReferenceCount()
Detect and break reference loops.
a simple class to control print indentation
Definition: vtkIndent.h:38
Non-templated superclass for vtkWeakPointer.
abstract base class for most VTK objects
Definition: vtkObjectBase.h:57
virtual void CollectRevisions(ostream &)
VTKCOMMONCORE_EXPORT ostream & operator<<(ostream &os, const vtkIndent &o)
vtkWeakPointerBase ** WeakPointers
void operator=(const vtkObjectBase &)