VTK
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 =========================================================================*/
48 #ifndef __vtkObjectBase_h
49 #define __vtkObjectBase_h
50 
51 #include "vtkIndent.h"
52 #include "vtkSystemIncludes.h"
53 
55 class vtkGarbageCollectorToObjectBaseFriendship;
56 class vtkWeakPointerBase;
57 class vtkWeakPointerBaseToObjectBaseFriendship;
58 
60 {
61  virtual const char* GetClassNameInternal() const { return "vtkObjectBase"; }
62 public:
63 
64 #ifdef VTK_WORKAROUND_WINDOWS_MANGLE
65  // Avoid windows name mangling.
66 # define GetClassNameA GetClassName
67 # define GetClassNameW GetClassName
68 #endif
69 
73  const char* GetClassName() const;
74 
75 #ifdef VTK_WORKAROUND_WINDOWS_MANGLE
76 # undef GetClassNameW
77 # undef GetClassNameA
78  //BTX
79  // Define possible mangled names.
80  const char* GetClassNameA() const;
81  const char* GetClassNameW() const;
82  //ETX
83 #endif
84 
88  static int IsTypeOf(const char *name);
89 
93  virtual int IsA(const char *name);
94 
98  virtual void Delete();
99 
105  virtual void FastDelete();
106 
108 
110  static vtkObjectBase *New()
111  {return new vtkObjectBase;}
113 
114 #ifdef _WIN32
115  // avoid dll boundary problems
116  void* operator new( size_t tSize );
117  void operator delete( void* p );
118 #endif
119 
122  void Print(ostream& os);
123 
125 
129  virtual void PrintSelf(ostream& os, vtkIndent indent);
130  virtual void PrintHeader(ostream& os, vtkIndent indent);
131  virtual void PrintTrailer(ostream& os, vtkIndent indent);
133 
135  virtual void Register(vtkObjectBase* o);
136 
140  virtual void UnRegister(vtkObjectBase* o);
141 
143 
145  {return this->ReferenceCount;}
147 
149  void SetReferenceCount(int);
150 
157  void PrintRevisions(ostream& os);
158 
159 protected:
160  vtkObjectBase();
161  virtual ~vtkObjectBase();
162 
163  virtual void CollectRevisions(ostream& os);
164 
167 
168  // Internal Register/UnRegister implementation that accounts for
169  // possible garbage collection participation. The second argument
170  // indicates whether to participate in garbage collection.
171  virtual void RegisterInternal(vtkObjectBase*, int check);
172  virtual void UnRegisterInternal(vtkObjectBase*, int check);
173 
174  // See vtkGarbageCollector.h:
175  virtual void ReportReferences(vtkGarbageCollector*);
176 
177 private:
178  //BTX
179  friend VTK_COMMON_EXPORT ostream& operator<<(ostream& os, vtkObjectBase& o);
180  friend class vtkGarbageCollectorToObjectBaseFriendship;
181  friend class vtkWeakPointerBaseToObjectBaseFriendship;
182  //ETX
183 protected:
184 //BTX
186  void operator=(const vtkObjectBase&) {}
187 //ETX
188 };
189 
190 #endif
191 
static vtkObjectBase * New()
vtkObjectBase(const vtkObjectBase &)
int GetReferenceCount()
Detect and break reference loops.
a simple class to control print indentation
Definition: vtkIndent.h:37
Non-templated superclass for vtkWeakPointer.
#define VTK_COMMON_EXPORT
abstract base class for most VTK objects
Definition: vtkObjectBase.h:59
vtkWeakPointerBase ** WeakPointers
void operator=(const vtkObjectBase &)
VTK_COMMON_EXPORT ostream & operator<<(ostream &os, const vtkIndent &o)