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 "vtkAtomicInt.h"
50 #include "vtkIndent.h"
51 #include "vtkSystemIncludes.h"
52 
54 class vtkGarbageCollectorToObjectBaseFriendship;
55 class vtkWeakPointerBase;
56 class vtkWeakPointerBaseToObjectBaseFriendship;
57 
59 {
61 
64  virtual const char* GetClassNameInternal() const { return "vtkObjectBase"; }
65 public:
67 
68 #ifdef VTK_WORKAROUND_WINDOWS_MANGLE
69  // Avoid windows name mangling.
70 # define GetClassNameA GetClassName
71 # define GetClassNameW GetClassName
72 #endif
73 
75  const char* GetClassName() const;
76 
77 #ifdef VTK_WORKAROUND_WINDOWS_MANGLE
78 # undef GetClassNameW
79 # undef GetClassNameA
80  //BTX
81  // Define possible mangled names.
82  const char* GetClassNameA() const;
83  const char* GetClassNameW() const;
84  //ETX
85 #endif
86 
90  static int IsTypeOf(const char *name);
91 
95  virtual int IsA(const char *name);
96 
100  virtual void Delete();
101 
107  virtual void FastDelete();
108 
110 
112  static vtkObjectBase *New()
113  {return new vtkObjectBase;}
115 
116 #ifdef _WIN32
117  // avoid dll boundary problems
118  void* operator new( size_t tSize );
119  void operator delete( void* p );
120 #endif
121 
124  void Print(ostream& os);
125 
127 
131  virtual void PrintSelf(ostream& os, vtkIndent indent);
132  virtual void PrintHeader(ostream& os, vtkIndent indent);
133  virtual void PrintTrailer(ostream& os, vtkIndent indent);
135 
137  virtual void Register(vtkObjectBase* o);
138 
142  virtual void UnRegister(vtkObjectBase* o);
143 
145 
147  {
148  return this->ReferenceCount;
149  }
151 
153  void SetReferenceCount(int);
154 
156  void PrintRevisions(ostream&) {}
157 
158 protected:
159  vtkObjectBase();
160  virtual ~vtkObjectBase();
161 
162  virtual void CollectRevisions(ostream&) {} // Legacy; do not use!
163 
166 
167  // Internal Register/UnRegister implementation that accounts for
168  // possible garbage collection participation. The second argument
169  // indicates whether to participate in garbage collection.
170  virtual void RegisterInternal(vtkObjectBase*, int check);
171  virtual void UnRegisterInternal(vtkObjectBase*, int check);
172 
173  // See vtkGarbageCollector.h:
174  virtual void ReportReferences(vtkGarbageCollector*);
175 
176 private:
177  //BTX
178  friend VTKCOMMONCORE_EXPORT ostream& operator<<(ostream& os, vtkObjectBase& o);
179  friend class vtkGarbageCollectorToObjectBaseFriendship;
180  friend class vtkWeakPointerBaseToObjectBaseFriendship;
181  //ETX
182 protected:
183 //BTX
185  void operator=(const vtkObjectBase&) {}
186 //ETX
187 };
188 
189 #endif
190 
191 // VTK-HeaderTest-Exclude: vtkObjectBase.h
static vtkObjectBase * New()
#define VTKCOMMONCORE_EXPORT
vtkAtomicInt< vtkTypeInt32 > ReferenceCount
vtkObjectBase(const vtkObjectBase &)
void PrintRevisions(ostream &)
int GetReferenceCount()
Detect and break reference loops.
GLuint const GLchar * name
Definition: vtkgl.h:11983
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:58
virtual void CollectRevisions(ostream &)
VTKCOMMONCORE_EXPORT ostream & operator<<(ostream &os, const vtkIndent &o)
vtkWeakPointerBase ** WeakPointers
void operator=(const vtkObjectBase &)
GLfloat GLfloat p
Definition: vtkgl.h:15717