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

Common/vtkObject.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkObject.h,v $
00005   Language:  C++
00006 
00007   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
00008   All rights reserved.
00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00010 
00011      This software is distributed WITHOUT ANY WARRANTY; without even 
00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00013      PURPOSE.  See the above copyright notice for more information.
00014 
00015 =========================================================================*/
00067 #ifndef __vtkObject_h
00068 #define __vtkObject_h
00069 
00070 #include "vtkObjectBase.h"
00071 #include "vtkSetGet.h"
00072 #include "vtkTimeStamp.h"
00073 
00074 class vtkSubjectHelper;
00075 class vtkCommand;
00076 
00077 class VTK_COMMON_EXPORT vtkObject : public vtkObjectBase
00078 {
00079 public:
00080   vtkTypeRevisionMacro(vtkObject,vtkObjectBase);
00081 
00084   static vtkObject *New();
00085 
00086 #ifdef _WIN32
00087   // avoid dll boundary problems
00088   void* operator new( size_t tSize );
00089   void operator delete( void* p );
00090 #endif 
00091   
00093   virtual void DebugOn();
00094 
00096   virtual void DebugOff();
00097   
00099   unsigned char GetDebug();
00100   
00102   void SetDebug(unsigned char debugFlag);
00103   
00106   static void BreakOnError();
00107   
00112   virtual void Modified();
00113   
00115   virtual unsigned long GetMTime();
00116 
00121   virtual void PrintSelf(ostream& os, vtkIndent indent);
00122 
00124 
00126   static void SetGlobalWarningDisplay(int val);
00127   static void GlobalWarningDisplayOn(){vtkObject::SetGlobalWarningDisplay(1);};
00128   static void GlobalWarningDisplayOff() 
00129     {vtkObject::SetGlobalWarningDisplay(0);};
00130   static int  GetGlobalWarningDisplay();
00132   
00134   virtual void Register(vtkObjectBase* o);
00135 
00139   virtual void UnRegister(vtkObjectBase* o);
00140 
00142 
00151   unsigned long AddObserver(unsigned long event, vtkCommand *, 
00152                             float priority=0.0);
00153   unsigned long AddObserver(const char *event, vtkCommand *, 
00154                             float priority=0.0);
00155   vtkCommand *GetCommand(unsigned long tag);
00156   void RemoveObserver(vtkCommand*);
00157   //ETX
00158   void RemoveObserver(unsigned long tag);
00159   void RemoveObservers(unsigned long event);
00160   void RemoveObservers(const char *event);
00161   int HasObserver(unsigned long event);
00162   int HasObserver(const char *event);
00164 
00175   // This method invokes an event and return whether the event was
00176   // aborted or not. If the event was aborted, the return value is 1,
00177   // otherwise it is 0.  
00178   //BTX
00179   int InvokeEvent(unsigned long event, void *callData);
00180   int InvokeEvent(const char *event, void *callData);
00181   //ETX
00182   int InvokeEvent(unsigned long event) { return this->InvokeEvent(event, NULL); };
00183   int InvokeEvent(const char *event) { return this->InvokeEvent(event, NULL); };
00184   
00185 protected:
00186   vtkObject(); 
00187   virtual ~vtkObject(); 
00188 
00189   unsigned char Debug;     // Enable debug messages
00190   vtkTimeStamp MTime;      // Keep track of modification time
00191   vtkSubjectHelper *SubjectHelper;
00192 
00193 private:
00194   vtkObject(const vtkObject&);  // Not implemented.
00195   void operator=(const vtkObject&);  // Not implemented.
00196 };
00197 
00198 #endif
00199