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 =========================================================================*/
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 #include "vtkAtomicTypes.h" // needs to be included after vtkSystemIncludes.h
52  // for warning suppressions to work on Visual Studio
53 
55 class vtkGarbageCollectorToObjectBaseFriendship;
56 class vtkWeakPointerBase;
57 class vtkWeakPointerBaseToObjectBaseFriendship;
58 
60 {
62 
65  virtual const char* GetClassNameInternal() const { return "vtkObjectBase"; }
66 public:
68 
69 #ifdef VTK_WORKAROUND_WINDOWS_MANGLE
70  // Avoid windows name mangling.
71 # define GetClassNameA GetClassName
72 # define GetClassNameW GetClassName
73 #endif
74 
76  const char* GetClassName() const;
77 
78 #ifdef VTK_WORKAROUND_WINDOWS_MANGLE
79 # undef GetClassNameW
80 # undef GetClassNameA
81  //BTX
82  // Define possible mangled names.
83  const char* GetClassNameA() const;
84  const char* GetClassNameW() const;
85  //ETX
86 #endif
87 
91  static int IsTypeOf(const char *name);
92 
96  virtual int IsA(const char *name);
97 
101  virtual void Delete();
102 
108  virtual void FastDelete();
109 
111 
113  static vtkObjectBase *New()
114  {return new vtkObjectBase;}
116 
117 #ifdef _WIN32
118  // avoid dll boundary problems
119  void* operator new( size_t tSize );
120  void operator delete( void* p );
121 #endif
122 
125  void Print(ostream& os);
126 
128 
132  virtual void PrintSelf(ostream& os, vtkIndent indent);
133  virtual void PrintHeader(ostream& os, vtkIndent indent);
134  virtual void PrintTrailer(ostream& os, vtkIndent indent);
136 
138  virtual void Register(vtkObjectBase* o);
139 
143  virtual void UnRegister(vtkObjectBase* o);
144 
146 
148  {
149  return this->ReferenceCount;
150  }
152 
154  void SetReferenceCount(int);
155 
157  void PrintRevisions(ostream&) {}
158 
159 protected:
161  virtual ~vtkObjectBase();
162 
163  virtual void CollectRevisions(ostream&) {} // Legacy; do not use!
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:
176 
177 private:
178  //BTX
179  friend VTKCOMMONCORE_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 
192 // VTK-HeaderTest-Exclude: vtkObjectBase.h
vtkObjectBase::WeakPointers
vtkWeakPointerBase ** WeakPointers
Definition: vtkObjectBase.h:166
vtkObjectBase::PrintRevisions
void PrintRevisions(ostream &)
Definition: vtkObjectBase.h:157
vtkObjectBase::operator=
void operator=(const vtkObjectBase &)
Definition: vtkObjectBase.h:186
vtkObjectBase::IsA
virtual int IsA(const char *name)
vtkObjectBase::PrintHeader
virtual void PrintHeader(ostream &os, vtkIndent indent)
VTKCOMMONCORE_EXPORT
#define VTKCOMMONCORE_EXPORT
Definition: vtkCommonCoreModule.h:15
vtkObjectBase::Print
void Print(ostream &os)
vtkObjectBase::vtkObjectBase
vtkObjectBase()
vtkObjectBase::Register
virtual void Register(vtkObjectBase *o)
vtkObjectBase::PrintTrailer
virtual void PrintTrailer(ostream &os, vtkIndent indent)
vtkObjectBase::ReportReferences
virtual void ReportReferences(vtkGarbageCollector *)
vtkObjectBase::New
static vtkObjectBase * New()
Definition: vtkObjectBase.h:113
vtkObjectBase::CollectRevisions
virtual void CollectRevisions(ostream &)
Definition: vtkObjectBase.h:163
vtkObjectBase::Delete
virtual void Delete()
vtkObjectBase::FastDelete
virtual void FastDelete()
vtkObjectBase::RegisterInternal
virtual void RegisterInternal(vtkObjectBase *, int check)
vtkObjectBase::~vtkObjectBase
virtual ~vtkObjectBase()
vtkgl::name
GLuint const GLchar * name
Definition: vtkgl.h:11983
vtkObjectBase::GetClassName
const char * GetClassName() const
vtkAtomic< vtkTypeInt32 >
vtkObjectBase::GetReferenceCount
int GetReferenceCount()
Definition: vtkObjectBase.h:147
vtkCommonCoreModule.h
vtkObjectBase::UnRegisterInternal
virtual void UnRegisterInternal(vtkObjectBase *, int check)
vtkObjectBase::vtkObjectBase
vtkObjectBase(const vtkObjectBase &)
Definition: vtkObjectBase.h:185
vtkObjectBase
abstract base class for most VTK objects
Definition: vtkObjectBase.h:60
vtkWeakPointerBase
Non-templated superclass for vtkWeakPointer.
Definition: vtkWeakPointerBase.h:33
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkObjectBase::IsTypeOf
static int IsTypeOf(const char *name)
vtkObjectBase::SetReferenceCount
void SetReferenceCount(int)
vtkGarbageCollector
Detect and break reference loops.
Definition: vtkGarbageCollector.h:99
vtkIndent.h
vtkObjectBase::ReferenceCount
vtkAtomicInt32 ReferenceCount
Definition: vtkObjectBase.h:165
vtkObjectBase::operator<<
friend VTKCOMMONCORE_EXPORT ostream & operator<<(ostream &os, vtkObjectBase &o)
vtkObjectBase::PrintSelf
virtual void PrintSelf(ostream &os, vtkIndent indent)
vtkgl::p
GLfloat GLfloat p
Definition: vtkgl.h:15717
vtkAtomicTypes.h
vtkObjectBase::UnRegister
virtual void UnRegister(vtkObjectBase *o)
vtkSystemIncludes.h