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

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 =========================================================================*/
00064 #ifndef __vtkObject_h
00065 #define __vtkObject_h
00066 
00067 #include "vtkObjectBase.h"
00068 #include "vtkSetGet.h"
00069 #include "vtkTimeStamp.h"
00070 
00071 class vtkSubjectHelper;
00072 class vtkCommand;
00073 
00074 class VTK_COMMON_EXPORT vtkObject : public vtkObjectBase
00075 {
00076 public:
00077   vtkTypeRevisionMacro(vtkObject,vtkObjectBase);
00078 
00081   static vtkObject *New();
00082 
00083 #ifdef _WIN32
00084   // avoid dll boundary problems
00085   void* operator new( size_t tSize );
00086   void operator delete( void* p );
00087 #endif 
00088   
00090   virtual void DebugOn();
00091 
00093   virtual void DebugOff();
00094   
00096   unsigned char GetDebug();
00097   
00099   void SetDebug(unsigned char debugFlag);
00100   
00103   static void BreakOnError();
00104   
00109   virtual void Modified();
00110   
00112   virtual unsigned long GetMTime();
00113 
00118   virtual void PrintSelf(ostream& os, vtkIndent indent);
00119 
00121 
00123   static void SetGlobalWarningDisplay(int val);
00124   static void GlobalWarningDisplayOn(){vtkObject::SetGlobalWarningDisplay(1);};
00125   static void GlobalWarningDisplayOff() 
00126     {vtkObject::SetGlobalWarningDisplay(0);};
00127   static int  GetGlobalWarningDisplay();
00129   
00131   virtual void Register(vtkObjectBase* o);
00132 
00136   virtual void UnRegister(vtkObjectBase* o);
00137 
00139 
00148   unsigned long AddObserver(unsigned long event, vtkCommand *, 
00149                             float priority=0.0);
00150   unsigned long AddObserver(const char *event, vtkCommand *, 
00151                             float priority=0.0);
00152   vtkCommand *GetCommand(unsigned long tag);
00153   void RemoveObserver(vtkCommand*);
00154   void RemoveObservers(unsigned long event, vtkCommand *);
00155   void RemoveObservers(const char *event, vtkCommand *);
00156   int HasObserver(unsigned long event, vtkCommand *);
00157   int HasObserver(const char *event, vtkCommand *);
00158   //ETX
00159   void RemoveObserver(unsigned long tag);
00160   void RemoveObservers(unsigned long event);
00161   void RemoveObservers(const char *event);
00162   int HasObserver(unsigned long event);
00163   int HasObserver(const char *event);
00165 
00176   // This method invokes an event and return whether the event was
00177   // aborted or not. If the event was aborted, the return value is 1,
00178   // otherwise it is 0.  
00179   //BTX
00180   int InvokeEvent(unsigned long event, void *callData);
00181   int InvokeEvent(const char *event, void *callData);
00182   //ETX
00183   int InvokeEvent(unsigned long event) { return this->InvokeEvent(event, NULL); };
00184   int InvokeEvent(const char *event) { return this->InvokeEvent(event, NULL); };
00185   
00186 protected:
00187   vtkObject(); 
00188   virtual ~vtkObject(); 
00189 
00190   unsigned char Debug;     // Enable debug messages
00191   vtkTimeStamp MTime;      // Keep track of modification time
00192   vtkSubjectHelper *SubjectHelper;
00193 
00194 private:
00195   vtkObject(const vtkObject&);  // Not implemented.
00196   void operator=(const vtkObject&);  // Not implemented.
00197 };
00198 
00199 #endif
00200