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

dox/Common/vtkObject.h

Go to the documentation of this file.
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkObject.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 =========================================================================*/ 00049 #ifndef __vtkObject_h 00050 #define __vtkObject_h 00051 00052 #include "vtkObjectBase.h" 00053 #include "vtkSetGet.h" 00054 #include "vtkTimeStamp.h" 00055 00056 class vtkSubjectHelper; 00057 class vtkCommand; 00058 00059 class VTK_COMMON_EXPORT vtkObject : public vtkObjectBase 00060 { 00061 public: 00062 vtkTypeRevisionMacro(vtkObject,vtkObjectBase); 00063 00066 static vtkObject *New(); 00067 00068 #ifdef _WIN32 00069 // avoid dll boundary problems 00070 void* operator new( size_t tSize ); 00071 void operator delete( void* p ); 00072 #endif 00073 00075 virtual void DebugOn(); 00076 00078 virtual void DebugOff(); 00079 00081 unsigned char GetDebug(); 00082 00084 void SetDebug(unsigned char debugFlag); 00085 00088 static void BreakOnError(); 00089 00094 virtual void Modified(); 00095 00097 virtual unsigned long GetMTime(); 00098 00103 virtual void PrintSelf(ostream& os, vtkIndent indent); 00104 00106 00108 static void SetGlobalWarningDisplay(int val); 00109 static void GlobalWarningDisplayOn(){vtkObject::SetGlobalWarningDisplay(1);}; 00110 static void GlobalWarningDisplayOff() 00111 {vtkObject::SetGlobalWarningDisplay(0);}; 00112 static int GetGlobalWarningDisplay(); 00114 00116 virtual void Register(vtkObjectBase* o); 00117 00121 virtual void UnRegister(vtkObjectBase* o); 00122 00124 00133 unsigned long AddObserver(unsigned long event, vtkCommand *, 00134 float priority=0.0); 00135 unsigned long AddObserver(const char *event, vtkCommand *, 00136 float priority=0.0); 00137 vtkCommand *GetCommand(unsigned long tag); 00138 void RemoveObserver(vtkCommand*); 00139 void RemoveObservers(unsigned long event, vtkCommand *); 00140 void RemoveObservers(const char *event, vtkCommand *); 00141 int HasObserver(unsigned long event, vtkCommand *); 00142 int HasObserver(const char *event, vtkCommand *); 00143 //ETX 00144 void RemoveObserver(unsigned long tag); 00145 void RemoveObservers(unsigned long event); 00146 void RemoveObservers(const char *event); 00147 int HasObserver(unsigned long event); 00148 int HasObserver(const char *event); 00150 00161 // This method invokes an event and return whether the event was 00162 // aborted or not. If the event was aborted, the return value is 1, 00163 // otherwise it is 0. 00164 //BTX 00165 int InvokeEvent(unsigned long event, void *callData); 00166 int InvokeEvent(const char *event, void *callData); 00167 //ETX 00168 int InvokeEvent(unsigned long event) { return this->InvokeEvent(event, NULL); }; 00169 int InvokeEvent(const char *event) { return this->InvokeEvent(event, NULL); }; 00170 00171 protected: 00172 vtkObject(); 00173 virtual ~vtkObject(); 00174 00175 unsigned char Debug; // Enable debug messages 00176 vtkTimeStamp MTime; // Keep track of modification time 00177 vtkSubjectHelper *SubjectHelper; 00178 00179 private: 00180 vtkObject(const vtkObject&); // Not implemented. 00181 void operator=(const vtkObject&); // Not implemented. 00182 }; 00183 00184 #endif 00185