Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | 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 =========================================================================*/
00028 #ifndef __vtkInformationKey_h
00029 #define __vtkInformationKey_h
00030 
00031 #include "vtkObjectBase.h"
00032 #include "vtkObject.h" // Need vtkTypeRevisionMacro
00033 
00034 class vtkInformation;
00035 
00036 class VTK_FILTERING_EXPORT vtkInformationKey : public vtkObjectBase
00037 {
00038 public:
00039   vtkTypeRevisionMacro(vtkInformationKey,vtkObjectBase);
00040   void PrintSelf(ostream& os, vtkIndent indent);
00041 
00043   virtual void Register(vtkObjectBase*);
00044 
00046   virtual void UnRegister(vtkObjectBase*);
00047 
00050   const char* GetName();
00051 
00054   const char* GetLocation();
00055 
00057 
00062   vtkInformationKey(const char* name, const char* location);
00063   ~vtkInformationKey();
00065 
00069   virtual void ShallowCopy(vtkInformation* from, vtkInformation* to)=0;
00070 
00072 
00076   virtual void DeepCopy(vtkInformation *vtkNotUsed(from), 
00077     vtkInformation *vtkNotUsed(to)) {}
00079 
00081   virtual void Remove(vtkInformation* info);
00082 
00084   virtual void Report(vtkInformation* info, vtkGarbageCollector* collector);
00085 
00087 
00088   void Print(vtkInformation* info);
00089   virtual void Print(ostream& os, vtkInformation* info);
00091 
00092 protected:
00093   const char* Name;
00094   const char* Location;
00095 
00096   // Set/Get the value associated with this key instance in the given
00097   // information object.
00098   void SetAsObjectBase(vtkInformation* info, vtkObjectBase* value);
00099   vtkObjectBase* GetAsObjectBase(vtkInformation* info);
00100 
00101   // Report the object associated with this key instance in the given
00102   // information object to the collector.
00103   void ReportAsObjectBase(vtkInformation* info,
00104                           vtkGarbageCollector* collector);
00105 
00106   // Helper for debug leaks support.
00107   void ConstructClass(const char*);
00108 
00109 private:
00110   vtkInformationKey(const vtkInformationKey&);  // Not implemented.
00111   void operator=(const vtkInformationKey&);  // Not implemented.
00112 };
00113 
00114 // Macros to define an information key instance in a C++ source file.
00115 // The corresponding method declaration must appear in the class
00116 // definition in the header file.
00117 #define vtkInformationKeyMacro(CLASS, NAME, type)                      \
00118   static vtkInformation##type##Key* CLASS##_##NAME =                   \
00119          new vtkInformation##type##Key(#NAME, #CLASS);                 \
00120   vtkInformation##type##Key* CLASS::NAME() { return CLASS##_##NAME; }
00121 #define vtkInformationKeyRestrictedMacro(CLASS, NAME, type, required)       \
00122   static vtkInformation##type##Key* CLASS##_##NAME =                        \
00123          new vtkInformation##type##Key(#NAME, #CLASS, required);            \
00124   vtkInformation##type##Key* CLASS::NAME() { return CLASS##_##NAME; }
00125 
00126 #endif

Generated on Mon Jan 21 23:07:19 2008 for VTK by  doxygen 1.4.3-20050530