Main Page Class Hierarchy Alphabetical List Compound List File List Compound 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 =========================================================================*/
    00066 #ifndef __vtkObject_h
    00067 #define __vtkObject_h
    00068
    00069 #include "vtkObjectBase.h"
    00070 #include "vtkSetGet.h"
    00071 #include "vtkTimeStamp.h"
    00072
    00073 class vtkSubjectHelper;
    00074 class vtkCommand;
    00075
    00076 class VTK_COMMON_EXPORT vtkObject : public vtkObjectBase
    00077 {
    00078 public:
    00079   vtkTypeRevisionMacro(vtkObject,vtkObjectBase);
    00080
    00083   static vtkObject *New();
    00084
    00085 #ifdef _WIN32
    00086   // avoid dll boundary problems
    00087   void* operator new( size_t tSize );
    00088   void operator delete( void* p );
    00089 #endif
    00090
    00092   virtual void DebugOn();
    00093
    00095   virtual void DebugOff();
    00096
    00098   unsigned char GetDebug();
    00099
    00101   void SetDebug(unsigned char debugFlag);
    00102
    00105   static void BreakOnError();
    00106
    00111   virtual void Modified();
    00112
    00114   virtual unsigned long GetMTime();
    00115
    00120   virtual void PrintSelf(ostream& os, vtkIndent indent);
    00121
    00123
    00125   static void SetGlobalWarningDisplay(int val);
    00126   static void GlobalWarningDisplayOn(){vtkObject::SetGlobalWarningDisplay(1);};
    00127   static void GlobalWarningDisplayOff()
    00128     {vtkObject::SetGlobalWarningDisplay(0);};
    00129   static int  GetGlobalWarningDisplay();
    00131
    00133   virtual void Register(vtkObjectBase* o);
    00134
    00138   virtual void UnRegister(vtkObjectBase* o);
    00139
    00141
    00150   unsigned long AddObserver(unsigned long event, vtkCommand *,
    00151                             float priority=0.0);
    00152   unsigned long AddObserver(const char *event, vtkCommand *,
    00153                             float priority=0.0);
    00154   vtkCommand *GetCommand(unsigned long tag);
    00155   void RemoveObserver(vtkCommand*);
    00156   //ETX
    00157   void RemoveObserver(unsigned long tag);
    00158   void RemoveObservers(unsigned long event);
    00159   void RemoveObservers(const char *event);
    00160   int HasObserver(unsigned long event);
    00161   int HasObserver(const char *event);
    00163
    00174   // This method invokes an event and return whether the event was
    00175   // aborted or not. If the event was aborted, the return value is 1,
    00176   // otherwise it is 0.
    00177   //BTX
    00178   int InvokeEvent(unsigned long event, void *callData);
    00179   int InvokeEvent(const char *event, void *callData);
    00180   //ETX
    00181   int InvokeEvent(unsigned long event) { return this->InvokeEvent(event, NULL); };
    00182   int InvokeEvent(const char *event) { return this->InvokeEvent(event, NULL); };
    00183
    00184 protected:
    00185   vtkObject();
    00186   virtual ~vtkObject();
    00187
    00188   unsigned char Debug;     // Enable debug messages
    00189   vtkTimeStamp MTime;      // Keep track of modification time
    00190   vtkSubjectHelper *SubjectHelper;
    00191
    00192 private:
    00193   vtkObject(const vtkObject&);  // Not implemented.
    00194   void operator=(const vtkObject&);  // Not implemented.
    00195 };
    00196
    00197 #endif
    00198