00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00028 #ifndef __vtkInformationKey_h
00029 #define __vtkInformationKey_h
00030 
00031 #include "vtkObjectBase.h"
00032 #include "vtkObject.h" 
00033 
00034 class vtkInformation;
00035 
00036 class VTK_COMMON_EXPORT vtkInformationKey : public vtkObjectBase
00037 {
00038 public:
00039   vtkTypeMacro(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 *from, vtkInformation *to)
00077     { this->ShallowCopy(from, to); }
00079 
00081   virtual int Has(vtkInformation* info);
00082 
00084   virtual void Remove(vtkInformation* info);
00085 
00087   virtual void Report(vtkInformation* info, vtkGarbageCollector* collector);
00088 
00090 
00091   void Print(vtkInformation* info);
00092   virtual void Print(ostream& os, vtkInformation* info);
00094 
00095 protected:
00096   const char* Name;
00097   const char* Location;
00098 
00099   
00100   
00101   void SetAsObjectBase(vtkInformation* info, vtkObjectBase* value);
00102   vtkObjectBase* GetAsObjectBase(vtkInformation* info);
00103 
00104   
00105   
00106   void ReportAsObjectBase(vtkInformation* info,
00107                           vtkGarbageCollector* collector);
00108 
00109   
00110   void ConstructClass(const char*);
00111 
00112 private:
00113   vtkInformationKey(const vtkInformationKey&);  
00114   void operator=(const vtkInformationKey&);  
00115 };
00116 
00117 
00118 
00119 
00120 #define vtkInformationKeyMacro(CLASS, NAME, type)             \
00121  vtkInformation##type##Key* CLASS::NAME()                     \
00122    {                                                          \
00123    static vtkInformation##type##Key* CLASS##_##NAME =         \
00124         new vtkInformation##type##Key(#NAME, #CLASS);         \
00125    return CLASS##_##NAME;                                     \
00126    }
00127 #define vtkInformationKeyRestrictedMacro(CLASS, NAME, type, required)   \
00128  vtkInformation##type##Key* CLASS::NAME()                               \
00129    {                                                                    \
00130    static vtkInformation##type##Key* CLASS##_##NAME =                   \
00131      new vtkInformation##type##Key(#NAME, #CLASS, required);            \
00132    return CLASS##_##NAME;                                               \
00133    }
00134 
00135 #endif