Main Page | Directories | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

vtkObjectBase.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkObjectBase.h,v $
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 =========================================================================*/
00053 #ifndef __vtkObjectBase_h
00054 #define __vtkObjectBase_h
00055 
00056 #include "vtkIndent.h"
00057 #include "vtkSystemIncludes.h"
00058 
00059 class vtkGarbageCollector;
00060 
00061 class VTK_COMMON_EXPORT vtkObjectBase 
00062 {
00063 public:
00067   virtual const char *GetClassName() const {return "vtkObjectBase";};
00068 
00072   static int IsTypeOf(const char *name);
00073 
00077   virtual int IsA(const char *name);
00078 
00082   virtual void Delete();
00083 
00085 
00087   static vtkObjectBase *New() 
00088     {return new vtkObjectBase;}
00090   
00091 #ifdef _WIN32
00092   // avoid dll boundary problems
00093   void* operator new( size_t tSize );
00094   void operator delete( void* p );
00095 #endif 
00096   
00099   void Print(ostream& os);
00100 
00102 
00106   virtual void PrintSelf(ostream& os, vtkIndent indent);
00107   virtual void PrintHeader(ostream& os, vtkIndent indent);
00108   virtual void PrintTrailer(ostream& os, vtkIndent indent);
00110 
00112   virtual void Register(vtkObjectBase* o);
00113 
00117   virtual void UnRegister(vtkObjectBase* o);
00118 
00120 
00121   int  GetReferenceCount() 
00122     {return this->ReferenceCount;}
00124 
00126   void SetReferenceCount(int);
00127   
00134   void PrintRevisions(ostream& os);
00135   
00136 protected:
00137   vtkObjectBase(); 
00138   virtual ~vtkObjectBase(); 
00139 
00140   virtual void CollectRevisions(ostream& os);
00141   
00142   int ReferenceCount;      // Number of uses of this object by other objects
00143 
00144   // See vtkGarbageCollector.h:
00145   virtual void ReportReferences(vtkGarbageCollector*);
00146   virtual void RemoveReferences();
00147   virtual void GarbageCollectionStarting();
00148   virtual void GarbageCollectionFinishing();
00149 private:
00150   //BTX
00151   friend VTK_COMMON_EXPORT ostream& operator<<(ostream& os, vtkObjectBase& o);
00152   friend class vtkGarbageCollector;
00153   //ETX
00154 protected:
00155 //BTX
00156   vtkObjectBase(const vtkObjectBase&) {}
00157   void operator=(const vtkObjectBase&) {}
00158 //ETX
00159 };
00160 
00161 #endif
00162