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

vtkInformationKey.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkInformationKey.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 =========================================================================*/
00039 #ifndef __vtkInformationKey_h
00040 #define __vtkInformationKey_h
00041 
00042 #include "vtkObjectBase.h"
00043 #include "vtkObject.h" // Need vtkTypeRevisionMacro
00044 
00045 class vtkInformation;
00046 
00047 class VTK_FILTERING_EXPORT vtkInformationKey : public vtkObjectBase
00048 {
00049 public:
00050   vtkTypeRevisionMacro(vtkInformationKey,vtkObjectBase);
00051   void PrintSelf(ostream& os, vtkIndent indent);
00052 
00054   virtual void Register(vtkObjectBase*);
00055 
00057   virtual void UnRegister(vtkObjectBase*);
00058 
00061   const char* GetName();
00062 
00065   const char* GetLocation();
00066 
00068 
00073   vtkInformationKey(const char* name, const char* location);
00074   ~vtkInformationKey();
00076 
00080   virtual void Copy(vtkInformation* from, vtkInformation* to)=0;
00081 
00083   void Remove(vtkInformation* info);
00084 
00086   virtual void Report(vtkInformation* info, vtkGarbageCollector* collector);
00087 
00088 protected:
00089   const char* Name;
00090   const char* Location;
00091 
00092   // Set/Get the value associated with this key instance in the given
00093   // information object.
00094   void SetAsObjectBase(vtkInformation* info, vtkObjectBase* value);
00095   vtkObjectBase* GetAsObjectBase(vtkInformation* info);
00096 
00097   // Helper for debug leaks support.
00098   void ConstructClass(const char*);
00099 
00100 private:
00101   vtkInformationKey(const vtkInformationKey&);  // Not implemented.
00102   void operator=(const vtkInformationKey&);  // Not implemented.
00103 };
00104 
00105 // Macros to define an information key instance in a C++ source file.
00106 // The corresponding method declaration must appear in the class
00107 // definition in the header file.
00108 #define vtkInformationKeyMacro(CLASS, NAME, type)                      \
00109   static vtkInformation##type##Key CLASS##_##NAME(#NAME, #CLASS);      \
00110   vtkInformation##type##Key* CLASS::NAME() { return &CLASS##_##NAME; }
00111 #define vtkInformationKeyRestrictedMacro(CLASS, NAME, type, required)       \
00112   static vtkInformation##type##Key CLASS##_##NAME(#NAME, #CLASS, required); \
00113   vtkInformation##type##Key* CLASS::NAME() { return &CLASS##_##NAME; }
00114 
00115 #endif